Эх сурвалжийг харах

Add check for SPDX headers (#1057)

Signed-off-by: Sean Young <sean@mess.org>
Sean Young 3 жил өмнө
parent
commit
be65cc0397

+ 1 - 1
.github/Dockerfile

@@ -24,7 +24,7 @@ FROM ubuntu:20.04
 
 ENV DEBIAN_FRONTEND=noninteractive
 RUN apt-get update
-RUN apt-get install -y zlib1g-dev pkg-config libssl-dev git libffi-dev curl gcc g++ make
+RUN apt-get install -y zlib1g-dev pkg-config libssl-dev git libffi-dev curl gcc g++ make python3
 RUN apt-get clean
 RUN apt-get autoclean
 

+ 7 - 0
.github/workflows/test.yml

@@ -25,9 +25,16 @@ jobs:
         uses: actions/checkout@v3
       - name: Rust stable
         run: rustup default stable
+      - name: Install python3
+        run: apt-get -y install python3
+      - uses: enarx/spdx@master
+        with:
+          licenses: Apache-2.0 MIT
       - name: Run cargo fmt
+        if: always()
         run: cargo fmt --all -- --check
       - name: Run cargo clippy
+        if: always()
         run: cargo clippy --workspace --tests --bins -- -D warnings -D clippy::inconsistent-struct-constructor
 
   docs:

+ 2 - 0
docs/conf.py

@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+#
 # Configuration file for the Sphinx documentation builder.
 #
 # This file only contains a selection of the most common options. For a full

+ 2 - 0
integration/anchor/programs/anchor/src/lib.rs

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 use anchor_lang::prelude::*;
 
 declare_id!("z7FbDfQDfucxJz5o8jrGLgvSbdoeSqX5VrxBb5TVjHq");

+ 2 - 0
src/codegen/encoding/buffer_validator.rs

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 use crate::codegen::cfg::{ControlFlowGraph, Instr};
 use crate::codegen::expression::assert_failure;
 use crate::codegen::vartable::Vartable;

+ 2 - 0
src/codegen/events/mod.rs

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 mod solana;
 mod substrate;
 

+ 2 - 0
src/codegen/events/solana.rs

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 use crate::codegen::cfg::{ControlFlowGraph, Instr};
 use crate::codegen::encoding::create_encoder;
 use crate::codegen::events::EventEmitter;

+ 2 - 0
src/codegen/events/substrate.rs

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 use crate::codegen::cfg::{ControlFlowGraph, Instr};
 use crate::codegen::events::EventEmitter;
 use crate::codegen::expression::expression;

+ 2 - 0
src/linker/linker.cpp

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 // Call the LLD linker
 #include "lld/Common/Driver.h"
 

+ 2 - 0
src/sema/builtin_structs.rs

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 use crate::sema::ast::{Namespace, Parameter, StructDecl, StructType, Type};
 use once_cell::sync::Lazy;
 use solang_parser::pt;

+ 2 - 1
stdlib/bigint.c

@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: Apache-2.0
 
 #include <stdint.h>
 #include <stdbool.h>
@@ -62,7 +63,7 @@ void __mul32(uint32_t left[], uint32_t right[], uint32_t out[], int len)
     }
 }
 
-// A version of __mul32 that detects overflow. 
+// A version of __mul32 that detects overflow.
 bool __mul32_with_builtin_ovf(uint32_t left[], uint32_t right[], uint32_t out[], int len)
 {
     bool overflow = false;

+ 1 - 1
stdlib/format.c

@@ -1,4 +1,4 @@
-/// This should be compiled with clang 11.
+// SPDX-License-Identifier: Apache-2.0
 
 #include <stdint.h>
 

+ 2 - 0
stdlib/heap.c

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 #include <stdint.h>
 #include <stddef.h>
 #include <stdbool.h>

+ 2 - 0
stdlib/ripemd160.c

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 /*
  * Source:
  * https://github.com/pycrypto/pycrypto/blob/master/src/RIPEMD160.c

+ 1 - 0
stdlib/solana.c

@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: Apache-2.0
 
 #include <stdint.h>
 #include <stddef.h>

+ 3 - 1
stdlib/solana_sdk.h

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 #pragma once
 
 /**
@@ -503,7 +505,7 @@ static uint64_t sol_invoke_signed(
  * @param instruction Instruction to process
  * @param account_infos Accounts used by instruction
  * @param account_infos_len Length of account_infos array
-*/
+ */
 static uint64_t sol_invoke(
     const SolInstruction *instruction,
     const SolAccountInfo *account_infos,

+ 2 - 1
stdlib/stdlib.c

@@ -1,4 +1,5 @@
-// clang --target=wasm32 -c -emit-llvm -O3 -ffreestanding -fno-builtin -Wall stdlib.c
+// SPDX-License-Identifier: Apache-2.0
+
 #include <stdint.h>
 #include <stddef.h>
 #include <stdbool.h>

+ 2 - 0
stdlib/stdlib.h

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 /*
  * Vector is used for dynamic array
  */

+ 2 - 0
stdlib/substrate.c

@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0
+
 #include <stdint.h>
 #include <stddef.h>