Skip to content

Commit

Permalink
test(structure): consolidated all verification under the test script
Browse files Browse the repository at this point in the history
while also enabling isolated execution. similar to semantic-release/semantic-release#2964

for semantic-release/.github#19
  • Loading branch information
travi committed Oct 20, 2023
1 parent 0d80c75 commit 16f9e79
Show file tree
Hide file tree
Showing 4 changed files with 8,849 additions and 1,990 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ name: Test
- opened
- synchronize
jobs:
# verify against ranges defined as supported in engines.node
test_matrix:
strategy:
matrix:
Expand All @@ -27,21 +28,39 @@ jobs:
node-version: "${{ matrix.node-version }}"
cache: npm
- run: npm clean-install
- run: npm audit signatures
- run: npm test
test:

# verify against the node version defined for development in the .nvmrc
test_dev:
runs-on: ubuntu-latest
needs: test_matrix
timeout-minutes: 5

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- run: git config --global user.name github-actions
- run: git config --global user.email github-actions@github.com
- name: Use Node.js from .nvmrc
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: "lts/*"
node-version-file: .nvmrc
cache: npm
- run: npm clean-install
- run: npm audit signatures
- name: Ensure dependencies are compatible with the version of node
run: npx ls-engines
- run: npm run lint
# https://github.com/lirantal/lockfile-lint#readme
- name: Scan lockfile for security issues
run: npx lockfile-lint --path package-lock.json
- run: npm test

# separate job to set as required in branch protection,
# as the build names above change each time Node versions change
test:
runs-on: ubuntu-latest
needs:
- test_dev
- test_matrix
if: always()
steps:
- name: All matrix versions passed
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some matrix version failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
Loading

0 comments on commit 16f9e79

Please sign in to comment.