From 5392f27fdd0dceb7a1e679c6f166bdb60c371008 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Fri, 12 Mar 2021 13:10:40 +0530 Subject: [PATCH] Improve builds and fix release builds (#105) * Checkout the PR branch if triggered by a PR Signed-off-by: Sayan Nandan * Use `cmd` as the shell on Windows to fix builds Signed-off-by: Sayan Nandan #104 did this for pushes; this will do it for releases. * Fix Windows release script Signed-off-by: Sayan Nandan * No need to checkout to head.ref for PRs Signed-off-by: Sayan Nandan --- .github/workflows/release.yml | 8 ++++++++ .github/workflows/test-pr.yml | 20 +++++++++++++++++--- ci/buildvars.sh | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ce3977e..34b74610 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,7 +89,15 @@ jobs: if: matrix.build == 'macos' run: cargo build --release + - name: Install Perl (Windows) + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: "5.30" + distribution: strawberry + if: env.IS_MD_FILE == 'false' && runner.os == 'Windows' + - name: Build (Windows) + shell: cmd # Use cmd as the default shell to avoid perl path errors if: matrix.build == 'windows' run: cargo build --release env: diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 4f856a07..b620d7f1 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -2,7 +2,7 @@ name: Test (PR) on: [pull_request] env: - BUILD: "false" + BUILD: false jobs: test: name: Test @@ -69,7 +69,21 @@ jobs: if: env.BUILD == 'true' - name: Run Tests - run: cargo test --verbose -- --test-threads=1 + run: cargo test --verbose env: RUST_BACKTRACE: 1 - if: env.BUILD == 'true' + if: env.IS_MD_FILE == 'false' && runner.os != 'Windows' + + - name: Install Perl (Windows) + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: "5.30" + distribution: strawberry + if: env.IS_MD_FILE == 'false' && runner.os == 'Windows' + + - name: Run Tests (Windows) + run: cargo test --verbose + env: + RUST_BACKTRACE: 1 + shell: cmd + if: env.IS_MD_FILE == 'false' && runner.os == 'Windows' diff --git a/ci/buildvars.sh b/ci/buildvars.sh index fb449bce..c5e5b6d2 100755 --- a/ci/buildvars.sh +++ b/ci/buildvars.sh @@ -2,6 +2,7 @@ # If source files were indeed modified, then this script sets `BUILD=true` set -euo pipefail + SRC_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- '*.rs' '*.yml' '*.toml' 'Dockerfile' | wc -l) if [ $SRC_CHANGED_COUNT != "0" ]; then