ci: Add matrix strategy

This commit is contained in:
Iván Ovejero 2023-08-01 13:52:29 +02:00
parent 78389a8642
commit 5297c9fa44

View file

@ -41,12 +41,15 @@ jobs:
/github/home/.pnpm-store /github/home/.pnpm-store
./node_modules ./node_modules
./packages ./packages
key: ${{ github.sha }}-base:18-test-lint key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
unit-test: unit-test:
name: Unit tests name: Unit tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: install-and-build needs: install-and-build
strategy:
matrix:
node-version: [18.x, 20.x]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -61,15 +64,15 @@ jobs:
/github/home/.pnpm-store /github/home/.pnpm-store
./node_modules ./node_modules
./packages ./packages
key: ${{ github.sha }}-base:18-test-lint key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
- uses: pnpm/action-setup@v2.2.4 - uses: pnpm/action-setup@v2.2.4
- name: Use Node.js 18 - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: ${{ matrix.node-version }}
cache: pnpm cache: 'pnpm'
- name: Test - name: Test
run: pnpm test run: pnpm test
@ -97,15 +100,15 @@ jobs:
/github/home/.pnpm-store /github/home/.pnpm-store
./node_modules ./node_modules
./packages ./packages
key: ${{ github.sha }}-base:18-test-lint key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
- uses: pnpm/action-setup@v2.2.4 - uses: pnpm/action-setup@v2.2.4
- name: Use Node.js 18 - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: ${{ matrix.node-version }}
cache: pnpm cache: 'pnpm'
- name: Lint - name: Lint
env: env:
@ -116,6 +119,9 @@ jobs:
name: Notify Slack on failure name: Notify Slack on failure
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [unit-test, lint] needs: [unit-test, lint]
strategy:
matrix:
node-version: [18.x, 20.x]
steps: steps:
- name: Notify Slack on failure - name: Notify Slack on failure
uses: act10ns/slack@v2.0.0 uses: act10ns/slack@v2.0.0