Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update poems #220

Merged
merged 24 commits into from
Jan 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: cat-gateway earthfile
  • Loading branch information
bkioshn committed Jan 26, 2024
commit fb4327ebb7b5ac02f71e8269d8e6d4b1f68fa5da
106 changes: 22 additions & 84 deletions catalyst-gateway/Earthfile
Original file line number Diff line number Diff line change
@@ -1,112 +1,51 @@
VERSION 0.7
VERSION --try --global-cache 0.7

#cspell: words rustfmt toolsets USERARCH

# Set up our target toolchains, and copy our files.
builder:
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.14+rust-base

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.14+SETUP --toolchain=rust-toolchain.toml
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.6.0+SETUP --toolchain=rust-toolchain.toml

bkioshn marked this conversation as resolved.
Show resolved Hide resolved
COPY --dir .cargo .config Cargo.* clippy.toml deny.toml rustfmt.toml bin crates tests .

# Test rust build container - Use best architecture host tools.
hosted-check:
## -----------------------------------------------------------------------------
##
## Standard CI targets.
##
## These targets are discovered and executed automatically by CI.

# Run check using the most efficient host tooling
# CI Automated Entry point.
check:
FROM +builder

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.14+CHECK
RUN /scripts/std_checks.py

# Test which runs check with all supported host tooling. Needs qemu or rosetta to run.
# Only used to validate tooling is working across host toolsets.
all-hosts-check:
BUILD --platform=linux/amd64 --platform=linux/arm64 +hosted-check

hosted-build:
ARG TARGETPLATFORM
BUILD --platform=linux/amd64 --platform=linux/arm64 +check

build:
# Build the service
FROM +builder

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.14+BUILD --bins="cat-gateway/cat-gateway"

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.14+SMOKE_TEST --bin="cat-gateway"

# generate OpenAPI docs
TRY
RUN /scripts/std_build.py --cov_report="coverage-report.info" \
--bins="cat-gateway/cat-gateway"
FINALLY
SAVE ARTIFACT target/nextest/ci/junit.xml AS LOCAL example.junit-report.xml
SAVE ARTIFACT coverage-report.info AS LOCAL example.coverage-report.info
END
RUN ./target/$TARGETARCH/release/cat-gateway docs ./target/$TARGETARCH/doc/cat-gateway-api.json

SAVE ARTIFACT target/$TARGETARCH/doc doc
SAVE ARTIFACT target/$TARGETARCH/release/cat-gateway cat-gateway

# Test which runs check with all supported host tooling. Needs qemu or rosetta to run.
# Only used to validate tooling is working across host toolsets.
all-hosts-build:
BUILD --platform=linux/amd64 --platform=linux/arm64 +hosted-build
BUILD --platform=linux/amd64 --platform=linux/arm64 +build

unit-test-hosted:
# Build the service
FROM +builder

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.14+UNIT_TEST

SAVE ARTIFACT target/nextest/ci/junit.xml junit-report.xml
SAVE ARTIFACT coverage-report.info coverage-report.info

## -----------------------------------------------------------------------------
##
## Standard CI targets.
##
## These targets are discovered and executed automatically by CI.

# Run check using the most efficient host tooling
# CI Automated Entry point.
check:
FROM busybox
# This is necessary to pick the correct architecture build to suit the native machine.
# It primarily ensures that Darwin/Arm builds work as expected without needing x86 emulation.
# All target implementation of this should follow this pattern.
ARG USERARCH

IF [ "$USERARCH" == "arm64" ]
BUILD --platform=linux/arm64 +hosted-check
ELSE
BUILD --platform=linux/amd64 +hosted-check
END

# Run build using the most efficient host tooling
# CI Automated Entry point.
build:
FROM busybox
# This is necessary to pick the correct architecture build to suit the native machine.
# It primarily ensures that Darwin/Arm builds work as expected without needing x86 emulation.
# All target implementation of this should follow this pattern.
ARG USERARCH

IF [ "$USERARCH" == "arm64" ]
BUILD --platform=linux/arm64 +hosted-build
ELSE
BUILD --platform=linux/amd64 +hosted-build
END


# This step will build any packages we would intend to publish or integration test.
# package:
# FROM scratch

# Run integration tests on all packages built during the `package` step.
test:
FROM busybox
# This is necessary to pick the correct architecture build to suit the native machine.
# It primarily ensures that Darwin/Arm builds work as expected without needing x86 emulation.
# All target implementation of this should follow this pattern.
ARG USERARCH

IF [ "$USERARCH" == "arm64" ]
BUILD --platform=linux/arm64 +unit-test-hosted
BUILD --platform=linux/arm64 ./tests+integration-test
ELSE
BUILD --platform=linux/amd64 +unit-test-hosted
BUILD --platform=linux/amd64 ./tests+integration-test
END

# Publish packages if all integration tests have passed. (Failure to pass tests will prevent packages being published.)
# publish:
@@ -119,5 +58,4 @@ local-ci-run:
BUILD +check
BUILD +build
# BUILD +package
BUILD +test
# BUILD +publish
Loading