Skip to content

Commit fc67fe6

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

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/test-demo.yaml

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

0 commit comments

Comments
 (0)