- commit
- da9a38af72ae752313b274ba2c64a624a9f18692
- parent
- f53de5e47c6a2cadc2e3f951d89281f1ef61adef
- author
- Dami <dami.etoile@gmail.com>
| M | .github/ | 35 | +++++++++++++ |
| A | scripts/ | 79 | ++++++++++++++++++++++++++++++ |
| M | scripts/ | 18 | +++++++ |
@@ -82,9 +82,44 @@ jobs:
8282 libwebkit2gtk-4.1-dev \8383 libxdo-dev \8484 pkg-config \85+ python3-venv \8586 shellcheck8687 88+ - name: Restore pinned cargo-zigbuild89+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.490+ with:91+ path: ~/.cargo/bin/cargo-zigbuild92+ key: cargo-zigbuild-${{ runner.os }}-${{ runner.arch }}-0.23.093+94+ - name: Install pinned cross-build tools95+ run: |96+ python3 -m venv "$RUNNER_TEMP/zig-venv"97+ printf '%s\n' \98+ 'ziglang==0.16.0 --hash=sha256:9fcda73f62b851dd72a54b710ad40a209896db14cfb13649e62191243556342b' \99+ | "$RUNNER_TEMP/zig-venv/bin/pip" install \100+ --disable-pip-version-check \101+ --only-binary=:all: \102+ --require-hashes \103+ --requirement /dev/stdin104+ install -d "$RUNNER_TEMP/ci-bin"105+ # Expand runner paths when the generated wrapper executes.106+ # shellcheck disable=SC2016107+ printf '%s\n' \108+ '#!/usr/bin/env bash' \109+ 'exec "$RUNNER_TEMP/zig-venv/bin/python" -m ziglang "$@"' \110+ >"$RUNNER_TEMP/ci-bin/zig"111+ chmod 0755 "$RUNNER_TEMP/ci-bin/zig"112+ echo "$RUNNER_TEMP/ci-bin" >>"$GITHUB_PATH"113+ export PATH="$RUNNER_TEMP/ci-bin:$PATH"114+ if ! cargo-zigbuild --version 2>/dev/null \115+ | grep -Fxq 'cargo-zigbuild 0.23.0'; then116+ cargo install cargo-zigbuild --locked --version 0.23.0117+ fi118+ test "$(zig version)" = 0.16.0119+ test "$(cargo-zigbuild --version)" = 'cargo-zigbuild 0.23.0'120+87121 - name: Run complete demo gate88122 env:89123 GOQ_VERIFY_IN_PROCESS_GSTREAMER: "1"124+ GOQ_REQUIRE_LINUX_CROSS_BUILD: "1"90125 run: ./scripts/verify-demo-build.sh@@ -0,0 +1,79 @@
1+2+# shellcheck disable=SC20163+set -euo pipefail4+5+script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"6+repo_dir="$(cd -- "$script_dir/../.." && pwd -P)"7+workflow="$repo_dir/.github/workflows/ci.yml"8+gate="$repo_dir/scripts/verify-demo-build.sh"9+demo_job="$(sed -n '/^ demo-gate:/,$p' "$workflow")"10+11+[[ -n "$demo_job" ]] || {12+ echo 'CI cross-build policy failed: ordinary CI lacks the demo-gate job' >&213+ exit 114+}15+16+fail() {17+ printf 'CI cross-build policy failed: %s\n' "$*" >&218+ exit 119+}20+21+require_workflow_text() {22+ local expected="$1"23+ grep -Fq -- "$expected" <<<"$demo_job" \24+ || fail "ordinary CI is missing required text: $expected"25+}26+27+require_gate_text() {28+ local expected="$1"29+ grep -Fq -- "$expected" "$gate" \30+ || fail "repository gate is missing required text: $expected"31+}32+33+require_workflow_text 'python3-venv'34+require_workflow_text \35+ 'uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4'36+require_workflow_text 'path: ~/.cargo/bin/cargo-zigbuild'37+require_workflow_text \38+ 'key: cargo-zigbuild-${{ runner.os }}-${{ runner.arch }}-0.23.0'39+require_workflow_text \40+ 'ziglang==0.16.0 --hash=sha256:9fcda73f62b851dd72a54b710ad40a209896db14cfb13649e62191243556342b'41+require_workflow_text '--only-binary=:all:'42+require_workflow_text '--require-hashes'43+require_workflow_text \44+ 'exec "$RUNNER_TEMP/zig-venv/bin/python" -m ziglang "$@"'45+require_workflow_text 'cargo install cargo-zigbuild --locked --version 0.23.0'46+require_workflow_text 'test "$(zig version)" = 0.16.0'47+require_workflow_text \48+ "test \"\$(cargo-zigbuild --version)\" = 'cargo-zigbuild 0.23.0'"49+require_workflow_text 'GOQ_REQUIRE_LINUX_CROSS_BUILD: "1"'50+51+require_gate_text 'case "${GOQ_REQUIRE_LINUX_CROSS_BUILD:-0}" in'52+require_gate_text \53+ 'if [[ "${GOQ_REQUIRE_LINUX_CROSS_BUILD:-0}" == 1 ]]; then'54+require_gate_text \55+ 'for cross_command in cargo-zigbuild zig; do'56+require_gate_text \57+ 'required Linux cross-build command is missing: %s'58+require_gate_text \59+ 'cargo zigbuild --locked -p sigil-host --bins'60+require_gate_text \61+ '--target x86_64-unknown-linux-gnu.2.17'62+require_gate_text "echo 'linux_cross_build=ok'"63+64+install_step_line="$(65+ grep -nF ' - name: Install pinned cross-build tools' "$workflow" \66+ | cut -d: -f167+)"68+gate_step_line="$(69+ grep -nF ' - name: Run complete demo gate' "$workflow" \70+ | cut -d: -f171+)"72+[[ "$install_step_line" =~ ^[0-9]+$ ]] \73+ || fail 'cross-build install step must occur exactly once'74+[[ "$gate_step_line" =~ ^[0-9]+$ ]] \75+ || fail 'complete demo gate step must occur exactly once'76+((install_step_line < gate_step_line)) \77+ || fail 'cross-build tools must be installed before the complete demo gate'78+79+echo 'ci_cross_build_policy=ok'@@ -25,6 +25,24 @@ case "${GOQ_VERIFY_IN_PROCESS_GSTREAMER:-0}" in
2525 ;;2626 esac2727 28+case "${GOQ_REQUIRE_LINUX_CROSS_BUILD:-0}" in29+ 0|1) ;;30+ *)31+ printf 'GOQ_REQUIRE_LINUX_CROSS_BUILD must be 0 or 1\n' >&232+ exit 133+ ;;34+esac35+36+if [[ "${GOQ_REQUIRE_LINUX_CROSS_BUILD:-0}" == 1 ]]; then37+ for cross_command in cargo-zigbuild zig; do38+ if ! command -v "$cross_command" >/dev/null 2>&1; then39+ printf 'required Linux cross-build command is missing: %s\n' \40+ "$cross_command" >&241+ exit 142+ fi43+ done44+fi45+2846 require_rust_test() {2947 local test_name="$1"3048 shift