name: CI on: push: pull_request: workflow_dispatch: inputs: cold_cache: description: Deliberately clear the required dependency/native cache before validation required: false default: false type: boolean concurrency: group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: rust-skia: name: rust-skia (Rust only) runs-on: ubuntu-latest timeout-minutes: 15 env: CARGO_BUILD_JOBS: "1" CARGO_INCREMENTAL: "0" CARGO_PROFILE_DEV_DEBUG: "0" CARGO_PROFILE_TEST_DEBUG: "0" steps: - uses: actions/checkout@v4 # Deliberately do not install CMake, Clang, pkg-config, Skia, WebP, or # any other native codec prerequisite in this job. - name: Install pinned Rust uses: dtolnay/rust-toolchain@master with: toolchain: 1.97.1 targets: wasm32-unknown-unknown - name: Test the pure-Rust Skia-compatible extension run: cargo test --locked -j 1 -p libremetaverse-imaging-skia --no-default-features --features rust-skia - name: Audit the normal and build dependency graph run: cargo tree --locked -p libremetaverse-imaging-skia --no-default-features --features rust-skia -e normal,build - name: Compile the same Rust codec for WASM run: cargo check --locked -j 1 -p libremetaverse-imaging-skia --no-default-features --features rust-skia --target wasm32-unknown-unknown required: name: required runs-on: ubuntu-latest timeout-minutes: 15 env: # The all-features graph includes Skia, OpenJPEG, and the pure-Rust J2K # codec. Serialize rustc/clippy on the memory-constrained ARM64 runner so # the umbrella crate cannot overlap with another peak-memory compile. CARGO_BUILD_JOBS: "1" CARGO_INCREMENTAL: "0" CARGO_PROFILE_DEV_DEBUG: "0" CARGO_PROFILE_TEST_DEBUG: "0" RUSTDOCFLAGS: "-D warnings" CARGO_HOME: ${{ runner.tool_cache }}/metacrate/cargo/home-rust-1.97.1-aarch64-unknown-linux-gnu METACRATE_EXPECTED_HOST: aarch64-unknown-linux-gnu METACRATE_PROVENANCE_DIAGNOSTICS_DIR: artifacts/ci/provenance-candidates steps: - uses: actions/checkout@v4 - name: Inspect the runner-persistent, architecture-keyed cache run: | cargo_cache_root="${{ runner.tool_cache }}/metacrate/cargo" cache_key="$(git ls-files -z 'Cargo.lock' 'Cargo.toml' '**/Cargo.toml' 'ci/ci-coverage.json' 'ci/dependency-policy.json' 'deny.toml' 'tools/install_openjpeg_2_5_4.sh' 'tools/normalize_git_mtimes.py' | sort -z | xargs -0 sha256sum | sha256sum | cut -d ' ' -f 1)" cargo_target="$cargo_cache_root/target-rust-1.97.1-aarch64-unknown-linux-gnu-$cache_key" openjpeg_prefix="${{ runner.tool_cache }}/metacrate/native/openjpeg-2.5.4-${{ runner.arch }}" skia_dir="${{ runner.tool_cache }}/metacrate/native/skia-0.99.0-aarch64-unknown-linux-gnu" skia_archive="$skia_dir/skia-binaries-a25a0fdb7d90429aa2d1-aarch64-unknown-linux-gnu-jpegd-jpege-pdf-svg-textlayout-vulkan-webpd-webpe.tar.gz" if ! test -d "$cargo_target"; then previous_target="$(find "$cargo_cache_root" -mindepth 1 -maxdepth 1 -type d -name 'target-rust-1.97.1-aarch64-unknown-linux-gnu-*' -printf '%T@ %p\n' | sort -nr | head -n 1 | cut -d ' ' -f 2-)" if test -n "$previous_target"; then cp -al "$previous_target" "$cargo_target" fi fi if test "${{ github.event_name }}" = workflow_dispatch && test "${{ inputs.cold_cache }}" = true; then rm -rf -- "$CARGO_HOME/registry/cache" "$CARGO_HOME/registry/index" "$CARGO_HOME/git/db" "$openjpeg_prefix" "$skia_dir" rm -f -- "$CARGO_HOME/bin/cargo-deny" "$CARGO_HOME/bin/cargo-machete" fi mkdir -p "$CARGO_HOME" "$cargo_target" "$skia_dir" test -f "$cargo_target/.metacrate-ready" && cargo_hit=true || cargo_hit=false test -d "$CARGO_HOME/registry/cache" && dependency_hit=true || dependency_hit=false test -f "$openjpeg_prefix/metacrate-openjpeg.identity" && test -f "$skia_archive" && native_hit=true || native_hit=false test -x "$CARGO_HOME/bin/cargo-deny" && test -x "$CARGO_HOME/bin/cargo-machete" && tools_hit=true || tools_hit=false echo "CARGO_TARGET_DIR=$cargo_target" >> "$GITHUB_ENV" echo "OPENJPEG_PREFIX=$openjpeg_prefix" >> "$GITHUB_ENV" echo "PKG_CONFIG_PATH=$openjpeg_prefix/lib/pkgconfig" >> "$GITHUB_ENV" echo "LD_LIBRARY_PATH=$openjpeg_prefix/lib" >> "$GITHUB_ENV" echo "METACRATE_SKIA_ARCHIVE=$skia_archive" >> "$GITHUB_ENV" echo "METACRATE_CARGO_CACHE_HIT=$cargo_hit" >> "$GITHUB_ENV" echo "METACRATE_DEPENDENCY_CACHE_HIT=$dependency_hit" >> "$GITHUB_ENV" echo "METACRATE_NATIVE_CACHE_HIT=$native_hit" >> "$GITHUB_ENV" echo "METACRATE_TOOLS_CACHE_HIT=$tools_hit" >> "$GITHUB_ENV" - name: Normalize tracked mtimes for reusable Cargo fingerprints run: | python3 tools/normalize_git_mtimes.py --self-test python3 tools/normalize_git_mtimes.py --state "$CARGO_TARGET_DIR/.metacrate-mtimes.json" python3 tools/normalize_git_mtimes.py --state "$CARGO_TARGET_DIR/.metacrate-mtimes.json" --check - name: Install the single native prerequisite set run: | sudo apt-get update sudo apt-get install --yes build-essential clang cmake curl git ninja-build pkg-config python3 libfontconfig1-dev libfreetype6-dev libopus-dev libasound2-dev - name: Install pinned Rust and audit tools uses: dtolnay/rust-toolchain@master with: toolchain: 1.97.1 components: clippy,rustfmt - uses: taiki-e/install-action@v2 with: tool: cargo-deny@0.20.2,cargo-machete@0.9.2 - name: Verify pinned audit tool versions run: | cargo deny --version | grep '0.20.2' cargo machete --version | grep '0.9.2' - name: Validate and populate the exact native cache run: | test "$(uname -m)" = aarch64 rustc -vV | grep '^host: aarch64-unknown-linux-gnu$' tools/install_openjpeg_2_5_4.sh "$OPENJPEG_PREFIX" pkg-config --exact-version 2.5.4 libopenjp2 mkdir -p "$(dirname "$METACRATE_SKIA_ARCHIVE")" if ! echo 'dd127f458a5e67a79f3936a8aa19f822fe90a1d6a11b50b5f84df2b0519d909c '"$METACRATE_SKIA_ARCHIVE" | sha256sum --check --status; then curl --fail --location --proto '=https' --tlsv1.2 --output "$METACRATE_SKIA_ARCHIVE" \ https://github.com/rust-skia/skia-binaries/releases/download/0.99.0/skia-binaries-a25a0fdb7d90429aa2d1-aarch64-unknown-linux-gnu-jpegd-jpege-pdf-svg-textlayout-vulkan-webpd-webpe.tar.gz fi echo 'dd127f458a5e67a79f3936a8aa19f822fe90a1d6a11b50b5f84df2b0519d909c '"$METACRATE_SKIA_ARCHIVE" | sha256sum --check - name: Run the authoritative code-ready graph run: cargo run --locked -p metacrate-ci-matrix -- required-gate --evidence artifacts/ci/required-gate.json - name: Mark the validated cache generation ready run: touch "$CARGO_TARGET_DIR/.metacrate-ready" - name: Upload stage timing and audit evidence if: always() uses: actions/upload-artifact@v3 with: name: required-ci-evidence path: artifacts/ci/ if-no-files-found: error