Skip to content

Commit

Permalink
ci: run ci build related tests in parallel (#1907)
Browse files Browse the repository at this point in the history
Co-authored-by: Artem Zakharchenko <[email protected]>
  • Loading branch information
mattcosta7 and kettanaito authored Dec 5, 2024
1 parent bd5f47c commit c86ad58
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 12 deletions.
153 changes: 143 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,66 @@ on:
workflow_dispatch:

jobs:
# Builds the library and persists it as an artifact.
# Later jobs can then reuse that build artifact, skipping
# the build step.
build:
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: 18
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
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

Expand All @@ -37,21 +79,112 @@ jobs:
- name: Unit tests
run: pnpm test:unit

- name: Build
run: pnpm build
test-node:
name: test (node.js)
needs: build
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
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: Native tests
run: pnpm test:native

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: test/browser/test-results

test-native:
name: test (react-native)
needs: build
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: Native tests
run: pnpm test:native
4 changes: 2 additions & 2 deletions .github/workflows/compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
ts: ['4.8', '4.9', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down

0 comments on commit c86ad58

Please sign in to comment.