|
1 |
| -name: tests |
| 1 | +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json |
| 2 | +# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions |
| 3 | + |
| 4 | +name: 🧪 Tests |
2 | 5 |
|
3 | 6 | on:
|
4 | 7 | push:
|
5 |
| - branches: [ master, main ] |
6 |
| - tags-ignore: [ '**' ] |
7 |
| - paths-ignore: [ '**.md' ] |
| 8 | + branches: [master, main] |
| 9 | + tags-ignore: ['**'] |
| 10 | + paths-ignore: ['**.md'] |
8 | 11 | pull_request:
|
9 |
| - paths-ignore: [ '**.md' ] |
| 12 | + paths-ignore: ['**.md'] |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +env: {FORCE_COLOR: 'true'} |
10 | 19 |
|
11 | 20 | jobs:
|
12 | 21 | gitleaks:
|
13 |
| - name: Gitleaks |
14 |
| - runs-on: ubuntu-20.04 |
| 22 | + name: Check for GitLeaks |
| 23 | + runs-on: ubuntu-latest |
15 | 24 | steps:
|
16 |
| - - uses: actions/checkout@v4 |
17 |
| - with: { fetch-depth: 0 } |
18 |
| - |
19 |
| - - name: Check for GitLeaks |
20 |
| - uses: gacts/gitleaks@v1 # Action page: <https://github.com/gacts/gitleaks> |
| 25 | + - {uses: actions/checkout@v4, with: {fetch-depth: 0}} |
| 26 | + - uses: gacts/gitleaks@v1 |
21 | 27 |
|
22 | 28 | eslint:
|
23 |
| - name: Run eslint |
24 |
| - runs-on: ubuntu-20.04 |
25 |
| - env: { FORCE_COLOR: 'true' } |
| 29 | + name: Run code linter |
| 30 | + runs-on: ubuntu-latest |
26 | 31 | steps:
|
27 | 32 | - uses: actions/checkout@v4
|
28 |
| - |
29 |
| - - uses: actions/setup-node@v4 |
30 |
| - with: { node-version: '20' } |
31 |
| - |
32 |
| - - uses: actions/cache@v4 |
33 |
| - id: yarn-cache |
34 |
| - with: |
35 |
| - path: '**/node_modules' |
36 |
| - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
37 |
| - restore-keys: ${{ runner.os }}-yarn- |
38 |
| - |
39 |
| - - if: steps.yarn-cache.outputs.cache-hit != 'true' |
40 |
| - run: yarn install --frozen-lockfile --no-progress --non-interactive |
41 |
| - |
42 |
| - - run: yarn lint |
| 33 | + - {uses: gacts/setup-node-with-cache@v1, with: {node-version: 20}} |
| 34 | + - run: npm install |
| 35 | + - run: npm run lint |
43 | 36 |
|
44 | 37 | dist-built:
|
45 | 38 | name: Check distributive built state
|
46 |
| - runs-on: ubuntu-20.04 |
| 39 | + runs-on: ubuntu-latest |
47 | 40 | outputs:
|
48 | 41 | dist-changed: ${{ steps.state.outputs.changed }}
|
49 |
| - env: { FORCE_COLOR: 'true' } |
50 | 42 | steps:
|
51 | 43 | - uses: actions/checkout@v4
|
52 |
| - |
53 |
| - - uses: actions/setup-node@v4 |
54 |
| - with: { node-version: '20' } |
55 |
| - |
56 |
| - - uses: actions/cache@v4 |
57 |
| - id: yarn-cache |
58 |
| - with: |
59 |
| - path: '**/node_modules' |
60 |
| - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
61 |
| - restore-keys: ${{ runner.os }}-yarn- |
62 |
| - |
63 |
| - - if: steps.yarn-cache.outputs.cache-hit != 'true' |
64 |
| - run: yarn install --frozen-lockfile --no-progress --non-interactive |
65 |
| - |
66 |
| - - run: yarn build |
67 |
| - |
| 44 | + - {uses: gacts/setup-node-with-cache@v1, with: {node-version: 20}} |
| 45 | + - run: npm install |
| 46 | + - run: npm run build |
68 | 47 | - uses: actions/upload-artifact@v4
|
69 |
| - with: { name: dist, path: ./dist/, retention-days: 1 } |
70 |
| - |
| 48 | + with: {name: dist, path: ./dist/, retention-days: 1} |
71 | 49 | - id: state
|
72 | 50 | run: echo "changed=`git diff --diff-filter=ACMUXTR --name-only | grep dist/ > /dev/null && echo 'true' || echo 'false'`" >> $GITHUB_OUTPUT
|
73 | 51 |
|
74 | 52 | commit-and-push-fresh-dist:
|
75 | 53 | name: Commit and push fresh distributive
|
76 |
| - needs: [ dist-built ] |
| 54 | + needs: [dist-built] |
77 | 55 | if: ${{ needs.dist-built.outputs.dist-changed == 'true' }}
|
78 |
| - runs-on: ubuntu-20.04 |
| 56 | + runs-on: ubuntu-latest |
79 | 57 | permissions:
|
80 | 58 | contents: write
|
81 | 59 | pull-requests: write
|
82 | 60 | steps:
|
83 | 61 | - uses: actions/checkout@v4
|
84 |
| - |
85 | 62 | - uses: actions/download-artifact@v4
|
86 |
| - with: { name: dist, path: ./dist/ } |
87 |
| - |
| 63 | + with: {name: dist, path: ./dist/} |
88 | 64 | - uses: stefanzweifel/git-auto-commit-action@v5
|
89 |
| - with: |
90 |
| - commit_message: Automatic distributive rebuild |
| 65 | + with: {commit_message: Automatic distributive rebuild} |
91 | 66 |
|
92 | 67 | run-this-action:
|
93 | 68 | name: Run action
|
94 |
| - runs-on: ubuntu-20.04 |
| 69 | + runs-on: ubuntu-latest |
95 | 70 | steps:
|
96 | 71 | - uses: actions/checkout@v4
|
97 | 72 |
|
|
0 commit comments