Skip to content

Commit

Permalink
ci: separate build matrix from workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
castastrophe committed Feb 12, 2024
1 parent 3c6194e commit a1e9fa9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
node-version:
required: false
default: "18"
experimental:
required: false
default: false
ref:
description: "The branch or tag to checkout"
required: false
Expand All @@ -35,6 +38,10 @@ on:
required: false
type: string
default: "18"
experimental:
required: false
type: boolean
default: false
ref:
description: "The branch or tag to checkout"
required: false
Expand Down Expand Up @@ -62,7 +69,10 @@ jobs:
- ${{ inputs.system }}
node-version:
- ${{ inputs.node-version }}
experimental:
- ${{ inputs.experimental }}
runs-on: ${{ matrix.system }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 10
outputs:
head-sha: ${{ steps.set-SHAs.outputs.head }}
Expand Down Expand Up @@ -140,3 +150,18 @@ jobs:
git status
exit 1
fi
# If there are changes, capture the changes and upload them as an artifact
- name: Capture changes
if: ${{ failure() }}
id: capture-changes
run: |
git diff
git diff > changes.diff
- name: Upload changes
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
path: changes.diff
name: changes.diff
4 changes: 0 additions & 4 deletions .github/workflows/compare-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ on:
required: false
type: string
default: ${{ github.event.workflow_call.head.ref }}
artifact-id:
description: The artifact id to use for the build artifacts
required: false
type: string
outputs:
has-changed:
value: ${{ jobs.compare.outputs.has-changed }}
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,40 @@ jobs:
# -------------------------------------------------------------
# Validate build for various environments
# -------------------------------------------------------------
build:
name: Build
verify_builds:
name: Verify
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
# if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
strategy:
fail-fast: false
matrix:
system:
- macos-latest
- ubuntu-latest
# - windows-latest
node-version:
- 18
experimental:
- false
include:
- node-version: 20
experimental: true
- system: windows-latest
experimental: true
uses: ./.github/workflows/build.yml
with:
system: ${{ matrix.system }}
node-version: ${{ matrix.node-version }}
experimental: ${{ matrix.experimental }}
secrets: inherit

# -------------------------------------------------------------
# Compare the compiled assets
# -------------------------------------------------------------
compare:
name: Compare
needs: [build]
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
uses: ./.github/workflows/compare-results.yml
with:
base-sha: ${{ needs.build.outputs.base-sha }}
head-sha: ${{ needs.build.outputs.head-sha }}
secrets: inherit

# -------------------------------------------------------------
Expand Down Expand Up @@ -136,7 +139,6 @@ jobs:
# -------------------------------------------------------------
vrt:
name: Testing
needs: [build]
if: ${{ contains(github.event.pull_request.labels.*.name, 'run_vrt') || ((github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run_ci')) && github.event.pull_request.mergeable == true) }}
uses: ./.github/workflows/vrt.yml
with:
Expand All @@ -150,9 +152,9 @@ jobs:
publish_site:
name: Publish
# The build step ensures we are leveraging the cache for the build
needs: [build, vrt]
needs: [vrt]
# Note: the goal here is to allow vrt to be skipped but still require the build to succeed
if: ${{ always() && (needs.vrt.result == 'success' || needs.vrt.result == 'skipped') && needs.build.result == 'success' }}
if: ${{ always() && (needs.vrt.result == 'success' || needs.vrt.result == 'skipped') }}
uses: ./.github/workflows/publish-site.yml
with:
deploy-message: ${{ github.event.pull_request.title }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
system:
- macos-latest
- ubuntu-latest
# - windows-latest
node-version:
- 18
uses: ./.github/workflows/build.yml
Expand Down

0 comments on commit a1e9fa9

Please sign in to comment.