Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix test workflow isolation #79

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
41 changes: 41 additions & 0 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test workflow

on:
workflow_call:
inputs:
node-version:
required: true
type: number

jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.packages.outputs.packages }}
steps:
- uses: actions/checkout@v4
- name: Define packages
id: packages
run: |
echo "packages=$(ls -d packages/* | xargs -n 1 basename | jq -R . | jq -s -c .)" >> "$GITHUB_OUTPUT"

test:
name: '${{ matrix.package }} - Node.js v${{ inputs.node-version }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.define-matrix.outputs.packages) }}
steps:
- uses: actions/setup-node@v4
with:
node-version: '${{ inputs.node-version }}'
- uses: actions/checkout@v4
- name: Install dependencies
run: |
cd packages/${{ matrix.package }}
npm install
- name: Run tests
run: |
cd packages/${{ matrix.package }}
npm run test
41 changes: 14 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,17 @@ on:
- reopened

jobs:
test:
name: 'Node.js v${{ matrix.node }}'
runs-on: ubuntu-latest
strategy:
matrix:
node:
- 18
- 20
- 22
steps:
- uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node }}'
- uses: actions/checkout@v2
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-v${{ matrix.node }}-
- name: Install Dependencies
run: npm install
- name: Install Playwright
run: npx playwright install
- name: Run All Node.js Tests
run: npm run test
test-node-v14:
uses: ./.github/workflows/test-workflow.yml
with:
node-version: 18

test-node-v16:
uses: ./.github/workflows/test-workflow.yml
with:
node-version: 20

test-node-v18:
uses: ./.github/workflows/test-workflow.yml
with:
node-version: 22
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"packages": ["packages/*"],
"version": "1.0.0"
}
}
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion package.json
matiassimon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"lerna": "^5.0.0",
"rimraf": "^3.0.2"
}
}
}
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved