Skip to content

Commit

Permalink
test: add pipeline test to check clean git tree
Browse files Browse the repository at this point in the history
  • Loading branch information
wmmc88 committed Feb 25, 2025
1 parent 181c03d commit 176d721
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/actions/check-clean-git-working-tree/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Check Clean Git Working Tree"
description: "Check that the git working tree is clean"

runs:
using: "composite"
steps:
- name: Check clean Git working tree
shell: bash
run: |
status_output=$(git status --porcelain=v1)
if [ -z "$status_output" ]; then
echo "Git working tree is clean."
exit 0
else
echo "dirty Git working tree detected!"
echo "$status_output"
exit 1
fi
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ jobs:
- run: cargo update
- uses: Swatinem/rust-cache@v2
- run: cargo test ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} ${{ matrix.cargo_flags }}
# check that there are no uncommitted changes to prevent bugs like https://github.com/rust-lang/cc-rs/issues/1411
- name: check clean Git workting tree
uses: ./.github/actions/check-clean-git-working-tree

# This is separate from the matrix above because there is no prebuilt rust-std component for these targets.
check-build-std:
Expand Down Expand Up @@ -234,6 +237,9 @@ jobs:
- run: cargo test -Z build-std=std --no-run --workspace --target ${{ matrix.target }}
- run: cargo test -Z build-std=std --no-run --workspace --target ${{ matrix.target }} --release
- run: cargo test -Z build-std=std --no-run --workspace --target ${{ matrix.target }} --features parallel
# check that there are no uncommitted changes to prevent bugs like https://github.com/rust-lang/cc-rs/issues/1411
- name: check clean Git workting tree
uses: ./.github/actions/check-clean-git-working-tree

check-wasm:
name: Test wasm
Expand All @@ -252,6 +258,9 @@ jobs:
- run: cargo test --no-run --target ${{ matrix.target }}
- run: cargo test --no-run --target ${{ matrix.target }} --release
- run: cargo test --no-run --target ${{ matrix.target }} --features parallel
# check that there are no uncommitted changes to prevent bugs like https://github.com/rust-lang/cc-rs/issues/1411
- name: check clean Git workting tree
uses: ./.github/actions/check-clean-git-working-tree

test-wasm32-wasip1-thread:
name: Test wasm32-wasip1-thread
Expand Down Expand Up @@ -297,6 +306,10 @@ jobs:
- name: Run tests
run: cargo +nightly build -p $TARGET-test --target $TARGET

# check that there are no uncommitted changes to prevent bugs like https://github.com/rust-lang/cc-rs/issues/1411
- name: check clean Git workting tree
uses: ./.github/actions/check-clean-git-working-tree

cuda:
name: Test CUDA support
runs-on: ubuntu-22.04
Expand All @@ -317,6 +330,9 @@ jobs:
run: |
PATH="/usr/local/cuda/bin:$PATH" cargo test --manifest-path dev-tools/cc-test/Cargo.toml --features test_cuda
PATH="/usr/local/cuda/bin:$PATH" CXX=clang++ cargo test --manifest-path dev-tools/cc-test/Cargo.toml --features test_cuda
# check that there are no uncommitted changes to prevent bugs like https://github.com/rust-lang/cc-rs/issues/1411
- name: check clean Git workting tree
uses: ./.github/actions/check-clean-git-working-tree

msrv:
name: MSRV
Expand Down Expand Up @@ -353,6 +369,9 @@ jobs:
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --no-deps
# check that there are no uncommitted changes to prevent bugs like https://github.com/rust-lang/cc-rs/issues/1411
- name: check clean Git workting tree
uses: ./.github/actions/check-clean-git-working-tree

rustfmt:
name: Rustfmt
Expand Down

0 comments on commit 176d721

Please sign in to comment.