diff --git a/.github/workflows/bridge-ci.yml b/.github/workflows/bridge-ci.yml index 54e7c5545..e247042df 100644 --- a/.github/workflows/bridge-ci.yml +++ b/.github/workflows/bridge-ci.yml @@ -45,6 +45,8 @@ jobs: # include relevant information in the cache name prefix-key: "bridge-${{ matrix.rust }}" + - uses: taiki-e/install-action@nextest + - name: rustfmt run: cargo fmt -- --check working-directory: bridge diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.yml index f3419680d..8e0e306fc 100644 --- a/.github/workflows/rust-lint.yml +++ b/.github/workflows/rust-lint.yml @@ -66,10 +66,12 @@ jobs: # include relevant information in the cache name prefix-key: "rust-client-${{ matrix.rust }}" + - uses: taiki-e/install-action@nextest + - name: Clippy run: cargo clippy --all-targets --all-features -- -D warnings working-directory: rust - name: Run tests - run: cargo test --all + run: cargo nextest run working-directory: rust diff --git a/.github/workflows/server-ci.yml b/.github/workflows/server-ci.yml index cfb1476df..1909435bc 100644 --- a/.github/workflows/server-ci.yml +++ b/.github/workflows/server-ci.yml @@ -45,6 +45,8 @@ jobs: # include relevant information in the cache name prefix-key: "server-${{ matrix.rust }}" + - uses: taiki-e/install-action@nextest + - name: rustfmt run: cargo fmt -- --check working-directory: server diff --git a/bridge/run-tests.sh b/bridge/run-tests.sh index 9c988e95a..ebc8f8d1b 100755 --- a/bridge/run-tests.sh +++ b/bridge/run-tests.sh @@ -1,8 +1,20 @@ -#!/bin/sh -e +#!/bin/bash + +if [[ -z "$TEST_COMMAND" ]]; then + if [[ -z "$CARGO_HOME" ]]; then + CARGO_HOME="$HOME/.cargo" + fi + + if command -v cargo-nextest || [[ -e "$CARGO_HOME/bin/cargo-nextest" ]]; then + TEST_COMMAND="cargo nextest run" + else + TEST_COMMAND="cargo test" + fi +fi AWS_DEFAULT_REGION="elasticmq" \ AWS_ACCESS_KEY_ID="x" \ AWS_SECRET_ACCESS_KEY="x" \ PUBSUB_EMULATOR_HOST=localhost:8085 \ PUBSUB_PROJECT_ID=local-project \ -cargo test --all-features -- "$@" +${TEST_COMMAND} --all-features -- "$@" diff --git a/server/run-tests.sh b/server/run-tests.sh index faa349c76..236fe3763 100755 --- a/server/run-tests.sh +++ b/server/run-tests.sh @@ -1,6 +1,18 @@ -#!/bin/sh -e +#!/bin/bash -# Run tests with various configurations: +# Run tests with various configurations. + +if [[ -z "$TEST_COMMAND" ]]; then + if [[ -z "$CARGO_HOME" ]]; then + CARGO_HOME="$HOME/.cargo" + fi + + if command -v cargo-nextest || [[ -e "$CARGO_HOME/bin/cargo-nextest" ]]; then + TEST_COMMAND="cargo nextest run" + else + TEST_COMMAND="cargo test" + fi +fi # Common variables: export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres" @@ -15,8 +27,8 @@ echo "*********** RUN 1 ***********" export SVIX_QUEUE_TYPE="redis" export SVIX_CACHE_TYPE="redis" export SVIX_REDIS_DSN="redis://localhost:6379" - cargo test - cargo test -- --ignored redis + ${TEST_COMMAND} + ${TEST_COMMAND} -- --ignored redis ) echo "*********** RUN 2 ***********" @@ -24,7 +36,7 @@ echo "*********** RUN 2 ***********" export SVIX_QUEUE_TYPE="redis" export SVIX_CACHE_TYPE="memory" export SVIX_REDIS_DSN="redis://localhost:6379" - cargo test + ${TEST_COMMAND} ) echo "*********** RUN 3 ***********" @@ -32,7 +44,7 @@ echo "*********** RUN 3 ***********" export SVIX_QUEUE_TYPE="redis" export SVIX_CACHE_TYPE="none" export SVIX_REDIS_DSN="redis://localhost:6379" - cargo test + ${TEST_COMMAND} ) echo "*********** RUN 4 ***********" @@ -40,15 +52,15 @@ echo "*********** RUN 4 ***********" export SVIX_QUEUE_TYPE="rediscluster" export SVIX_CACHE_TYPE="rediscluster" export SVIX_REDIS_DSN="redis://localhost:6380" - cargo test - cargo test -- --ignored redis + ${TEST_COMMAND} + ${TEST_COMMAND} -- --ignored redis ) echo "*********** RUN 5 ***********" ( export SVIX_QUEUE_TYPE="memory" export SVIX_CACHE_TYPE="none" - cargo test + ${TEST_COMMAND} ) echo "*********** RUN 6 ***********" @@ -57,6 +69,6 @@ echo "*********** RUN 6 ***********" export SVIX_CACHE_TYPE="redis" export SVIX_REDIS_DSN="redis://localhost:6379" export SVIX_RABBIT_DSN="amqp://xivs:xivs@localhost:5672/%2f" - cargo test - cargo test -- --ignored rabbitmq + ${TEST_COMMAND} + ${TEST_COMMAND} -- --ignored rabbitmq )