Skip to content

Commit f4419fb

Browse files
committed
ci/nix: don't force Nix shell on everyone + fix CI
1 parent 76cad2d commit f4419fb

File tree

5 files changed

+53
-42
lines changed

5 files changed

+53
-42
lines changed

.github/workflows/rust.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
features: builder,unstable
130130

131131
integrationtest:
132-
name: multiboot2 integrationtest
132+
name: integrationtest
133133
needs:
134134
- build_nightly
135135
- build_nostd_nightly
@@ -138,4 +138,11 @@ jobs:
138138
- name: Check out
139139
uses: actions/checkout@v3
140140
- uses: cachix/install-nix-action@v20
141-
- run: integration-test/run.sh
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+
- run: |
147+
cd integration-test
148+
nix-shell --run ./run.sh

integration-test/.run.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

integration-test/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ directory contains test definitions, run scripts, and other relevant files. The
1010
main entry to run all tests is `./run.sh` in this directory.
1111

1212
## TL;DR:
13-
- `$ ./run.sh` to execute the integration tests
13+
- `$ nix-shell --run ./run.sh` to execute the integration tests with Nix (recommended)
14+
- `$ ./run.sh` to execute the integration tests (you have to install dependencies manually)
1415

1516
## Prerequisites
16-
The tests rely on [`nix`](https://nixos.org/) being installed / `nix-shell`
17-
being available to get the relevant tools.
17+
The tests are executed best when using [`nix`](https://nixos.org/)/`nix-shell`
18+
to get the relevant tools. Otherwise, please make sure the following packages
19+
are available:
20+
- grub helper tools
21+
- rustup
22+
- QEMU
23+
- xorriso

integration-test/run.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
#!/usr/bin/env bash
22

3+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
4+
set -euo pipefail
5+
IFS=$'\n\t'
6+
37
DIR=$(dirname "$(realpath "$0")")
48
cd "$DIR" || exit
59

6-
# Helper script that runs the actual script in a Nix shell.
7-
nix-shell --run ./.run.sh
10+
function fn_main() {
11+
fn_build_rust_bins
12+
fn_multiboot2_integrationtest
13+
fn_multiboot2_header_integrationtest
14+
}
15+
16+
function fn_build_rust_bins() {
17+
cd "bins"
18+
cargo build --release
19+
cd "$DIR"
20+
}
21+
22+
function fn_multiboot2_integrationtest() {
23+
cd tests/multiboot2
24+
./build_img.sh
25+
./run_qemu.sh
26+
cd "$DIR"
27+
}
28+
29+
function fn_multiboot2_header_integrationtest() {
30+
cd tests/multiboot2-header
31+
./run_qemu.sh
32+
cd "$DIR"
33+
}
34+
35+
fn_main

integration-test/shell.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ pkgs.mkShell rec {
99
rustup
1010
xorriso
1111
];
12+
13+
# To invoke "nix-shell" in the CI-runner, we need a global Nix channel.
14+
# For better reproducibility inside the Nix shell, we override this channel
15+
# with the pinned nixpkgs version.
16+
NIX_PATH = "nixpkgs=${sources.nixpkgs}";
1217
}

0 commit comments

Comments
 (0)