Skip to content

Commit 9a4a48d

Browse files
committed
ci: build backend tests in /mnt
GitHub's ubuntu-22.04 runner only guarantees 14 GB of free space on /, which turns out to not quite be enough any more for our backend tests to be built and run. GitHub runners also provide a larger temporary partition on /mnt, so let's use that for our target directory. This appears to be very slightly slower (~10% slowdown) than building and running on /, but since it works and / doesn't, here we are. Note that the presence of /mnt isn't really guaranteed by the GitHub documentation. It was apparently previously suggested by the Azure docs[^azure], but the current version doesn't include any reference to /mnt that I can see. I don't think there's a lot of downside in us making this change right now. It feels fragile, but our other option would pretty much be to use something like the `maximize-build-space` action[^action] to take out the parts of the ubuntu-22.04 image that we don't need, which is just as implementation specific. Or we could run tests for each workspace member in turn, but then we'd have to clean up and would probably lose all the benefits of the caching we have in CI right now. Fixes #9050. [^action]: https://github.com/easimon/maximize-build-space [^azure]: https://learn.microsoft.com/en-us/previous-versions/azure/jj672979(v=azure.100)?redirectedfrom=MSDN
1 parent 8b3c62d commit 9a4a48d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,32 @@ jobs:
119119
steps:
120120
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
121121
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
122+
with:
123+
# Ensure that we cache from the right target directory. (See below
124+
# for the details of how and when this gets created.)
125+
workspaces: '. -> /mnt/target'
122126

123127
# Update `pg_dump` to the same version as the running PostgreSQL server
124128
- run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -v ${{ env.POSTGRES_VERSION }} -i -p
125129
- run: sudo systemctl start postgresql.service
126130
- run: sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres'"
127131

128-
- run: cargo build --tests --workspace
129-
- run: cargo test --workspace
132+
# Create a working directory on /mnt, which is a larger temporary
133+
# filesystem than /, that we can then point our later commands to.
134+
- run: |
135+
sudo mkdir /mnt/target
136+
sudo chown $(id -u):$(id -g) /mnt/target
137+
138+
- run: cargo build --tests --workspace --target-dir=/mnt/target
139+
- run: cargo test --workspace --target-dir=/mnt/target
130140

131141
- run: curl -sL https://github.com/mozilla/grcov/releases/download/v${{ env.GRCOV_VERSION }}/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar xjf -
132142
- run: rustup component add llvm-tools
133-
- run: ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" --ignore "target/debug/build/**" -o target/coverage.lcov
143+
- run: ./grcov . --binary-path /mnt/target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" --ignore "/mnt/target/debug/build/**" -o /mnt/target/coverage.lcov
134144

135145
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
136146
with:
137-
files: target/coverage.lcov
147+
files: /mnt/target/coverage.lcov
138148
env:
139149
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
140150

0 commit comments

Comments
 (0)