selfhostblocks/.github/workflows/test.yml
2023-12-27 01:05:19 -08:00

60 lines
1.8 KiB
YAML

name: "Test"
on:
pull_request:
push:
branches: [ "main" ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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@v12
with:
name: selfhostblocks
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Test demos
run: |
set -x
cd ./demo/nextcloud/
nix run nixpkgs#nixos-rebuild -- build-vm --fast -I nixos-config=./configuration.nix -I nixpkgs=.
QEMU_OPTS="-nographic" QEMU_NET_OPTS="hostfwd=tcp::2222-:2222,hostfwd=tcp::8080-:80" ./result/bin/run-nixos-vm &
AGE_KEY=
while [ -z "$AGE_KEY" ]; do
sleep 1
AGE_KEY=$(nix shell nixpkgs#ssh-to-age --command sh -c 'ssh-keyscan -p 2222 -t ed25519 -4 localhost 2>/dev/null | ssh-to-age')
done
ls
SOPS_AGE_KEY_FILE=keys.txt \
nix run --impure nixpkgs#sops -- --config sops.yaml -r -i \
--add-age $AGE_KEY \
secrets.yaml
chmod 600 sshkey
SSH_CONFIG_FILE=ssh_config nix run nixpkgs#colmena --impure -- apply
- name: Run tests
run: |
nix run github:Mic92/nix-fast-build -- \
--skip-cached --no-nom \
--flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"
- name: Test building docs
run: |
nix \
--print-build-logs \
--option keep-going true \
--show-trace \
build .#manualHtml