-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct token docs, make test procedure reusable
Benefits with reusing this test flow: 1. One source of truth for test procedures. 2. One place to update whenever Node updates. 3. Fewer decisions to make on tests. https://www.scientificamerican.com/article/tough-choices-how-making/ 4. In the future, it'll become easier to add new test platforms like Cloudflare Workers org-wide, as I'd only be doing it once.
- Loading branch information
1 parent
b43ce67
commit 132869e
Showing
6 changed files
with
188 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Run tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
all-platforms: | ||
type: boolean | ||
all-versions: | ||
type: boolean | ||
test-node: | ||
type: boolean | ||
default: true | ||
test-deno: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
lint-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- run: npm ci | ||
- run: npm run lint | ||
- run: npm run build | ||
|
||
test-node: | ||
if: ${{ inputs.test-node }} | ||
needs: lint-build | ||
strategy: | ||
matrix: | ||
# See release schedule at https://nodejs.org/en/about/releases/ | ||
# Only LTS releases will be tested on. | ||
version: ${{ fromJson(inputs.all-versions && '[18,20,22,"current"]' || '[20]') }} | ||
image: ${{ fromJson((inputs.all-platforms) && '["ubuntu-latest","windows-latest","macos-latest"]' || '["ubuntu-latest"]') }} | ||
runs-on: ${{ matrix.image }} | ||
continue-on-error: ${{ matrix.version == 'current' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.version }} | ||
- run: npm ci-test | ||
|
||
test-deno: | ||
needs: lint-build | ||
if: ${{ inputs.test-deno }} | ||
strategy: | ||
matrix: | ||
# See release schedule at https://docs.deno.com/runtime/fundamentals/stability_and_releases/ | ||
# Only LTS releases will be tested on. | ||
version: ${{ fromJson(inputs.all-versions && '["v1.x.x","vx.x.x"]' || '["v1.x.x"]') }} | ||
image: ${{ fromJson(inputs.all-platforms && '["ubuntu-latest","windows-latest","macos-latest"]' || '["ubuntu-latest"]') }} | ||
runs-on: ${{ matrix.image }} | ||
continue-on-error: ${{ matrix.version == 'vx.x.x' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ matrix.version }} | ||
- run: deno task test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
types: [opened, synchronize] | ||
branches: [main] | ||
push: | ||
branches: | ||
- main | ||
|
||
branches: [main] | ||
permissions: | ||
actions: write | ||
contents: read | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- run: npm ci | ||
- run: npx eslint . | ||
- run: npm test | ||
uses: ./.github/workflows/run-tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters