Skip to content

Commit

Permalink
ci: improve caching of build artifacts (#41)
Browse files Browse the repository at this point in the history
* ci: add `--target` to `cargo test`

I noticed in GH Action output that `cargo test` is compiling our
dependencies again. Maybe it is not correctly reusing the cache?

In this commit, I am adding `--target` flag to `cargo test`, using
the same value that was provided to `cargo build` which is producing
the build artifacts saved to the cache.

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>

* ci: build all targets (bins, libs, tests, etc.)

I noticed in GH Action output that `cargo test` is compiling our
dependencies again. Maybe the build step did not compile everything
that's needed by our tests?

In this commit, I am adding `--all-targets` flag to `cargo build`,
hoping that the subsequent `cargo test` will not need to compile
anything.

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>

---------

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
  • Loading branch information
bajtos authored Feb 13, 2023
1 parent 5d80633 commit a2361da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# save-if: ${{ github.ref == 'refs/heads/main' }}


- run: cargo build --workspace --all-features --target=${{ matrix.target }}
- run: cargo build --workspace --all-features --all-targets --target=${{ matrix.target }}

test:
name: Test ${{ matrix.crate }}
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
save-if: false

- name: Run all tests
run: cargo test --package ${{ matrix.crate }} --all-features
run: cargo test --package ${{ matrix.crate }} --all-features --target=${{ matrix.target }}

# - name: Check if we compile without any features activated
# run: cargo build --package ${{ matrix.crate }} --no-default-features
Expand Down

0 comments on commit a2361da

Please sign in to comment.