Skip to content

Commit

Permalink
test reusable jobs setup
Browse files Browse the repository at this point in the history
  • Loading branch information
arobsn committed Oct 25, 2024
1 parent ea48f05 commit c1312a0
Showing 1 changed file with 136 additions and 129 deletions.
265 changes: 136 additions & 129 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,128 +13,10 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run test:lint

format:
name: Format
checkout-and-setup:
name: Checkout and setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run test:format

build-and-test-node:
name: "[node] build and test"
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
steps:
- uses: actions/checkout@v4

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

- name: Build and test using Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm -r build
- run: pnpm run test:unit

build-and-test-bun:
name: "[bun] build and test"
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
bun-version: ["latest"]
steps:
- uses: actions/checkout@v4

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

- name: Build and test using bun ${{ matrix.bun-version }}
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ matrix.bun-version }}

- run: bun run pnpm install --frozen-lockfile
- run: bun run pnpm -r build
- run: bun run test:unit

build-and-test-other-envs:
name: "[happy-dom, edge-runtime] test"
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4

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

- name: Build using Node.js v20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm -r build

- name: Test using happy-dom
run: pnpm run test:unit-browser

- name: Test using edge-runtime
run: pnpm run test:unit-edge

publish-preview:
name: "Publish preview"
runs-on: ubuntu-latest
needs: build-and-test-node
if: success()
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -143,18 +25,143 @@ jobs:
uses: pnpm/action-setup@v4
with:
version: 9
lint:
name: Lint
needs: checkout-and-setup
runs-on: ubuntu-latest

- name: Enable corepack
uses: actions/setup-node@v4
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm -r build
- run: pnpm install --frozen-lockfile
- run: pnpm run test:lint

- name: Publish
run: pnpx pkg-pr-new publish './packages/*' './plugins/*' --no-template --pnpm --compact
# format:
# name: Format
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4

# - uses: pnpm/action-setup@v4
# with:
# version: 9

# - uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: "pnpm"

# - run: pnpm install --frozen-lockfile
# - run: pnpm run test:format

# build-and-test-node:
# name: "[node] build and test"
# runs-on: ubuntu-latest
# timeout-minutes: 20
# strategy:
# fail-fast: false
# matrix:
# node-version: [18, 20]
# steps:
# - uses: actions/checkout@v4

# - uses: pnpm/action-setup@v4
# with:
# version: 9

# - name: Build and test using Node.js v${{ matrix.node-version }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# cache: "pnpm"

# - run: pnpm install --frozen-lockfile
# - run: pnpm -r build
# - run: pnpm run test:unit

# build-and-test-bun:
# name: "[bun] build and test"
# runs-on: ubuntu-latest
# timeout-minutes: 20
# strategy:
# fail-fast: false
# matrix:
# bun-version: ["latest"]
# steps:
# - uses: actions/checkout@v4

# - uses: pnpm/action-setup@v4
# with:
# version: 9

# - name: Build and test using bun ${{ matrix.bun-version }}
# uses: oven-sh/setup-bun@v1
# with:
# bun-version: ${{ matrix.bun-version }}

# - run: bun run pnpm install --frozen-lockfile
# - run: bun run pnpm -r build
# - run: bun run test:unit

# build-and-test-other-envs:
# name: "[happy-dom, edge-runtime] test"
# runs-on: ubuntu-latest
# timeout-minutes: 20
# strategy:
# fail-fast: false
# steps:
# - uses: actions/checkout@v4

# - uses: pnpm/action-setup@v4
# with:
# version: 9

# - name: Build using Node.js v20
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: "pnpm"

# - run: pnpm install --frozen-lockfile
# - run: pnpm -r build

# - name: Test using happy-dom
# run: pnpm run test:unit-browser

# - name: Test using edge-runtime
# run: pnpm run test:unit-edge

# publish-preview:
# name: "Publish preview"
# runs-on: ubuntu-latest
# needs: build-and-test-node
# if: success()
# timeout-minutes: 20
# strategy:
# fail-fast: false
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Setup pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 9

# - name: Enable corepack
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: "pnpm"

# - name: Install dependencies
# run: pnpm install --frozen-lockfile

# - name: Build
# run: pnpm -r build

# - name: Publish
# run: pnpx pkg-pr-new publish './packages/*' './plugins/*' --no-template --pnpm --compact

0 comments on commit c1312a0

Please sign in to comment.