diff --git a/.github/workflows/pr_lint_gha.yaml b/.github/workflows/pr_lint_gha.yaml new file mode 100644 index 0000000..5d12ec8 --- /dev/null +++ b/.github/workflows/pr_lint_gha.yaml @@ -0,0 +1,29 @@ +name: GitHub Actions + +on: + workflow_dispatch: + pull_request: + branches: ["**"] + paths: + - ".github/**.yaml" + - ".github/**.yml" + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install actionlint + run: bash <(curl -s https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + + - name: Run actionlint + run: ./actionlint -ignore SC2086 diff --git a/.github/workflows/pr_lint_license.yaml b/.github/workflows/pr_lint_license.yaml new file mode 100644 index 0000000..51cd60d --- /dev/null +++ b/.github/workflows/pr_lint_license.yaml @@ -0,0 +1,47 @@ +name: Check License + +on: + workflow_dispatch: + pull_request: + branches: ["**"] + paths: + - "**/Cargo.toml" + - "LICENSE*" + - ".github/workflows/pr_lint_license.yaml" + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + check-license: + name: Verify License + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Check LICENSE file exists + run: | + if [ ! -f LICENSE ]; then + echo "::error::LICENSE file is missing" + exit 1 + fi + echo "License file present" + + - name: Check all packages reference LICENSE + run: | + MISSING=$(cargo metadata --format-version 1 --no-deps 2>/dev/null | \ + jq -r '.packages[] | select(.license != "LICENSE") | .name') + + if [ -n "$MISSING" ]; then + echo "::error::The following packages do not reference 'LICENSE':" + echo "$MISSING" + echo "" + echo "Ensure each Cargo.toml has: license = \"LICENSE\"" + exit 1 + fi + + echo "All packages correctly reference LICENSE file" diff --git a/bin/ethlambda/Cargo.toml b/bin/ethlambda/Cargo.toml index ef20137..16eb517 100644 --- a/bin/ethlambda/Cargo.toml +++ b/bin/ethlambda/Cargo.toml @@ -3,6 +3,7 @@ name = "ethlambda" version.workspace = true edition.workspace = true authors.workspace = true +license.workspace = true [dependencies] ethlambda-blockchain.workspace = true