From 06f3e756e20daddb4aece8bfa3b28a7ff53788a3 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 1 Oct 2024 10:27:26 +0700 Subject: [PATCH] fix(rust): test (#40) * fix(rust): Add --keep-ts like the original cache fix had. Also, use a common builder. * refactor(rust): Move FINGERPRINT_SRC to the common rust definitions in cat-ci * fix(rust): Remove deliberate cache break * ci(general): Bump to latest CI release with updated rust builders --- Earthfile | 4 +-- docs/Earthfile | 2 +- rust/Earthfile | 54 ++++++++++++--------------------- rust/c509-certificate/Earthfile | 2 +- rust/cbork/Earthfile | 2 +- 5 files changed, 24 insertions(+), 40 deletions(-) diff --git a/Earthfile b/Earthfile index 7a5a3c75d..8cdb62309 100644 --- a/Earthfile +++ b/Earthfile @@ -1,7 +1,7 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.10 AS mdlint-ci -IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.10 AS cspell-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.11 AS mdlint-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.11 AS cspell-ci FROM debian:stable-slim diff --git a/docs/Earthfile b/docs/Earthfile index 4c76fb7c5..32c3cb59d 100644 --- a/docs/Earthfile +++ b/docs/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.10 AS docs-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.11 AS docs-ci IMPORT .. AS repo diff --git a/rust/Earthfile b/rust/Earthfile index af84cf140..49200d45b 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -1,31 +1,19 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/rust-cache-updates AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.11 AS rust-ci COPY_SRC: FUNCTION - COPY Cargo.toml clippy.toml deny.toml rustfmt.toml . - COPY --dir .cargo .config \ - c509-certificate \ - cardano-chain-follower \ - catalyst-voting \ - cbork \ - cbork-abnf-parser \ - cbork-cddl-parser \ - hermes-ipfs . - -FINGERPRINT_SRC: - FUNCTION - - ARG WHENCE=.. - ARG DIR=build - ARG FINGERPRINT=src_fingerprint.txt - - RUN cd $WHENCE; \ - tar -C ./ -cf - --sort=name --mtime='UTC 2019-01-01' --group=0 --owner=0 --numeric-owner $DIR \ - | sha256sum > $FINGERPRINT - RUN cat $WHENCE/$FINGERPRINT + COPY --keep-ts --dir \ + Cargo.toml clippy.toml deny.toml rustfmt.toml \ + .cargo .config \ + c509-certificate \ + cardano-chain-follower \ + catalyst-voting \ + cbork cbork-abnf-parser cbork-cddl-parser \ + hermes-ipfs \ + . # sync-cfg: Synchronize local config with CI version. # Must be run by the developer manually. @@ -36,29 +24,25 @@ sync-cfg: builder: DO rust-ci+SETUP +builder-src: + FROM +builder + # Cached copy of the source we build. DO +COPY_SRC # Generate Checksums of the source - DO +FINGERPRINT_SRC + DO rust-ci+FINGERPRINT_SRC SAVE ARTIFACT ../src_fingerprint.txt # check : Run basic check. check: - FROM +builder + FROM +builder-src DO rust-ci+EXECUTE --cmd="/scripts/std_checks.py" # build : Build crates. build: - FROM +builder - - RUN --no-cache echo "Cache Disabled" - - # RUN /scripts/std_build.py \ - # --libs=c509-certificate --libs=cardano-chain-follower --libs=hermes-ipfs \ - # --libs=cbork-cddl-parser --libs=cbork-abnf-parser \ - # --bins=cbork/cbork + FROM +builder-src DO rust-ci+EXECUTE \ --cmd="/scripts/std_build.py" \ @@ -74,9 +58,9 @@ build: # build-src-check: Check for any caching issues with the source we are building against. check-builder-src-cache: - DO rust-ci+SETUP + FROM +builder - COPY +builder/src_fingerprint.txt . + COPY +builder-src/src_fingerprint.txt . RUN --no-cache echo "Cache Disabled" @@ -84,7 +68,7 @@ check-builder-src-cache: DO +COPY_SRC # Generate Checksums of the source - DO +FINGERPRINT_SRC --FINGERPRINT=src_fingerprint_uncached.txt + DO rust-ci+FINGERPRINT_SRC --FINGERPRINT=src_fingerprint_uncached.txt RUN diff src_fingerprint.txt ../src_fingerprint_uncached.txt \ || (echo "ERROR: Source fingerprints do not match. Caching Error Detected!!" && exit 1) \ diff --git a/rust/c509-certificate/Earthfile b/rust/c509-certificate/Earthfile index 035e6d423..b1295317d 100644 --- a/rust/c509-certificate/Earthfile +++ b/rust/c509-certificate/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.10 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.11 AS rust-ci IMPORT .. AS rust-local IMPORT ../.. AS repo diff --git a/rust/cbork/Earthfile b/rust/cbork/Earthfile index 4399e0068..f0a641f55 100644 --- a/rust/cbork/Earthfile +++ b/rust/cbork/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.10 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.11 AS rust-ci IMPORT .. AS rust-local