Skip to content

Commit db68f39

Browse files
committed
CI: Extract CARGO_TARGET_DIR env var
1 parent 9a4a48d commit db68f39

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ jobs:
115115
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/postgres
116116
RUSTFLAGS: "-D warnings -Cinstrument-coverage"
117117
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"
118+
CARGO_TARGET_DIR: /mnt/target
118119

119120
steps:
120121
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
121122
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
122123
with:
123124
# Ensure that we cache from the right target directory. (See below
124125
# for the details of how and when this gets created.)
125-
workspaces: '. -> /mnt/target'
126+
workspaces: '. -> ${{ env.CARGO_TARGET_DIR }}'
126127

127128
# Update `pg_dump` to the same version as the running PostgreSQL server
128129
- run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -v ${{ env.POSTGRES_VERSION }} -i -p
@@ -132,19 +133,19 @@ jobs:
132133
# Create a working directory on /mnt, which is a larger temporary
133134
# filesystem than /, that we can then point our later commands to.
134135
- run: |
135-
sudo mkdir /mnt/target
136-
sudo chown $(id -u):$(id -g) /mnt/target
136+
sudo mkdir ${{ env.CARGO_TARGET_DIR }}
137+
sudo chown $(id -u):$(id -g) ${{ env.CARGO_TARGET_DIR }}
137138
138-
- run: cargo build --tests --workspace --target-dir=/mnt/target
139-
- run: cargo test --workspace --target-dir=/mnt/target
139+
- run: cargo build --tests --workspace
140+
- run: cargo test --workspace
140141

141142
- run: curl -sL https://github.com/mozilla/grcov/releases/download/v${{ env.GRCOV_VERSION }}/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar xjf -
142143
- run: rustup component add llvm-tools
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
144+
- run: ./grcov . --binary-path ${{ env.CARGO_TARGET_DIR }}/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" --ignore "${{ env.CARGO_TARGET_DIR }}/debug/build/**" -o ${{ env.CARGO_TARGET_DIR }}/coverage.lcov
144145

145146
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
146147
with:
147-
files: /mnt/target/coverage.lcov
148+
files: ${{ env.CARGO_TARGET_DIR }}/coverage.lcov
148149
env:
149150
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
150151

0 commit comments

Comments
 (0)