Split continuous workflow in three jobs.

Doing all steps sequentially is starting to get long. Several of those checks are unrelated and can be done in parallel.
This commit is contained in:
KtorZ 2024-07-16 17:41:14 +02:00
parent 0145237bbe
commit fe7d744946
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
4 changed files with 20 additions and 16 deletions

View File

@ -10,29 +10,33 @@ env:
CARGO_TERM_COLOR: always
jobs:
build:
acceptance_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose --workspace --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: -C target-feature=+crt-static
- name: Run unit tests
run: cargo test --verbose --workspace
- name: Run examples
run: |
cargo run -- check examples/hello_world
cargo run -- check examples/gift_card
cargo run -r -- check examples/hello_world
cargo run -r -- check examples/gift_card
- name: Run acceptance tests
working-directory: examples/acceptance_tests
run: |
cargo install cbor-diag-cli
bash ci
shell: bash
unit_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run unit tests
run: cargo test --verbose --workspace
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
# - name: Audit
# run: cargo audit

View File

@ -15,7 +15,7 @@ WORKDIR="$(dirname -- "${BASH_SOURCE[0]}")"
TARGET="$WORKDIR/$(basename $1)"
TMP=$(mktemp)
RESULT=$(cargo run --quiet -- fmt $TARGET 2>$TMP)
RESULT=$(cargo run -r --quiet -- fmt $TARGET 2>$TMP)
if [ "$?" -eq "0" ]; then
echo "✅ $(basename $TARGET)"

View File

@ -16,12 +16,12 @@ TARGET="$WORKDIR/$(basename $1)"
TMP=$(mktemp)
VALIDATORS=$(find $TARGET -type f -path "*validators/*.ak")
cargo run --quiet -- check $TARGET 1>$TMP 2>/dev/null
cargo run -r --quiet -- check $TARGET 1>$TMP 2>/dev/null
if [ "$?" -eq "0" ]; then
if [ -z "$VALIDATORS" ]; then
echo "✅ $(basename $TARGET)"
else
cargo run --quiet -- build $TARGET 1>$TMP 2>/dev/null
cargo run -r --quiet -- build $TARGET 1>$TMP 2>/dev/null
if [ "$?" -eq "0" ]; then
echo "✅ $(basename $TARGET)"
else

View File

@ -24,7 +24,7 @@ then
exit 1
fi
cargo run --quiet -- build
cargo run -r --quiet -- build
if [ $? -ne 0 ]; then
exit $?
fi
@ -39,4 +39,4 @@ cp ctx/$TITLE/inputs.cbor.template ctx/$TITLE/inputs.cbor
sed "s/{{ VALIDATOR_HASH }}/$VALIDATOR_HASH/" ctx/$TITLE/outputs.cbor.template > ctx/$TITLE/outputs.cbor
sed "s/{{ VALIDATOR }}/$VALIDATOR/" ctx/$TITLE/tx.cbor.template | sed "s/{{ VALIDATOR_HASH }}/$VALIDATOR_HASH/" > ctx/$TITLE/tx.cbor
cargo run --quiet -- tx simulate ctx/$TITLE/tx.cbor ctx/$TITLE/inputs.cbor ctx/$TITLE/outputs.cbor
cargo run -r --quiet -- tx simulate ctx/$TITLE/tx.cbor ctx/$TITLE/inputs.cbor ctx/$TITLE/outputs.cbor