fix: watch close #462
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
name: test | |
on: | |
push: | |
branches: | |
- "develop" | |
- "trunk" | |
pull_request: | |
concurrency: | |
group: branch-node-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
# Test node 16/18/20 on Ubuntu | |
# Test node 18 on macOS/Windows | |
# Enable linting only for node 20 & Ubuntu | |
matrix: | |
os: [ubuntu-latest] | |
node: [16, 18, 20] | |
include: | |
- os: macos-latest | |
node: 18 | |
- os: windows-latest | |
node: 18 | |
- node: 20 | |
is_base_node_version: true | |
- os: ubuntu-latest | |
is_base_os_version: true | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 30 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: env | |
run: | | |
echo 'DIST_RESTORE_KEYS<<EOF' >> $GITHUB_ENV | |
echo "$(git --no-pager log -9 --skip 1 --no-merges --pretty=format:'%H--test-dist-${{ matrix.node }}-${{ matrix.os }}')" >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
echo "COMMIT_SHA=$(git --no-pager log -1 --no-merges --pretty=format:'%H')" >> $GITHUB_ENV | |
- name: previous build artifacts cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cached-commit | |
projects/*/dist/** | |
key: ${{ env.COMMIT_SHA }}--test-dist-${{ matrix.node }}-${{ matrix.os }} | |
restore-keys: ${{ env.DIST_RESTORE_KEYS }} | |
- name: npm ci | |
run: | | |
npm ci | |
- name: lint | |
run: npm run lint | |
if: matrix.is_base_node_version && matrix.is_base_os_version | |
- name: build | |
run: npm run build | |
- name: test | |
run: npm run test | |
# record the current commit for the cache at the end of the job | |
# must be the last step | |
- name: record current commit | |
run: | | |
echo "$(git --no-pager log -1 --no-merges --pretty=format:'%H')" > .cached-commit |