Skip to content

Commit a904153

Browse files
committed
ci: add test-demo workflow
Closes: ngi-nix#698
1 parent e7dd2a3 commit a904153

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/test-demo.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Test VM demo
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: 'actions/checkout@v4'
15+
- uses: DeterminateSystems/nix-installer-action@v16
16+
- uses: cachix/cachix-action@v14
17+
with: { name: 'ngi' }
18+
19+
- name: Build overview
20+
run: nix build .#overview
21+
22+
# FIXME: download this file from overview
23+
- name: Download default.nix file
24+
run: >
25+
cat <<EOF >default.nix
26+
{
27+
ngipkgs ?
28+
import
29+
(fetchTarball "https://github.com/eljamm/ngipkgs/tarball/init-project-demos/8eb7f038fd62fd6490e017d78e6a30e7b64a13fa")
30+
{ },
31+
}:
32+
let
33+
servicePort = 9000;
34+
domainName = "localhost:\${toString servicePort}";
35+
in
36+
ngipkgs.demo {
37+
services.cryptpad = {
38+
enable = true;
39+
settings = {
40+
httpPort = servicePort;
41+
httpAddress = "0.0.0.0";
42+
httpUnsafeOrigin = "http://\${domainName}";
43+
httpSafeOrigin = "http://\${domainName}";
44+
};
45+
};
46+
47+
networking.firewall.allowedTCPPorts = [ servicePort ];
48+
networking.firewall.allowedUDPPorts = [ servicePort ];
49+
}
50+
EOF
51+
52+
- name: Build VM
53+
run: nix-build default.nix
54+
55+
- name: Run VM
56+
run: ./result &
57+
58+
- name: Test application
59+
run: curl --retry 10 --fail localhost:9000 | grep CryptPad

0 commit comments

Comments
 (0)