Skip to content

Commit a608579

Browse files
committed
Untested scripts
1 parent 2431a02 commit a608579

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
22
.direnv
3+
result

ci/vulcan/test.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
if [ $# -ne 1 ]; then
4+
echo Expected one argument for the commit hash
5+
exit 1
6+
fi
7+
8+
HASH=$1
9+
10+
# Set up the testing directory in tmpfs
11+
12+
CI_PATH=/dev/shm/"$HASH"-webring-ci
13+
14+
# Prevent other users from deleting/modifying our directory
15+
mkdir $CI_PATH --mode=700
16+
17+
# Defer cleanup until after this script has finished
18+
# SCRIPT_PID=$$
19+
# bash -e "wait $SCRIPT_PID; rm -r $CI_PATH" &
20+
# disown
21+
22+
# Checkout the commit into the testing directory
23+
# Use `--work-tree` to copy the code into the testing directory instead of the deployment directory. This doesn't copy `.git`.
24+
mkdir $CI_PATH/webring
25+
git fetch --all || exit 1
26+
git --work-tree $CI_PATH/webring checkout $HASH || exit 1
27+
28+
# Build the flake
29+
AT=$(pwd)
30+
cd $CI_PATH
31+
nix build || exit 1
32+
33+
# Sandbox the webring and run it
34+
# The webring will only see its own source code and have rw access to it
35+
timeout -k 10s -s 9 bwrap -- \
36+
--bind $CI_PATH / --unshare-user --uid 256 --gid 512 ./result/bin/ph-webring
37+
STATUS=$?
38+
39+
cd $AT
40+
41+
if [ $STATUS -ne 137 ]; then
42+
exit 0
43+
fi
44+
exit $STATUS

flake.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222

2323
src = ./.;
2424

25-
nativeBuildInputs = [ pkgconfig, pkgs.openssl.dev ];
26-
cargoSha256 = "";
25+
nativeBuildInputs = [ pkgs.pkg-config pkgs.openssl.dev ];
26+
cargoHash = "sha256-oIm9GcOEgBvE8KahtNQwquX0Miir0uxr3Z5rMXKduTY=";
2727

28-
meta = with stdenv.lib; {
28+
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
29+
30+
meta = with pkgs.lib; {
2931
homepage = cargo.package.homepage;
3032
description = cargo.package.description;
3133
# TODO: Change

0 commit comments

Comments
 (0)