-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Run test on multiple node versions
- Loading branch information
Showing
1 changed file
with
37 additions
and
3 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 |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
test: | ||
build-and-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -31,8 +31,8 @@ jobs: | |
- name: Build | ||
run: npm run build | ||
|
||
- name: Test | ||
run: npm run test | ||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Upload dist files | ||
uses: actions/upload-artifact@v3 | ||
|
@@ -42,6 +42,40 @@ jobs: | |
path: | | ||
lib/**/* | ||
test: | ||
needs: | ||
- build-and-lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: [20, 18, 16, 14] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Cache packages when the branch is not update-dependencies or dependabot/* | ||
- name: Resolve caching | ||
id: cache | ||
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }} | ||
run: echo "PACKAGE=npm" >> $GITHUB_OUTPUT | ||
|
||
- name: Use Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.version }} | ||
cache: ${{ steps.cache.outputs.PACKAGE }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Download dist files | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist-files | ||
|
||
- name: Test | ||
run: npm run test | ||
|
||
publish: | ||
# Run only for version tags | ||
if: contains(github.ref, 'refs/tags/v') | ||
|