Skip to content

Commit 9c5cc02

Browse files
committed
Make CI more robust to cached packages
1 parent a9da2f3 commit 9c5cc02

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

.github/workflows/main-quality-check.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
3737
- name: Run quality checks
3838
run: |
39-
# Check format
39+
# Check format.
4040
dotnet format --verify-no-changes
4141
42-
# Run tests
43-
dotnet test --no-restore
42+
# Purge some NuGet caches and run tests.
43+
HARD=true ./scripts/clean-and-test.sh
4444
45-
# Ensure pack works
45+
# Ensure pack works.
4646
dotnet pack --no-restore

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
2222
dotnet format --verify-no-changes
2323
24-
dotnet test --no-restore
24+
# Purge some NuGet caches and run tests.
25+
HARD=true ./scripts/clean-and-test.sh
2526
2627
dotnet pack \
2728
--configuration Release \

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
# Standard Conventions for C#
22

33
Library for enforcing my preferred conventions in C#.
4+
5+
## Running Tests
6+
7+
Test are run against packed versions of the library. Because of this, NuGet
8+
caching can get in the way of tests seeing updates. To get around run the
9+
following script to rebuild and run tests:
10+
11+
```bash
12+
HARD=true ./scripts/clean-and-test.sh
13+
```

scripts/clean-and-test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
TEST_ARTIFACTS_PATH="$HOME/.cache/Tdg5.StandardConventions.Tests/test-artifacts"
44
rm -rf "$TEST_ARTIFACTS_PATH"
55
find . -type d \( -name bin -o -name obj \) -print0 | xargs -0 rm -rf
6-
[ -n "$HARD" ] && dotnet nuget locals all --clear
6+
7+
if [ -n "$HARD" ]; then
8+
# Try to preserve other caches to minimize restore time.
9+
dotnet nuget locals global-packages --clear
10+
fi
11+
712
dotnet clean
813

914
dotnet test

0 commit comments

Comments
 (0)