Skip to content

Commit 05cd98d

Browse files
authored
Merge pull request #161 from rust-osdev/ci
ci: integrationtest: use magic nix cache
2 parents 557a681 + 96e43ca commit 05cd98d

File tree

3 files changed

+50
-35
lines changed

3 files changed

+50
-35
lines changed

.github/workflows/integrationtest.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# CI for the whole Cargo workspace. Although having two relatively independent
2+
# crates in this workspace (as they do not get released together, as for example
3+
# tokio with its sub crates), a PR for a certain CI may report errors in the
4+
# other workspace members. I think this is unfortunate. I've experimented with
5+
# CI runs per workspace member but the complexity in the end was not worth it.
6+
# Instead, it is the right thing that the CI always covers the whole repository
7+
# and that it is as stable as possible.
8+
9+
name: "Cargo workspace"
10+
11+
# Run on every push (tag, branch) and pull_request
12+
on: [pull_request, push, workflow_dispatch]
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
integrationtest:
19+
name: integrationtest
20+
# No "needs" to make CI faster.
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out
24+
uses: actions/checkout@v3
25+
- uses: cachix/install-nix-action@v20
26+
with:
27+
# This channel is only required to invoke "nix-shell".
28+
# Everything inside that nix-shell will use a pinned version of
29+
# nixpkgs.
30+
nix_path: nixpkgs=channel:nixos-23.05
31+
- uses: DeterminateSystems/magic-nix-cache-action@main
32+
- name: Set up cargo cache
33+
uses: actions/cache@v3
34+
continue-on-error: false
35+
with:
36+
path: |
37+
~/.cargo/bin/
38+
~/.cargo/registry/index/
39+
~/.cargo/registry/cache/
40+
~/.cargo/git/db/
41+
integration-test/bins/target/
42+
# Hash over Cargo.toml and Cargo.lock, as this might be copied to
43+
# projects that do not have a Cargo.lock in their repository tree!
44+
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }}
45+
# Have all the "copying into Nix store" messages in a dedicated step for
46+
# better log visibility.
47+
- run: cd integration-test && nix-shell --run "echo OK" && cd ..
48+
# Now, run the actual test.
49+
- run: cd integration-test && nix-shell --run ./run.sh && cd ..

.github/workflows/rust.yml

-34
Original file line numberDiff line numberDiff line change
@@ -128,40 +128,6 @@ jobs:
128128
do-test: false
129129
features: builder,unstable
130130

131-
integrationtest:
132-
name: integrationtest
133-
needs:
134-
- build_nightly
135-
- build_nostd_nightly
136-
runs-on: ubuntu-latest
137-
steps:
138-
- name: Check out
139-
uses: actions/checkout@v3
140-
- uses: cachix/install-nix-action@v20
141-
with:
142-
# This channel is only required to invoke "nix-shell".
143-
# Everything inside that nix-shell will use a pinned version of
144-
# nixpkgs.
145-
nix_path: nixpkgs=channel:nixos-23.05
146-
- name: Set up cargo cache
147-
uses: actions/cache@v3
148-
continue-on-error: false
149-
with:
150-
path: |
151-
~/.cargo/bin/
152-
~/.cargo/registry/index/
153-
~/.cargo/registry/cache/
154-
~/.cargo/git/db/
155-
integration-test/bins/target/
156-
# Hash over Cargo.toml and Cargo.lock, as this might be copied to
157-
# projects that do not have a Cargo.lock in their repository tree!
158-
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }}
159-
# Have all the "copying into Nix store" messages in a dedicated step for
160-
# better log visibility.
161-
- run: cd integration-test && nix-shell --run "echo OK" && cd ..
162-
# Now, run the actual test.
163-
- run: cd integration-test && nix-shell --run ./run.sh && cd ..
164-
165131
miri:
166132
name: tests with miri (nightly)
167133
needs: build_nightly

integration-test/bins/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)