diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d9df9c1..40680fe3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,10 +11,12 @@ jobs: fail-fast: false matrix: rust: - - 1.70.0 - - stable - - beta - - nightly + # Don't pull in newest dependencies when using old Rust toolchain + - version: 1.70.0 + env: SKIP_CARGO_UPDATE=1 + - version: stable + - version: beta + - version: nightly steps: - uses: actions/checkout@v2 @@ -22,11 +24,11 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.rust }} + toolchain: ${{ matrix.rust.version }} override: true - name: test - run: ./capstone-rs/ci/test.sh + run: env ${{ matrix.rust.env }} ./capstone-rs/ci/test.sh - name: test (all features) - run: ALL_FEATURES=1 ./capstone-rs/ci/test.sh + run: env ${{ matrix.rust.env }} ALL_FEATURES=1 ./capstone-rs/ci/test.sh diff --git a/capstone-rs/ci/test.sh b/capstone-rs/ci/test.sh index 86af8015..3a665cc0 100755 --- a/capstone-rs/ci/test.sh +++ b/capstone-rs/ci/test.sh @@ -11,6 +11,7 @@ # - JOB: {*test,valgrind-test,bench,cov} # - PROFILES: list of {debug,release} [debug release] # - SHOULD_FAIL: (disabled by default; set to non-empty string to enable) +# - SKIP_CARGO_UPDATE: set to disable "cargo update" part of tests # - VALGRIND_TESTS: run tests under Valgrind set -euo pipefail @@ -174,6 +175,7 @@ run_kcov() { cov() { echo "Running coverage" + cargo_update install_kcov cleanup_cov @@ -193,6 +195,9 @@ cov() { } bench() { + echo "Running bench" + cargo_update + ${CARGO} bench } @@ -232,6 +237,8 @@ test_rust_file() { } run_tests() { + cargo_update + TMPFILE="$(mktemp /tmp/capstone-rs.XXXXXXXXXX)" [ -f "$TMPFILE" ] || Error "Could not make temp file" for PROFILE in $PROFILES; do @@ -284,6 +291,15 @@ run_tests() { rm "$TMPFILE" } +cargo_update() { + if [ -z "${SKIP_CARGO_UPDATE:-}" ]; then + echo "Updating dependencies in Cargo.lock" + ${CARGO} update + else + echo "Skipping 'cargo update' since SKIP_CARGO_UPDATE is set" + fi +} + PROFILES="${PROFILES-debug}" for PROFILE in $PROFILES; do profile_args "$PROFILE"