Skip to content

Commit 837969d

Browse files
phip1611nicholasbishop
authored andcommitted
ci: introduce new developer_productivity.yml
The new CI step tests the Nix toolchain
1 parent f34bc48 commit 837969d

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Developer Productivity
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
# Job to run change detection
9+
changes:
10+
runs-on: ubuntu-latest
11+
# Set job outputs to values from filter step.
12+
outputs:
13+
nix-src: ${{ steps.filter.outputs.nix-src }}
14+
steps:
15+
- uses: dorny/paths-filter@v2
16+
id: filter
17+
with:
18+
filters: |
19+
nix-src:
20+
- 'nix/**'
21+
- 'shell.nix'
22+
23+
# This is a convenience test to verify that the toolchain provided by
24+
# shell.nix is valid and can build + run the integration test.
25+
#
26+
# It only runs if the "nix-src" output of the "changes" job is true.
27+
nix_shell_toolchain:
28+
name: "Nix toolchain: cargo xtask run works"
29+
needs: changes
30+
if: ${{ needs.changes.outputs.nix-src == 'true' }}
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout sources
34+
uses: actions/checkout@v3
35+
- uses: Swatinem/rust-cache@v2
36+
- uses: cachix/install-nix-action@v20
37+
with:
38+
# This channel is only required to invoke "nix-shell".
39+
# Everything inside that nix-shell will use a pinned version of nixpkgs.
40+
nix_path: nixpkgs=channel:nixos-23.05
41+
# Dedicated step to separate all the
42+
# "copying path '/nix/store/...' from 'https://cache.nixos.org'."
43+
# messages from the actual build output. This job takes ~60secs.
44+
- name: Prepare Nix Store
45+
run: nix-shell --pure --run "cargo --version"
46+
- name: Run VM tests
47+
run: |
48+
COMMAND="cargo +stable xtask run --target x86_64 --headless --ci --tpm=v1"
49+
echo "Executing in nix shell now: $COMMAND"
50+
nix-shell --pure --run "$COMMAND"

shell.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
, pkgs ? import sources.nixpkgs { }
77
}:
88

9-
pkgs.mkShell rec {
9+
pkgs.mkShell {
1010
nativeBuildInputs = with pkgs; [
1111
# nix related stuff (such as dependency management)
1212
niv
1313
nixpkgs-fmt
1414

15-
rustup
15+
# Integration test dependencies
16+
swtpm
1617
qemu
17-
];
1818

19-
buildInputs = with pkgs; [
19+
# Rust toolchain
20+
rustup
2021
];
2122

2223
# Set ENV vars.

0 commit comments

Comments
 (0)