2024-01-28 23:18:25 +01:00
|
|
|
name: "Demo"
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
|
|
# We're just checking if the demo start without hiccup.
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
demo:
|
|
|
|
- homeassistant#basic
|
|
|
|
- homeassistant#ldap
|
|
|
|
- nextcloud#basic
|
|
|
|
- nextcloud#ldap
|
|
|
|
- nextcloud#sso
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Nix
|
|
|
|
uses: DeterminateSystems/nix-installer-action@main
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
|
|
|
|
- name: Setup Caching
|
|
|
|
uses: cachix/cachix-action@v14
|
|
|
|
with:
|
|
|
|
name: selfhostblocks
|
|
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
|
|
- name: Test demos
|
|
|
|
# See https://blog.stefan-koch.name/2020/12/10/qemu-guest-graceful-shutdown-from-python for
|
|
|
|
# inspiration.
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
|
|
|
rm -f nixos.qcow2
|
|
|
|
nix run nixpkgs#nixos-rebuild -- build-vm --flake ./demo/${{ matrix.demo }}
|
|
|
|
QEMU_NET_OPTS="hostfwd=tcp::8080-:80" ./result/bin/run-nixos-vm -nographic -qmp unix:/tmp/qmp-sock,server,nowait &
|
|
|
|
|
|
|
|
nix run nixpkgs#socat -- - unix-connect:/tmp/qmp-sock <<EOF
|
|
|
|
{"execute": "qmp_capabilities"}
|
|
|
|
{"execute": "system_powerdown"}
|
|
|
|
EOF
|
2024-02-03 00:42:24 +01:00
|
|
|
|
|
|
|
# Needed to get a status check for matrix jobs
|
|
|
|
# From https://github.com/orgs/community/discussions/26822
|
|
|
|
results:
|
|
|
|
if: ${{ always() }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Final Results
|
|
|
|
needs: [ test ]
|
|
|
|
steps:
|
|
|
|
- run: exit 1
|
|
|
|
# see https://stackoverflow.com/a/67532120/4907315
|
|
|
|
if: >-
|
|
|
|
${{
|
|
|
|
contains(needs.*.result, 'failure')
|
|
|
|
|| contains(needs.*.result, 'cancelled')
|
|
|
|
|| contains(needs.*.result, 'skipped')
|
|
|
|
}}
|