|
| 1 | +# SPDX-License-Identifier: MIT |
| 2 | +# SPDX-FileCopyrightText: Copyright 2024 LoopBack contributors |
| 3 | +name: CI |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + |
| 13 | +permissions: {} |
| 14 | + |
| 15 | +jobs: |
| 16 | + code-lint: |
| 17 | + name: Code lint |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + timeout-minutes: 5 |
| 20 | + steps: |
| 21 | + - name: Harden runner |
| 22 | + uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 |
| 23 | + with: |
| 24 | + egress-policy: audit |
| 25 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
| 28 | + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 |
| 29 | + with: |
| 30 | + node-version: 22 |
| 31 | + cache: npm |
| 32 | + - name: Bootstrap dependencies |
| 33 | + run: npm ci --ignore-scripts |
| 34 | + - name: Verify code linting |
| 35 | + run: npm run lint --ignore-scripts |
| 36 | + commit-lint: |
| 37 | + name: Commit lint |
| 38 | + runs-on: ubuntu-24.04 |
| 39 | + timeout-minutes: 5 |
| 40 | + if: ${{ github.event.pull_request }} |
| 41 | + steps: |
| 42 | + - name: Harden runner |
| 43 | + uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 |
| 44 | + with: |
| 45 | + egress-policy: audit |
| 46 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 47 | + with: |
| 48 | + fetch-depth: 0 |
| 49 | + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 |
| 50 | + with: |
| 51 | + node-version: 22 |
| 52 | + cache: npm |
| 53 | + - name: Bootstrap dependencies |
| 54 | + run: npm ci --ignore-scripts |
| 55 | + - name: Verify Commit Linting |
| 56 | + run: |- |
| 57 | + npm exec \ |
| 58 | + --no \ |
| 59 | + --package=@commitlint/cli \ |
| 60 | + -- \ |
| 61 | + commitlint \ |
| 62 | + --from=origin/master \ |
| 63 | + --to=HEAD \ |
| 64 | + --verbose |
| 65 | + license-lint: |
| 66 | + name: License lint |
| 67 | + runs-on: ubuntu-24.04 |
| 68 | + timeout-minutes: 5 |
| 69 | + steps: |
| 70 | + - name: Harden runner |
| 71 | + uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 |
| 72 | + with: |
| 73 | + disable-sudo: true |
| 74 | + egress-policy: block |
| 75 | + allowed-endpoints: > |
| 76 | + github.com:443 |
| 77 | + - name: Checkout |
| 78 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 79 | + with: |
| 80 | + fetch-depth: 1 |
| 81 | + - name: Setup REUSE tool |
| 82 | + uses: fsfe/reuse-action@3ae3c6bdf1257ab19397fab11fd3312144692083 # v4.0.0 |
| 83 | + test: |
| 84 | + name: Test |
| 85 | + runs-on: ubuntu-24.04 |
| 86 | + timeout-minutes: 10 |
| 87 | + strategy: |
| 88 | + fail-fast: false |
| 89 | + matrix: |
| 90 | + node-version: |
| 91 | + - 16 |
| 92 | + - 18 |
| 93 | + - 20 |
| 94 | + - 22 |
| 95 | + db2-version: |
| 96 | + - :11.5.9.0@sha256:77095d4e04cf4448c0257086afcb2c166193d718dc33441da3b949f97e21efd5 |
| 97 | + steps: |
| 98 | + - name: Harden runner |
| 99 | + uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 |
| 100 | + with: |
| 101 | + egress-policy: audit |
| 102 | + - name: Checkout |
| 103 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 104 | + with: |
| 105 | + fetch-depth: 1 |
| 106 | + - name: Run test suite |
| 107 | + uses: ./test |
| 108 | + with: |
| 109 | + node-version: ${{ github.matrix.node-version }} |
| 110 | + db2-version: ${{ github.matrix.db2-version }} |
| 111 | + _internal-mode: true |
0 commit comments