Skip to content

Commit

Permalink
.github/workflows/test.yml: Require that index.js is up to date
Browse files Browse the repository at this point in the history
Since this action action uses `dist/index.js` as the backing code
instead of the files under `src/`, perform the check that
`dist/index.js` is valid before running any of the other tests.

This is meant to catch situations in which changes are committed
without the `index.js` file being updated. In that case the results of
the other tests are useless as they would have used the old code
instead of the newly committed one.

Signed-off-by: Andrei Horodniceanu <[email protected]>
  • Loading branch information
the-horo authored and WebFreak001 committed May 30, 2024
1 parent 56a46e8 commit e96e4bc
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,26 @@ defaults:
shell: bash

jobs:
verify-index-js-up-to-date:
name: Verify that `dist/index.js` is up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: diff-ing dist/index.js
env:
NODE_OPTIONS: "--openssl-legacy-provider"
run: |
set -euxo pipefail
npm ci
npm run build
# exclude dist/index.js.map (different on Windows)
git diff --stat --exit-code HEAD -- ':!dist/index.js.map'
verify-dmd:
needs: verify-index-js-up-to-date
strategy:
max-parallel: 5
fail-fast: false
Expand Down Expand Up @@ -43,6 +62,7 @@ jobs:
dc: ${{ matrix.dc }}

verify-ldc:
needs: verify-index-js-up-to-date
strategy:
max-parallel: 5
fail-fast: false
Expand Down Expand Up @@ -70,6 +90,7 @@ jobs:
dc: ${{ matrix.dc }}

verify-gdmd:
needs: verify-index-js-up-to-date
strategy:
max-parallel: 5
fail-fast: false
Expand All @@ -85,6 +106,7 @@ jobs:
dc: ${{ matrix.dc }}

verify-default:
needs: verify-index-js-up-to-date
name: Verify default compiler
strategy:
max-parallel: 5
Expand All @@ -98,6 +120,7 @@ jobs:

dub:
name: Verify standalone DUB install
needs: verify-index-js-up-to-date
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -145,21 +168,3 @@ jobs:
- name : Compile with dub
run: |
cd .github && dub run --single hello.d --compiler=${DC}
verify-index-js-up-to-date:
name: Verify that `dist/index.js` is up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: diff-ing dist/index.js
env:
NODE_OPTIONS: "--openssl-legacy-provider"
run: |
set -euxo pipefail
npm ci
npm run build
# exclude dist/index.js.map (different on Windows)
git diff --stat --exit-code HEAD -- ':!dist/index.js.map'

0 comments on commit e96e4bc

Please sign in to comment.