Skip to content

Commit

Permalink
fix(rust): test (#40)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stevenj authored Oct 1, 2024
1 parent d1916b6 commit 06f3e75
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 40 deletions.
4 changes: 2 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/Earthfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
54 changes: 19 additions & 35 deletions rust/Earthfile
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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" \
Expand All @@ -74,17 +58,17 @@ 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"

# Uncached copy of the source we build.
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) \
Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/Earthfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion rust/cbork/Earthfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 06f3e75

Please sign in to comment.