Skip to content

Commit b0042a2

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

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/test-demo.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
sudo apt update
19+
sudo apt install --yes nix
20+
21+
# FIXME: Failing on
22+
# /usr/bin/bash -c nix-env --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
23+
# error: getting status of /nix/var/nix/daemon-socket/socket: Permission denied
24+
# Error: Action failed with error: Error: The process '/usr/bin/bash' failed with exit code 1
25+
# - uses: cachix/cachix-action@v14
26+
# with: { name: 'ngi' }
27+
28+
# TODO: enable overview build
29+
# - name: Build overview
30+
# run: nix build .#overview
31+
32+
# TODO: download this file from overview
33+
- name: Download default.nix file
34+
run: |
35+
cat <<EOF >default.nix
36+
{
37+
ngipkgs ?
38+
import
39+
(fetchTarball "https://github.com/eljamm/ngipkgs/tarball/init-project-demos/8eb7f038fd62fd6490e017d78e6a30e7b64a13fa")
40+
{ },
41+
}:
42+
let
43+
servicePort = 9000;
44+
domainName = "localhost:\${toString servicePort}";
45+
in
46+
ngipkgs.demo {
47+
services.cryptpad = {
48+
enable = true;
49+
settings = {
50+
httpPort = servicePort;
51+
httpAddress = "0.0.0.0";
52+
httpUnsafeOrigin = "http://\${domainName}";
53+
httpSafeOrigin = "http://\${domainName}";
54+
};
55+
};
56+
57+
networking.firewall.allowedTCPPorts = [ servicePort ];
58+
networking.firewall.allowedUDPPorts = [ servicePort ];
59+
}
60+
EOF
61+
62+
- name: Build VM
63+
run: nix-build default.nix
64+
65+
- name: Run VM
66+
run: ./result &
67+
68+
- name: Test application
69+
run: curl --retry 10 --fail localhost:9000 | grep CryptPad

0 commit comments

Comments
 (0)