Skip to content

Commit

Permalink
Run CI as host step, not as plan step
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Jan 29, 2025
1 parent 27a6e74 commit a9441e1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: CI

on:
# pull_request is not needed because cargo-dist's plan steps will run on pull_request and that calls ci.yml
pull_request:
workflow_call:
inputs:
# comes from cargo-dist workflow call
plan:
required: true
type: string
workflow_dispatch:
push:
branches:
Expand Down
33 changes: 21 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,12 @@ jobs:
name: artifacts-plan-dist-manifest
path: plan-dist-manifest.json

custom-ci:
uses: ./.github/workflows/ci.yml
secrets: inherit
permissions:
"actions": "read"
"checks": "write"
"contents": "read"
"issues": "read"
"packages": "read"
"pull-requests": "write"

# Build and packages all the platform-specific things
build-local-artifacts:
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
# Let the initial task tell us to not run (currently very blunt)
needs:
- plan
- custom-ci
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -313,10 +301,28 @@ jobs:
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
custom-ci:
needs:
- plan
- build-local-artifacts
- build-global-artifacts
uses: ./.github/workflows/ci.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
permissions:
"actions": "read"
"checks": "write"
"contents": "read"
"issues": "read"
"packages": "read"
"pull-requests": "write"

publish-homebrew-formula:
needs:
- plan
- host
- custom-ci
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -362,6 +368,7 @@ jobs:
needs:
- plan
- host
- custom-ci
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
uses: ./.github/workflows/docker-release.yml
with:
Expand All @@ -376,6 +383,7 @@ jobs:
needs:
- plan
- host
- custom-ci
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
uses: ./.github/workflows/npm.yml
with:
Expand All @@ -393,6 +401,7 @@ jobs:
- publish-homebrew-formula
- custom-docker-release
- custom-npm
- custom-ci
# use "always() && ..." to allow us to wait for all publish jobs while
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
Expand Down
2 changes: 1 addition & 1 deletion dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include = ["NOTICE"]
precise-builds = true
cache-builds = false

plan-jobs = ["./ci"]
host-jobs = ["./ci"]
publish-jobs = ["./docker-release", "homebrew", "./npm"]
post-announce-jobs = ["./helm"]

Expand Down

0 comments on commit a9441e1

Please sign in to comment.