Skip to content

Commit 4f0a7df

Browse files
committed
split out doc tests
1 parent f9036b6 commit 4f0a7df

File tree

3 files changed

+62
-5
lines changed

3 files changed

+62
-5
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
path: shotover-proxy/build/packages
3636
key: ubuntu-22.04-packages
3737
- uses: actions/checkout@v4
38-
# We purposefully dont cache here as build_and_test will always be the bottleneck
38+
# We purposefully dont cache rust build here as build_and_test will always be the bottleneck
3939
# so we should leave the cache alone so build_and_test can make more use of it.
4040
- name: Install ubuntu packages
4141
run: shotover-proxy/build/install_ubuntu_packages.sh

.github/workflows/build_and_test.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
# downsides:
5252
# * PRs that update rust version or changes deps will be slow to iterate on due to changes not being cached.
5353
save-if: ${{ github.ref == 'refs/heads/main' }}
54+
# Additionally, the main builds should always run without cache to avoid accumulating unused build files across builds.
55+
# Usually, this isnt a problem because rust-cache only caches dependencies, not our project.
56+
# However, in this case we have enabled cache-all-crates, which forces rust-cache to cache our projects build files as well as the dependencies.
57+
lookup-only: ${{ github.ref == 'refs/heads/main' }}
5458

5559
# Our workspace contains crates like test-helpers that are only changed sometimes,
5660
# so enabling this gives a nice speedup at the cost of extra cache storage.
@@ -61,7 +65,7 @@ jobs:
6165
#
6266
# Note that: evicting this cache without evicting the rust-cache will lead to CI failures, however as long as our caches are well within the 10GB limit we should be fine.
6367
- name: Cache jassets
64-
uses: actions/cache@v5
68+
uses: actions/cache/restore@v5
6569
with:
6670
path: target/${{ matrix.profile }}/jassets
6771
# cache can be global as java assets work regardless of OS+arch
@@ -79,9 +83,7 @@ jobs:
7983
with:
8084
tool: nextest@0.9.129
8185
- name: Build tests
82-
run: |
83-
cargo nextest archive --archive-file nextest-${{ matrix.profile }}.tar.zst ${{ matrix.cargo_flags }} --all-features --all-targets
84-
cargo test --doc ${{ matrix.cargo_flags }} --all-features
86+
run: cargo nextest archive --archive-file nextest-${{ matrix.profile }}.tar.zst ${{ matrix.cargo_flags }} --all-features --all-targets
8587
- name: Upload built tests to workflow
8688
uses: actions/upload-artifact@v4
8789
with:

.github/workflows/doc_tests.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: cargo doc tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
# Cancel already running jobs
10+
concurrency:
11+
group: doc_tests_${{ github.head_ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
RUST_BACKTRACE: 1
17+
18+
jobs:
19+
build_check_and_upload:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- name: Build Release
25+
runner: ubuntu-24.04
26+
cargo_flags: --release
27+
profile: release
28+
29+
- name: Build Debug
30+
runner: ubuntu-24.04
31+
cargo_flags:
32+
profile: debug
33+
34+
name: ${{ matrix.name }}
35+
runs-on: ${{ matrix.runner }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
# We purposefully dont cache rust build here as build_and_test will always be the bottleneck
39+
# so we should leave the cache alone so build_and_test can make more use of it.
40+
- name: cache custom ubuntu packages
41+
uses: actions/cache@v5
42+
with:
43+
path: shotover-proxy/build/packages
44+
key: ubuntu-24.04-packages
45+
- name: Install ubuntu packages
46+
run: shotover-proxy/build/install_ubuntu_packages.sh
47+
- name: run doc tests
48+
run: |
49+
cargo test --doc ${{ matrix.cargo_flags }} --all-features
50+
- name: Ensure that tests did not create or modify any files that arent .gitignore'd
51+
run: |
52+
if [ -n "$(git status --porcelain)" ]; then
53+
git status
54+
exit 1
55+
fi

0 commit comments

Comments
 (0)