fix: use multiple node versions and corepack #111
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: Check Code | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
jobs: | |
check_code: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [ 16, 18, 20 ] | |
steps: | |
- name: Cancel if [skip ci] | |
if: contains(github.event.head_commit.message, '[skip ci]') | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
- uses: actions/checkout@v3 | |
name: Checkout | |
with: | |
fetch-depth: 2 | |
- name: Cache turbo build setup | |
uses: actions/cache@v4 | |
with: | |
path: .turbo | |
key: ${{ runner.os }}-turbo-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo- | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
- name: Corepack prepare | |
run: corepack prepare | |
- name: Version checks | |
run: | | |
npm --version | |
node -v | |
- name: Install dependencies | |
run: npm ci | |
- run: npm run all | |