Skip to content

Commit d6e8a32

Browse files
committed
ci: add test-demo workflow
1 parent e7dd2a3 commit d6e8a32

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/test-demo.yaml

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

0 commit comments

Comments
 (0)