ci: Workaround multi-line if-condition github bug; cleanup.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-06-01 20:19:18 +00:00
parent 841253692d
commit 873cac5731
7 changed files with 115 additions and 93 deletions

View File

@@ -65,11 +65,9 @@ on:
jobs:
bake:
if: >
${{
!failure() && !cancelled()
&& fromJSON(inputs.machines)[0] != null
&& fromJSON(inputs.bake_targets)[0] != null
}}
!failure() && !cancelled()
&& fromJSON(inputs.machines)[0] != null
&& fromJSON(inputs.bake_targets)[0] != null
name: >
${{matrix.bake_target}}
@@ -124,7 +122,11 @@ jobs:
# Optionally extract an inner artifact
- name: Extract Artifact
if: ${{ !failure() && !cancelled() && fromJSON(inputs.artifact)[matrix.bake_target].dst && fromJSON(inputs.artifact)[matrix.bake_target].img == null }}
if: >
!failure() && !cancelled()
&& fromJSON(inputs.artifact)[matrix.bake_target].dst
&& fromJSON(inputs.artifact)[matrix.bake_target].img == null
env:
iid: ${{matrix.bake_target}}--${{matrix.cargo_profile}}--${{matrix.rust_toolchain}}--${{matrix.rust_target}}--${{matrix.feat_set}}--${{matrix.sys_name}}--${{matrix.sys_version}}--${{matrix.sys_target}}
dst: ${{ fromJSON(inputs.artifact)[matrix.bake_target].dst }}
@@ -138,7 +140,11 @@ jobs:
# Optionally extract the image itself as an artifact.
- name: Extract Image
if: ${{ !failure() && !cancelled() && fromJSON(inputs.artifact)[matrix.bake_target].dst && fromJSON(inputs.artifact)[matrix.bake_target].img != null }}
if: >
!failure() && !cancelled()
&& fromJSON(inputs.artifact)[matrix.bake_target].dst
&& fromJSON(inputs.artifact)[matrix.bake_target].img != null
env:
iid: ${{matrix.bake_target}}--${{matrix.cargo_profile}}--${{matrix.rust_toolchain}}--${{matrix.rust_target}}--${{matrix.feat_set}}--${{matrix.sys_name}}--${{matrix.sys_version}}--${{matrix.sys_target}}
dst: ${{ fromJSON(inputs.artifact)[matrix.bake_target].dst }}
@@ -150,7 +156,10 @@ jobs:
# Upload either artifact
- name: Upload Artifact
if: ${{ !failure() && !cancelled() && fromJSON(inputs.artifact)[matrix.bake_target].dst }}
if: >
!failure() && !cancelled()
&& fromJSON(inputs.artifact)[matrix.bake_target].dst
uses: actions/upload-artifact@v4
with:
path: _artifact/${{ fromJSON(inputs.artifact)[matrix.bake_target].dst }}

View File

@@ -54,7 +54,10 @@ on:
jobs:
systems:
if: ${{ !failure() && !cancelled() && inputs.show_systems }}
if: >
!failure() && !cancelled()
&& inputs.show_systems
name: System
uses: ./.github/workflows/bake.yml
with:
@@ -71,7 +74,10 @@ jobs:
includes: ${{inputs.includes}}
buildsys:
if: ${{ !failure() && !cancelled() && inputs.show_systems }}
if: >
!failure() && !cancelled()
&& inputs.show_systems
name: Builder
needs: [systems]
uses: ./.github/workflows/bake.yml
@@ -89,7 +95,10 @@ jobs:
includes: ${{inputs.includes}}
sources:
if: ${{ !failure() && !cancelled() && inputs.show_sources }}
if: >
!failure() && !cancelled()
&& inputs.show_sources
name: Acquire
needs: [buildsys]
uses: ./.github/workflows/bake.yml
@@ -107,7 +116,10 @@ jobs:
includes: ${{inputs.includes}}
rocksdb:
if: ${{ !failure() && !cancelled() && inputs.show_rocksdb }}
if: >
!failure() && !cancelled()
&& inputs.show_rocksdb
name: RocksDB
needs: [sources]
uses: ./.github/workflows/bake.yml
@@ -125,7 +137,10 @@ jobs:
includes: ${{inputs.includes}}
deps:
if: ${{ !failure() && !cancelled() && inputs.show_cargo }}
if: >
!failure() && !cancelled()
&& inputs.show_cargo
name: Build
needs: [rocksdb]
uses: ./.github/workflows/bake.yml

View File

@@ -39,12 +39,11 @@ on:
jobs:
fmt:
if: >
${{
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Format
uses: ./.github/workflows/bake.yml
with:
@@ -62,12 +61,11 @@ jobs:
typos:
if: >
${{
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Typos
uses: ./.github/workflows/bake.yml
with:
@@ -85,12 +83,11 @@ jobs:
audit:
if: >
${{
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Audit
uses: ./.github/workflows/bake.yml
with:
@@ -108,12 +105,11 @@ jobs:
lychee:
if: >
${{
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
!failure() && !cancelled()
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Lychee
uses: ./.github/workflows/bake.yml
with:
@@ -131,10 +127,9 @@ jobs:
clippy:
if: >
${{
!failure() && !cancelled()
&& inputs.cargo.profiles
}}
!failure() && !cancelled()
&& inputs.cargo_profiles
name: Clippy
uses: ./.github/workflows/bake.yml
with:

View File

@@ -17,16 +17,6 @@ jobs:
init:
name: Init
runs-on: self-hosted
outputs:
cargo_profiles: ${{vars.CARGO_PROFILES || env.default_cargo_profiles}}
feat_sets: ${{vars.FEAT_SETS || env.default_feat_sets}}
rust_toolchains: ${{vars.RUST_TOOLCHAINS || env.default_rust_toolchains}}
rust_targets: ${{vars.RUST_TARGETS || env.default_rust_targets}}
sys_names: ${{vars.SYS_NAMES || env.default_sys_names}}
sys_targets: ${{vars.SYS_TARGETS || env.default_sys_targets}}
sys_versions: ${{vars.SYS_VERSIONS || env.default_sys_versions}}
machines: ${{vars.MACHINES || env.default_machines}}
excludes: ${{vars.EXCLUDES || env.default_excludes}}
env:
default_cargo_profiles: '["test", "release"]'
default_feat_sets: '["none", "default", "all"]'
@@ -42,6 +32,18 @@ jobs:
{"cargo_profile": "release-max-perf", "rust_toolchain": "stable"},
{"cargo_profile": "release-max-perf", "feat_set": "none"}
]
outputs:
cargo_profiles: ${{vars.CARGO_PROFILES || env.default_cargo_profiles}}
feat_sets: ${{vars.FEAT_SETS || env.default_feat_sets}}
rust_toolchains: ${{vars.RUST_TOOLCHAINS || env.default_rust_toolchains}}
rust_targets: ${{vars.RUST_TARGETS || env.default_rust_targets}}
sys_names: ${{vars.SYS_NAMES || env.default_sys_names}}
sys_targets: ${{vars.SYS_TARGETS || env.default_sys_targets}}
sys_versions: ${{vars.SYS_VERSIONS || env.default_sys_versions}}
machines: ${{vars.MACHINES || env.default_machines}}
excludes: ${{vars.EXCLUDES || env.default_excludes}}
steps:
- name: Initialize Builder
run: |
@@ -92,7 +94,9 @@ jobs:
# ]
lint:
if: ${{ !failure() && !cancelled() }}
if: >
!failure() && !cancelled()
name: Lint
needs: [init] #needs: [init, deps]
uses: ./.github/workflows/lint.yml
@@ -108,7 +112,9 @@ jobs:
excludes: ${{needs.init.outputs.excludes}}
test:
if: ${{ !failure() && !cancelled() }}
if: >
!failure() && !cancelled()
name: Test
needs: [init, lint]
uses: ./.github/workflows/test.yml
@@ -125,7 +131,9 @@ jobs:
complement: ${{fromJSON(vars.COMPLEMENT || 'true')}}
package:
if: ${{ !failure() && !cancelled() }}
if: >
!failure() && !cancelled()
name: Package
needs: [init, lint]
uses: ./.github/workflows/package.yml
@@ -148,7 +156,9 @@ jobs:
]
publish:
if: ${{ !failure() && !cancelled() }}
if: >
!failure() && !cancelled()
name: Publish
needs: [init, test, package]
uses: ./.github/workflows/publish.yml

View File

@@ -39,9 +39,8 @@ on:
jobs:
build_standalone:
if: >
${{
!failure() && !cancelled()
}}
!failure() && !cancelled()
name: Standalone
uses: ./.github/workflows/bake.yml
with:
@@ -64,12 +63,11 @@ jobs:
build_pkgs:
if: >
${{
!failure() && !cancelled()
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0])
}}
!failure() && !cancelled()
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0])
name: Build Pkgs
uses: ./.github/workflows/bake.yml
with:
@@ -92,12 +90,11 @@ jobs:
check_pkgs:
if: >
${{
!failure() && !cancelled()
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0])
}}
!failure() && !cancelled()
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0])
name: Check Pkgs
needs: [build_pkgs]
uses: ./.github/workflows/bake.yml

View File

@@ -45,12 +45,11 @@ on:
jobs:
containers:
if: >
${{
!failure() && !cancelled()
&& inputs.machines
&& inputs.docker_repo != ''
&& github.ref == 'refs/heads/main'
}}
!failure() && !cancelled()
&& inputs.machines
&& inputs.docker_repo != ''
&& github.ref == 'refs/heads/main'
name: Publish containers
runs-on: ${{matrix.machine}}
permissions: write-all

View File

@@ -45,11 +45,10 @@ on:
jobs:
unit:
if: >
${{
contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Unit
uses: ./.github/workflows/bake.yml
with:
@@ -91,12 +90,11 @@ jobs:
complement:
if: >
${{
inputs.complement
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
inputs.complement
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.complement_feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Complement
uses: ./.github/workflows/bake.yml
with:
@@ -114,12 +112,11 @@ jobs:
compliance:
if: >
${{
inputs.complement
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
}}
inputs.complement
&& contains(fromJSON(inputs.cargo_profiles), fromJSON('["test"]')[0])
&& contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0])
&& contains(fromJSON(inputs.rust_toolchains), fromJSON('["nightly"]')[0])
name: Matrix Compliance
needs: [complement]
runs-on: ${{matrix.machine}}