Skip to content

Commit

Permalink
fix(ci): Only use locked flag if lockfile exists (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored Feb 16, 2023
1 parent 56e7574 commit 7d05728
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ jobs:
- name: Install dependencies
run: sudo apt update && sudo apt install libomp-dev

- name: Check for lockfile
working-directory: ${{ inputs.working-directory }}
run: |
if [ -f Cargo.lock ]; then
echo "LOCKED_FLAG=--locked" >> $GITHUB_ENV
fi
- name: Run cargo clippy
working-directory: ${{ inputs.working-directory }}
run: |
cargo clippy --locked -- -D warnings
cargo clippy ${{ env.LOCKED_FLAG }} -- -D warnings
18 changes: 16 additions & 2 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,17 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Check for lockfile
working-directory: ${{ inputs.working-directory }}
run: |
if [ -f Cargo.lock ]; then
echo "LOCKED_FLAG=--locked" >> $GITHUB_ENV
fi
- name: Run cargo test
working-directory: ${{ inputs.working-directory }}
run: |
cargo test --locked -- --test-threads=1
cargo test ${{ env.LOCKED_FLAG }} -- --test-threads=1
test_clang10:
name: Test with clang 10
Expand Down Expand Up @@ -103,7 +110,14 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Check for lockfile
working-directory: ${{ inputs.working-directory }}
run: |
if [ -f Cargo.lock ]; then
echo "LOCKED_FLAG=--locked" >> $GITHUB_ENV
fi
- name: Run cargo test
working-directory: ${{ inputs.working-directory }}
run: |
cargo test --locked -- --test-threads=1
cargo test ${{ env.LOCKED_FLAG }} -- --test-threads=1

0 comments on commit 7d05728

Please sign in to comment.