chore: use matrix-based job name in "needs" #2036
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: ci | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
name: build-${{ matrix.node-version }} | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [18, 20] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.14.0 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Build | ||
run: pnpm build | ||
- name: Cache build output | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./lib | ||
key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ matrix.node-version }} | ||
test_unit: | ||
name: test (unit) | ||
needs: build-18 | ||
Check failure on line 47 in .github/workflows/ci.yml GitHub Actions / ciInvalid workflow file
|
||
if: ${{ needs.build.outputs.nodeVersion == '18' }} | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.14.0 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: 'pnpm' | ||
- name: Restore build cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./lib | ||
key: ${{ runner.os }}-node-18-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-node-18-build- | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Install Playwright browsers | ||
run: pnpm exec playwright install | ||
- name: Lint | ||
run: pnpm lint | ||
- name: Unit tests | ||
run: pnpm test:unit | ||
test-node: | ||
name: test (node.js) | ||
needs: [build-18, build-20] | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [18, 20] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.14.0 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
- name: Restore build cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./lib | ||
key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-node-18-build- | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Node.js tests | ||
run: pnpm test:node | ||
test-browser: | ||
name: test (browser) | ||
needs: build-18 | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.14.0 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: 'pnpm' | ||
- name: Restore build cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./lib | ||
key: ${{ runner.os }}-node-18-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-node-18-build- | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Playwright install | ||
run: pnpm exec playwright install --with-deps chromium | ||
- name: Browser tests | ||
run: pnpm test:browser | ||
- name: Upload test artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: playwright-report | ||
path: test/browser/test-results | ||
test-native: | ||
name: test (react-native) | ||
needs: build-18 | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.14.0 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: 'pnpm' | ||
- name: Restore build cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./lib | ||
key: ${{ runner.os }}-node-18-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-node-18-build- | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: React Native tests | ||
run: pnpm test:native |