From fe7d7449460293b532cec210e8e783288fa8d52d Mon Sep 17 00:00:00 2001 From: KtorZ Date: Tue, 16 Jul 2024 17:41:14 +0200 Subject: [PATCH] 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. --- .github/workflows/tests.yml | 26 +++++++++++-------- examples/acceptance_tests/fmt | 2 +- examples/acceptance_tests/run | 4 +-- .../acceptance_tests/script_context/test.sh | 4 +-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a63f0d60..f374670d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/examples/acceptance_tests/fmt b/examples/acceptance_tests/fmt index 4e424e97..2b271543 100755 --- a/examples/acceptance_tests/fmt +++ b/examples/acceptance_tests/fmt @@ -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)" diff --git a/examples/acceptance_tests/run b/examples/acceptance_tests/run index dca2160d..5d23f918 100755 --- a/examples/acceptance_tests/run +++ b/examples/acceptance_tests/run @@ -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 diff --git a/examples/acceptance_tests/script_context/test.sh b/examples/acceptance_tests/script_context/test.sh index afce301e..82381740 100755 --- a/examples/acceptance_tests/script_context/test.sh +++ b/examples/acceptance_tests/script_context/test.sh @@ -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