Skip to content

Commit

Permalink
feat(ci): add conclusion job
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Dec 15, 2023
1 parent b9ea91b commit 24b3aad
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 22 deletions.
50 changes: 39 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

# This is ci/actions-templates/windows-builds-template.yaml
# Do not edit this file in .github/workflows
build-windows-pr: # skip-master skip-stable
build-windows-pr: # job-name skip-master skip-stable
runs-on: windows-latest
if: ${{ github.event.pull_request }} # skip-master skip-stable
env:
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
# This is ci/actions-templates/windows-builds-template.yaml
# Do not edit this file in .github/workflows
build-windows-master: # skip-pr skip-stable
build-windows-master: # job-name skip-pr skip-stable
runs-on: windows-latest
if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable
env:
Expand Down Expand Up @@ -288,7 +288,7 @@ jobs:
# This is ci/actions-templates/windows-builds-template.yaml
# Do not edit this file in .github/workflows
build-windows-stable: # skip-master skip-pr
build-windows-stable: # job-name skip-master skip-pr
runs-on: windows-latest
if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master
env:
Expand Down Expand Up @@ -430,7 +430,7 @@ jobs:
# This is ci/actions-templates/linux-builds-template.yaml
# Do not edit this file in .github/workflows
build-linux-pr: # skip-master skip-stable
build-linux-pr: # job-name skip-master skip-stable
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }} # skip-master skip-stable
strategy:
Expand Down Expand Up @@ -574,7 +574,7 @@ jobs:
# This is ci/actions-templates/linux-builds-template.yaml
# Do not edit this file in .github/workflows
build-linux-master: # skip-pr skip-stable
build-linux-master: # job-name skip-pr skip-stable
runs-on: ubuntu-latest
if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable
strategy:
Expand Down Expand Up @@ -723,7 +723,7 @@ jobs:
# This is ci/actions-templates/linux-builds-template.yaml
# Do not edit this file in .github/workflows
build-linux-stable: # skip-master skip-pr
build-linux-stable: # job-name skip-master skip-pr
runs-on: ubuntu-latest
if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master
strategy:
Expand Down Expand Up @@ -898,7 +898,7 @@ jobs:
# This is ci/actions-templates/macos-builds-template.yaml
# Do not edit this file in .github/workflows
build-macos:
build-macos: # job-name
runs-on: macos-latest
strategy:
matrix:
Expand Down Expand Up @@ -1021,7 +1021,7 @@ jobs:

# This is ci/actions-templates/freebsd-builds-template.yaml
# Do not edit this file in .github/workflows
build-freebsd:
build-freebsd: # job-name
runs-on: ubuntu-latest
steps:
- name: Clone repo
Expand All @@ -1031,6 +1031,7 @@ jobs:
with:
release: 13.2
usesh: true
sync: sshfs
copyback: false
prepare: |
pkg install -y git gmake bash sudo
Expand All @@ -1045,7 +1046,7 @@ jobs:
# This is ci/actions-templates/centos-fmt-clippy.yaml
# Do not edit this file in .github/workflows
check:
check: # job-name
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -1131,7 +1132,7 @@ jobs:
# Unlike our main workflows, this doesn't self-test the rustup install scripts,
# nor run on the rust docker images. This permits a smaller workflow without the
# templating and so on.
build-all-features:
build-all-features: # job-name
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }}
strategy:
Expand Down Expand Up @@ -1170,7 +1171,7 @@ jobs:
#
# Builds docs for both stable and master branches.
# stable is placed in the root of the gh-pages branch, while master is placed at /devel
doc:
doc: # job-name
name: Documentation
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }}
Expand All @@ -1191,3 +1192,30 @@ jobs:
run: |
cd doc/dev-guide
mdbook build
# This is ci/actions-templates/conclusion-template.yaml
# Do not edit this file in .github/workflows
conclusion:
# https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472
if: always()
runs-on: ubuntu-latest
steps:
- name: Result
run: |
jq -C <<< "${needs}"
# Check if all needs were successful or skipped.
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
env:
needs: ${{ toJson(needs) }}
needs:
- build-windows-pr
- build-windows-master
- build-windows-stable
- build-linux-pr
- build-linux-master
- build-linux-stable
- build-macos
- build-freebsd
- check
- build-all-features
- doc
2 changes: 1 addition & 1 deletion ci/actions-templates/all-features-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs: # skip-all
# Unlike our main workflows, this doesn't self-test the rustup install scripts,
# nor run on the rust docker images. This permits a smaller workflow without the
# templating and so on.
build-all-features:
build-all-features: # job-name
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }}
strategy:
Expand Down
2 changes: 1 addition & 1 deletion ci/actions-templates/centos-fmt-clippy-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs: # skip-all

# This is ci/actions-templates/centos-fmt-clippy.yaml
# Do not edit this file in .github/workflows
check:
check: # job-name
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
17 changes: 17 additions & 0 deletions ci/actions-templates/conclusion-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
jobs: # skip-all

# This is ci/actions-templates/conclusion-template.yaml
# Do not edit this file in .github/workflows
conclusion:
# https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472
if: always()
runs-on: ubuntu-latest
steps:
- name: Result
run: |
jq -C <<< "${needs}"
# Check if all needs were successful or skipped.
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
env:
needs: ${{ toJson(needs) }}
needs:
2 changes: 1 addition & 1 deletion ci/actions-templates/freebsd-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs: # skip-all

# This is ci/actions-templates/freebsd-builds-template.yaml
# Do not edit this file in .github/workflows
build-freebsd:
build-freebsd: # job-name
runs-on: ubuntu-latest
steps:
- name: Clone repo
Expand Down
5 changes: 5 additions & 0 deletions ci/actions-templates/gen-workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ gen_job freebsd-builds all
gen_job centos-fmt-clippy all
gen_job all-features all
gen_job test-docs all

# Finally, we generate the conclusion,
# adding all the `# job-name` jobs to the `needs` list.
gen_job conclusion all
perl -nE 'say " - $1" if (m/^\s*([\w-_]+)\s*:.*job-name.*$/)' "$OUTPATH" >> "$OUTPATH"
6 changes: 3 additions & 3 deletions ci/actions-templates/linux-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ jobs: # skip-master skip-pr skip-stable

# This is ci/actions-templates/linux-builds-template.yaml
# Do not edit this file in .github/workflows
build-linux-pr: # skip-master skip-stable
build-linux-master: # skip-pr skip-stable
build-linux-stable: # skip-master skip-pr
build-linux-pr: # job-name skip-master skip-stable
build-linux-master: # job-name skip-pr skip-stable
build-linux-stable: # job-name skip-master skip-pr
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }} # skip-master skip-stable
if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable
Expand Down
2 changes: 1 addition & 1 deletion ci/actions-templates/macos-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs: # skip-all

# This is ci/actions-templates/macos-builds-template.yaml
# Do not edit this file in .github/workflows
build-macos:
build-macos: # job-name
runs-on: macos-latest
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion ci/actions-templates/test-docs-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs: # skip-all
#
# Builds docs for both stable and master branches.
# stable is placed in the root of the gh-pages branch, while master is placed at /devel
doc:
doc: # job-name
name: Documentation
runs-on: ubuntu-latest
if: ${{ github.event.pull_request }}
Expand Down
6 changes: 3 additions & 3 deletions ci/actions-templates/windows-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ jobs: # skip-master skip-pr skip-stable

# This is ci/actions-templates/windows-builds-template.yaml
# Do not edit this file in .github/workflows
build-windows-pr: # skip-master skip-stable
build-windows-master: # skip-pr skip-stable
build-windows-stable: # skip-master skip-pr
build-windows-pr: # job-name skip-master skip-stable
build-windows-master: # job-name skip-pr skip-stable
build-windows-stable: # job-name skip-master skip-pr
runs-on: windows-latest
if: ${{ github.event.pull_request }} # skip-master skip-stable
if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable
Expand Down

0 comments on commit 24b3aad

Please sign in to comment.