ci: Support job masking directives in commit message. [ci only it]

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-09-27 04:12:10 +00:00
parent af3cdf9263
commit fbcf4ba4f3
2 changed files with 27 additions and 3 deletions

View File

@@ -49,6 +49,7 @@ jobs:
release_url: ${{steps.release.outputs.upload_url}} release_url: ${{steps.release.outputs.upload_url}}
pages_url: 'https://matrix-construct.github.io/tuwunel/' pages_url: 'https://matrix-construct.github.io/tuwunel/'
rust_sdk_integration: ${{vars.RUST_SDK_INTEGRATION || 'true'}} rust_sdk_integration: ${{vars.RUST_SDK_INTEGRATION || 'true'}}
head_msg: ${{github.event.head_commit.message || github.event.workflow_run.head_commit.message}}
strategy: strategy:
fail-fast: true fail-fast: true
@@ -117,6 +118,8 @@ jobs:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(github.ref, 'refs/tags/v') && !contains(github.ref, 'refs/tags/v')
&& !contains(needs.init.outputs.head_msg, '[ci no lint]')
&& !contains(needs.init.outputs.head_msg, '[ci only it]')
name: Lint name: Lint
needs: [init] #needs: [init, deps] needs: [init] #needs: [init, deps]
@@ -165,11 +168,13 @@ jobs:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(github.ref, 'refs/tags/v') && !contains(github.ref, 'refs/tags/v')
&& !contains(needs.init.outputs.head_msg, '[ci no test]')
name: Test name: Test
needs: [init, lint] needs: [init, lint]
uses: ./.github/workflows/test.yml uses: ./.github/workflows/test.yml
with: with:
head_msg: ${{needs.init.outputs.head_msg}}
build_nix: ${{fromJSON(needs.init.outputs.build_nix)}} build_nix: ${{fromJSON(needs.init.outputs.build_nix)}}
rust_sdk_integration: ${{fromJSON(needs.init.outputs.rust_sdk_integration)}} rust_sdk_integration: ${{fromJSON(needs.init.outputs.rust_sdk_integration)}}
complement: ${{fromJSON(needs.init.outputs.complement)}} complement: ${{fromJSON(needs.init.outputs.complement)}}
@@ -218,6 +223,9 @@ jobs:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& needs.init.outputs.package && needs.init.outputs.package
&& !contains(needs.init.outputs.head_msg, '[ci only it]')
&& !contains(needs.init.outputs.head_msg, '[ci no build]')
&& !contains(needs.init.outputs.head_msg, '[ci no package]')
name: Package name: Package
needs: [init, test] needs: [init, test]
@@ -274,6 +282,10 @@ jobs:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& needs.init.outputs.publish && needs.init.outputs.publish
&& !contains(needs.init.outputs.head_msg, '[ci only it]')
&& !contains(needs.init.outputs.head_msg, '[ci no build]')
&& !contains(needs.init.outputs.head_msg, '[ci no package]')
&& !contains(needs.init.outputs.head_msg, '[ci no publish]')
name: Publish name: Publish
needs: [init, test, package] needs: [init, test, package]

View File

@@ -49,11 +49,14 @@ on:
build_nix: build_nix:
type: boolean type: boolean
default: true default: true
head_msg:
type: string
jobs: jobs:
docs: docs:
if: > if: >
contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0]) !contains(inputs.head_msg, '[ci only it]')
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0]) && contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
&& contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v1-linux-gnu"]')[0]) && contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v1-linux-gnu"]')[0])
@@ -75,7 +78,8 @@ jobs:
unit: unit:
if: > if: >
contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0]) !contains(inputs.head_msg, '[ci only it]')
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0]) && contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
&& contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v1-linux-gnu"]')[0]) && contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v1-linux-gnu"]')[0])
@@ -97,7 +101,8 @@ jobs:
bench: bench:
if: > if: >
contains(fromJSON(inputs.cargo_profiles), fromJSON('["bench"]')[0]) !contains(inputs.head_msg, '[ci only it]')
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["bench"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0]) && contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
&& contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v3-linux-gnu"]')[0]) && contains(fromJSON(inputs.sys_targets), fromJSON('["x86_64-v3-linux-gnu"]')[0])
@@ -120,6 +125,8 @@ jobs:
smoke: smoke:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(inputs.head_msg, '[ci only it]')
&& !contains(inputs.head_msg, '[ci no build]')
&& inputs.cargo_profiles && inputs.cargo_profiles
&& inputs.machines && inputs.machines
@@ -192,6 +199,8 @@ jobs:
nix: nix:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(inputs.head_msg, '[ci only it]')
&& !contains(inputs.head_msg, '[ci no build]')
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0]) && contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0])
&& contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0]) && contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0])
@@ -216,6 +225,7 @@ jobs:
rust-sdk-integration: rust-sdk-integration:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(inputs.head_msg, '[ci no build]')
&& inputs.rust_sdk_integration && inputs.rust_sdk_integration
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0]) && contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0])
@@ -248,6 +258,7 @@ jobs:
complement: complement:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(inputs.head_msg, '[ci no build]')
&& inputs.complement && inputs.complement
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0]) && contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0])
@@ -273,6 +284,7 @@ jobs:
compliance: compliance:
if: > if: >
!failure() && !cancelled() !failure() && !cancelled()
&& !contains(inputs.head_msg, '[ci no build]')
&& inputs.complement && inputs.complement
&& inputs.machines && inputs.machines
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0]) && contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])