Skip to content

Commit 2ff99a5

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

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/test-demo.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
# FIXME: enable overview build
20+
# - name: Build overview
21+
# run: nix build .#overview
22+
23+
# FIXME: download this file from overview
24+
- name: Download default.nix file
25+
run: |
26+
cat <<EOF >default.nix
27+
{
28+
ngipkgs ?
29+
import
30+
(fetchTarball "https://github.com/eljamm/ngipkgs/tarball/init-project-demos/8eb7f038fd62fd6490e017d78e6a30e7b64a13fa")
31+
{ },
32+
}:
33+
let
34+
servicePort = 9000;
35+
domainName = "localhost:\${toString servicePort}";
36+
in
37+
ngipkgs.demo {
38+
services.cryptpad = {
39+
enable = true;
40+
settings = {
41+
httpPort = servicePort;
42+
httpAddress = "0.0.0.0";
43+
httpUnsafeOrigin = "http://\${domainName}";
44+
httpSafeOrigin = "http://\${domainName}";
45+
};
46+
};
47+
48+
networking.firewall.allowedTCPPorts = [ servicePort ];
49+
networking.firewall.allowedUDPPorts = [ servicePort ];
50+
}
51+
EOF
52+
53+
- name: Build VM
54+
run: nix-build default.nix
55+
56+
- name: Run VM
57+
run: ./result &
58+
59+
- name: Test application
60+
run: curl --retry 10 --fail localhost:9000 | grep CryptPad

0 commit comments

Comments
 (0)