diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f528ff2d4..2e4a10ad8 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -290,17 +290,24 @@ jobs: echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV" echo "OCIO_RS_LINK=static" >> "$GITHUB_ENV" # cargo fetch only downloads the .crate archives; unpack ocio-sys - # so the vendored yaml-cpp can be patched before the build. + # so the vendored yaml-cpp can be patched before the build. The + # registry src dir may not exist yet on a fresh runner — create + # it from the cache dir's hash. The trailing ls asserts the + # patched file actually exists. cargo fetch --locked - for dir in "$HOME"/.cargo/registry/src/*/; do - if ls "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate >/dev/null 2>&1; then - tar xzf "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate -C "$dir" 2>/dev/null || true + for cache in "$HOME"/.cargo/registry/cache/*/; do + src="$HOME/.cargo/registry/src/$(basename "$cache")" + mkdir -p "$src" + if [ -f "$cache/ocio-sys-0.2.1.crate" ]; then + tar xzf "$cache/ocio-sys-0.2.1.crate" -C "$src" fi done for f in "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp; do + [ -e "$f" ] || continue grep -q '#include ' "$f" || \ sed -i '0,/#include/s||#include \n&|' "$f" done + ls "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp - name: Cache cargo artifacts uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 266e0ce4c..2a76502e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,17 +126,24 @@ jobs: echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV" echo "OCIO_RS_LINK=static" >> "$GITHUB_ENV" # cargo fetch only downloads the .crate archives; unpack ocio-sys - # so the vendored yaml-cpp can be patched before the build. + # so the vendored yaml-cpp can be patched before the build. The + # registry src dir may not exist yet on a fresh runner — create + # it from the cache dir's hash. The trailing ls asserts the + # patched file actually exists. cargo fetch --locked - for dir in "$HOME"/.cargo/registry/src/*/; do - if ls "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate >/dev/null 2>&1; then - tar xzf "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate -C "$dir" 2>/dev/null || true + for cache in "$HOME"/.cargo/registry/cache/*/; do + src="$HOME/.cargo/registry/src/$(basename "$cache")" + mkdir -p "$src" + if [ -f "$cache/ocio-sys-0.2.1.crate" ]; then + tar xzf "$cache/ocio-sys-0.2.1.crate" -C "$src" fi done for f in "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp; do + [ -e "$f" ] || continue grep -q '#include ' "$f" || \ sed -i '0,/#include/s||#include \n&|' "$f" done + ls "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp # ------------------------------------------------------------------ # Caches