From 6fe7a8bc43c21e03b4153b38b95ef342ead75549 Mon Sep 17 00:00:00 2001 From: Predrag Gruevski Date: Sat, 30 Nov 2024 23:54:03 +0000 Subject: [PATCH] Make GitHub Actions CI cache checks also check for the metadata. --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4a95498..3d0393ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -406,11 +406,17 @@ jobs: # Show what's in the cache. ls subject-new/target/semver-checks/cache/ - EXPECTED_CACHED_RUSTDOC='subject-new/target/semver-checks/cache/libp2p_core-0_37_0-ccce455725cbab73.json' + EXPECTED_PREFIX='subject-new/target/semver-checks/cache/libp2p_core-0_37_0-ccce455725cbab73' + EXPECTED_CACHED_METADATA="${EXPECTED_PREFIX}.metadata.json" + EXPECTED_CACHED_RUSTDOC="${EXPECTED_PREFIX}.json" - # Ensure the previous cached rustdoc file still exists. + # Ensure the previous cached rustdoc and metadata files still exist. + [ -f "$EXPECTED_CACHED_METADATA" ] || { \ + echo "could not find libp2p-core metadata cache file"; \ + exit 1; + } [ -f "$EXPECTED_CACHED_RUSTDOC" ] || { \ - echo "could not find libp2p-core cache file"; \ + echo "could not find libp2p-core rustdoc cache file"; \ exit 1; } @@ -527,20 +533,30 @@ jobs: ls subject/target/semver-checks/cache/ # The previous cached rustdoc should continue to exist. - if [ -f subject/target/semver-checks/cache/serde-1_0_162-5900ebf8bb9b9f8b.json ]; then - exit 0 - else + PREVIOUS_PREFIX='subject/target/semver-checks/cache/serde-1_0_162-5900ebf8bb9b9f8b' + PREVIOUS_RUSTDOC="${PREVIOUS_PREFIX}.json" + PREVIOUS_METADATA="${PREVIOUS_PREFIX}.metadata.json" + if [ ! -f "$PREVIOUS_RUSTDOC" ]; then echo "Older rustdoc JSON not found in cache!" exit 1 fi + if [ ! -f "$PREVIOUS_METADATA" ]; then + echo "Older metadata file not found in cache!" + exit 1 + fi # There should also be a new cached rustdoc file for the new feature settings. - if [ -f subject/target/semver-checks/cache/serde-1_0_162-6999ae87ca463ab3.json ]; then - exit 0 - else + NEW_PREFIX='subject/target/semver-checks/cache/serde-1_0_162-6999ae87ca463ab3' + NEW_RUSTDOC="${NEW_PREFIX}.json" + NEW_METADATA="${NEW_PREFIX}.metadata.json" + if [ ! -f "$NEW_RUSTDOC" ]; then echo "New rustdoc JSON for new feature combo not found in cache!" exit 1 fi + if [ ! -f "$NEW_METADATA" ]; then + echo "New metadata file for new feature combo not found in cache!" + exit 1 + fi - name: Cleanup run: |