|
| 1 | +# SPDX-License-Identifier: MPL-2.0-or-later |
| 2 | +# SPDX-FileCopyrightText: 2025 Hyperpolymath <hyperpolymath@proton.me> |
| 3 | +name: CI |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + pull_request: |
| 9 | + branches: [main] |
| 10 | + |
| 11 | +permissions: read-all |
| 12 | + |
| 13 | +jobs: |
| 14 | + validate-configs: |
| 15 | + name: Validate Nickel Configurations |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 |
| 20 | + with: |
| 21 | + submodules: recursive |
| 22 | + |
| 23 | + - name: Install Nickel |
| 24 | + run: | |
| 25 | + curl -sSL https://github.com/tweag/nickel/releases/latest/download/nickel-x86_64-linux -o nickel |
| 26 | + chmod +x nickel |
| 27 | + sudo mv nickel /usr/local/bin/ |
| 28 | +
|
| 29 | + - name: Validate configurations |
| 30 | + run: | |
| 31 | + nickel export configs/base.ncl > /dev/null |
| 32 | + nickel export configs/modules.ncl > /dev/null |
| 33 | + nickel export configs/environments.ncl > /dev/null |
| 34 | + echo "✓ All Nickel configurations valid" |
| 35 | +
|
| 36 | + lint-spdx: |
| 37 | + name: Validate SPDX Headers |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 |
| 42 | + |
| 43 | + - name: Check SPDX headers |
| 44 | + run: | |
| 45 | + missing=0 |
| 46 | + for file in $(find . -type f \( -name "*.ncl" -o -name "*.ex" -o -name "*.exs" -o -name "*.res" -o -name "*.ada" -o -name "*.adb" -o -name "*.ads" -o -name "*.sh" \) -not -path "./.git/*" -not -path "./modules/*"); do |
| 47 | + if ! head -5 "$file" | grep -q "SPDX-License-Identifier"; then |
| 48 | + echo "Missing SPDX header: $file" |
| 49 | + missing=$((missing + 1)) |
| 50 | + fi |
| 51 | + done |
| 52 | + if [ $missing -gt 0 ]; then |
| 53 | + echo "::error::$missing files missing SPDX headers" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | + echo "✓ All files have SPDX headers" |
| 57 | +
|
| 58 | + lint-shell: |
| 59 | + name: Lint Shell Scripts |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - name: Checkout |
| 63 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 |
| 64 | + |
| 65 | + - name: Run ShellCheck |
| 66 | + run: | |
| 67 | + find . -name "*.sh" -not -path "./.git/*" -not -path "./modules/*" -exec shellcheck {} \; |
| 68 | +
|
| 69 | + security-scan: |
| 70 | + name: Security Scan |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - name: Checkout |
| 74 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 |
| 75 | + |
| 76 | + - name: Run Trufflehog |
| 77 | + uses: trufflesecurity/trufflehog@8a8ef8526528d8a4ff3e2c90be08e25ef8efbd9b # v3 |
| 78 | + with: |
| 79 | + extra_args: --only-verified |
| 80 | + |
| 81 | + check-links: |
| 82 | + name: Check Documentation Links |
| 83 | + runs-on: ubuntu-latest |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 |
| 87 | + |
| 88 | + - name: Link Checker |
| 89 | + uses: lycheeverse/lychee-action@v2.7.0 |
| 90 | + with: |
| 91 | + args: --verbose --no-progress '**/*.md' '**/*.adoc' |
| 92 | + fail: true |
0 commit comments