-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (87 loc) · 2.51 KB
/
trivial-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Trivial Test
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '**'
- '!**/README*'
push:
branches: [main]
paths:
- '**'
- '!**/README*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Install flox
uses: flox/[email protected]
- name: Checkout
uses: actions/checkout@v3
- name: Make Injector
shell: bash
run: |
set -eu;
set -o pipefail;
mkdir ./bin;
echo '#! /usr/bin/env bash
cat "$PWD/flox.nix" > "$1";' > ./bin/flox-inject;
chmod +x ./bin/flox-inject;
- name: SQLite3 pkg-config Test
shell: bash
run: |
set -eu;
set -o pipefail;
_ec=0;
trap '_ec="$?"; echo "ERROR: code $_ec" >&2; exit "$_ec";' HUP TERM INT;
echo "Creating sqlite-dev" >&2;
flox create -e sqlite-dev;
trap '
_ec="$?";
echo "ERROR: code $_ec" >&2;
flox destroy -e sqlite-dev;
exit "$_ec";
' HUP TERM INT;
trap '_ec="$?"; flox destroy -e sqlite-dev; exit "$_ec";' EXIT;
echo "Creating flox.nix" >&2;
cat <<'EOF' > ./flox.nix
{
packages.nixpkgs-flox.sqlite = {
meta.outputsToInstall = ["bin" "out" "dev"];
};
shell.hook = ''
[[ -r "$FLOX_ENV/etc/profile" ]] && . "$FLOX_ENV/etc/profile";
'';
}
EOF
echo "flox.nix contents:" >&2;
echo "---" >&2;
cat ./flox.nix >&2;
echo "---" >&2;
echo "Inject flox.nix" >&2;
EDITOR="$PWD/bin/flox-inject" flox edit -e sqlite-dev;
rm -f ./flox.nix;
echo "Installing deps" >&2;
flox install -e sqlite-dev pkg-config;
flox install -e sqlite-dev "$PWD#etc-profiles";
# Have to work around a bunch of unset variables that get us killed
# when `set -eu; set -o pipefail;' is active.
runEnv() { flox activate -e sqlite-dev -- "$@"; }
echo "Activating env" >&2;
runEnv :;
echo "Checking if pkg-config can find sqlite" >&2;
if runEnv pkg-config --list-all|grep '^sqlite3';
then
echo "PASS" >&2;
exit 0;
else
echo "FAIL" >&2;
echo "pkg-config --list results:" >&2;
echo "---" >&2;
runEnv pkg-config --list-all >&2;
echo "---" >&2;
exit 1;
fi