Skip to content

Commit

Permalink
[CI] Try to split test and release flows
Browse files Browse the repository at this point in the history
  • Loading branch information
Pewtro committed Jul 20, 2024
1 parent 1701794 commit 9d96d79
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 25 deletions.
34 changes: 9 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
name: Release

on:
pull_request:
push:
workflow_run:
workflows: ['Test']
types: [completed]
branches:
- main
- next

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
# The node version to release with, generally the latest LTS
release_node: 20.x
- 'main'
- 'next'

jobs:
release:
strategy:
matrix:
# Test against multiple node versions
# Last LTS, current LTS, current, and next LTS (if not same as current)
node: [18.x, 20.x, 21.x, 22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
name: Release
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand All @@ -31,10 +20,10 @@ jobs:
with:
version: 9

- name: Setup Node.js ${{ matrix.node }}
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: 20.x
cache: 'pnpm'

- name: Install Dependencies
Expand All @@ -43,12 +32,7 @@ jobs:
- name: Build packages
run: pnpm build

- name: Lint, Prettier, and Typecheck
run: pnpm test:ci

# Only run the release step if the push is to the main or next branch
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == env.release_node && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') }}
name: Create Release Pull Request or Publish to npm
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test

on:
pull_request:
push:
branches:
- main
- next

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
test:
strategy:
matrix:
# Test against multiple node versions
# Last LTS, current LTS, current, and next LTS (if not same as current)
node: [18.x, 20.x, 21.x, 22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
name: Test
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 9

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install

- name: Build packages
run: pnpm build

- name: Lint, Prettier, and Typecheck
run: pnpm test:ci

0 comments on commit 9d96d79

Please sign in to comment.