From 9128300e036384735ee8966e828d4779a826e257 Mon Sep 17 00:00:00 2001
From: ibizaman <ibizapeanut@gmail.com>
Date: Sun, 28 Jan 2024 14:18:25 -0800
Subject: [PATCH] split CI jobs

---
 .github/workflows/demo.yml | 44 +++++++++++++++++++++++++++
 .github/workflows/docs.yml | 26 ++++++++++++++++
 .github/workflows/test.yml | 62 --------------------------------------
 3 files changed, 70 insertions(+), 62 deletions(-)
 create mode 100644 .github/workflows/demo.yml
 create mode 100644 .github/workflows/docs.yml

diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml
new file mode 100644
index 0000000..b982ba7
--- /dev/null
+++ b/.github/workflows/demo.yml
@@ -0,0 +1,44 @@
+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
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..3542141
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,26 @@
+name: "Documentation"
+on:
+  pull_request:
+jobs:
+  gen:
+    runs-on: ubuntu-latest
+    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 building docs
+        run: |
+          nix \
+            --print-build-logs \
+            --option keep-going true \
+            --show-trace \
+            build .#manualHtml
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 56fe488..570f122 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -24,65 +24,3 @@ jobs:
           nix run github:Mic92/nix-fast-build -- \
             --skip-cached --no-nom \
             --flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"
-
-  # We're just checking if the demo start without hiccup.
-  demos:
-    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
-
-  docs:
-    runs-on: ubuntu-latest
-    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 building docs
-        run: |
-          nix \
-            --print-build-logs \
-            --option keep-going true \
-            --show-trace \
-            build .#manualHtml