| 1 |
--- |
| 2 |
name: Gating tests |
| 3 |
|
| 4 |
on: |
| 5 |
pull_request: |
| 6 |
push: |
| 7 |
branches: [main] |
| 8 |
|
| 9 |
env: |
| 10 |
GITHUB_CI: true |
| 11 |
|
| 12 |
jobs: |
| 13 |
audit-and-build: |
| 14 |
name: Audit and build |
| 15 |
runs-on: ubuntu-latest |
| 16 |
container: |
| 17 |
image: fedora:latest |
| 18 |
|
| 19 |
steps: |
| 20 |
- name: Checkout repository |
| 21 |
uses: actions/checkout@v4 |
| 22 |
|
| 23 |
- name: Setup Node.js |
| 24 |
uses: actions/setup-node@v4 |
| 25 |
with: |
| 26 |
node-version: "22" |
| 27 |
|
| 28 |
- name: Audit dependencies |
| 29 |
run: npx audit-ci --config audit-ci.json --skip-dev |
| 30 |
|
| 31 |
- name: Cache dependencies |
| 32 |
id: cache-deps |
| 33 |
uses: actions/cache@v4 |
| 34 |
with: |
| 35 |
path: ~/.npm |
| 36 |
key: npm-${{ hashFiles('package-lock.json') }} |
| 37 |
restore-keys: npm- |
| 38 |
|
| 39 |
- name: Install project |
| 40 |
run: npm clean-install |
| 41 |
|
| 42 |
- name: Prettier |
| 43 |
run: npm run prettier |
| 44 |
|
| 45 |
- name: Lint |
| 46 |
run: npm run lint |
| 47 |
|
| 48 |
- name: Knip |
| 49 |
run: npm run knip |
| 50 |
|
| 51 |
- name: Build project |
| 52 |
run: npm run build |
| 53 |
|
| 54 |
unit-tests: |
| 55 |
name: Unit tests |
| 56 |
needs: audit-and-build |
| 57 |
runs-on: ubuntu-latest |
| 58 |
steps: |
| 59 |
- uses: actions/checkout@v4 |
| 60 |
|
| 61 |
- name: Setup Node.js |
| 62 |
uses: actions/setup-node@v4 |
| 63 |
with: |
| 64 |
node-version: "22" |
| 65 |
|
| 66 |
- name: Install project |
| 67 |
run: npm clean-install |
| 68 |
|
| 69 |
- name: Run vitest |
| 70 |
run: npm test |
| 71 |
|
| 72 |
shellcheck: |
| 73 |
name: Shellcheck |
| 74 |
runs-on: ubuntu-latest |
| 75 |
steps: |
| 76 |
- uses: actions/checkout@v4 |
| 77 |
with: |
| 78 |
fetch-depth: 1 |
| 79 |
- name: Run ShellCheck |
| 80 |
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 |
| 81 |
env: |
| 82 |
SHELLCHECK_OPTS: -x -a -o all -e SC2292 -e SC2310 -e SC2311 -P "./developer" |