move CI to garnix (#210)
This commit is contained in:
parent
f8636e28dc
commit
c75daa23c0
17 changed files with 109 additions and 136 deletions
61
.github/workflows/demo.yml
vendored
61
.github/workflows/demo.yml
vendored
|
@ -1,61 +0,0 @@
|
|||
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
|
||||
|
||||
# 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')
|
||||
}}
|
26
.github/workflows/docs.yml
vendored
26
.github/workflows/docs.yml
vendored
|
@ -1,26 +0,0 @@
|
|||
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
|
20
.github/workflows/garnix.yaml
vendored
Normal file
20
.github/workflows/garnix.yaml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: "Final Results"
|
||||
|
||||
on:
|
||||
check_suite:
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
results:
|
||||
name: Final Results
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo
|
||||
- run: exit 1
|
||||
# see https://stackoverflow.com/a/67532120/4907315
|
||||
if: >-
|
||||
${{
|
||||
contains(needs.*.result, 'failure')
|
||||
|| contains(needs.*.result, 'cancelled')
|
||||
|| contains(needs.*.result, 'skipped')
|
||||
}}
|
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
@ -1,27 +0,0 @@
|
|||
name: "Test"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
jobs:
|
||||
tests:
|
||||
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: Run tests
|
||||
run: |
|
||||
nix run github:Mic92/nix-fast-build -- \
|
||||
--skip-cached --no-nom \
|
||||
--max-jobs 1 \
|
||||
--flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"
|
|
@ -5,6 +5,7 @@
|
|||
[![Tests](https://github.com/ibizaman/selfhostblocks/actions/workflows/test.yml/badge.svg)](https://github.com/ibizaman/selfhostblocks/actions/workflows/test.yml)
|
||||
[![Demo](https://github.com/ibizaman/selfhostblocks/actions/workflows/demo.yml/badge.svg)](https://github.com/ibizaman/selfhostblocks/actions/workflows/demo.yml)
|
||||
[![Documentation](https://github.com/ibizaman/selfhostblocks/actions/workflows/docs.yml/badge.svg)](https://github.com/ibizaman/selfhostblocks/actions/workflows/docs.yml)
|
||||
[![Tests](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Fibizaman%2Fselfhostblocks)](https://garnix.io) (using Garnix)
|
||||
|
||||
SHB's (Self Host Blocks) is yet another server management tool whose goal is to provide a lower
|
||||
entry-bar for self-hosting. SHB provides opinionated [building blocks](#available-blocks) fitting
|
||||
|
|
|
@ -608,7 +608,7 @@ in
|
|||
|
||||
environment.systemPackages = [
|
||||
# Needed for a few apps. Would be nice to avoid having to put that in the environment and instead override https://github.com/NixOS/nixpkgs/blob/261abe8a44a7e8392598d038d2e01f7b33cf26d0/nixos/modules/services/web-apps/nextcloud.nix#L1035
|
||||
pkgs.ffmpeg
|
||||
pkgs.ffmpeg-headless
|
||||
|
||||
# Needed for the recognize app.
|
||||
pkgs.nodejs
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
# TODO: Test login
|
||||
commonTestScript = appname: { nodes, ... }:
|
||||
let
|
||||
|
@ -44,7 +45,7 @@ let
|
|||
raise Exception(f"Code is {response['code']}")
|
||||
'';
|
||||
|
||||
basic = appname: pkgs.nixosTest {
|
||||
basic = appname: pkgs.testers.runNixOSTest {
|
||||
name = "arr-${appname}-basic";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
|
@ -58,6 +59,8 @@ let
|
|||
../../modules/blocks/postgresql.nix
|
||||
../../modules/blocks/nginx.nix
|
||||
../../modules/services/arr.nix
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
shb.arr.${appname} = {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
|
||||
# TODO: Test login
|
||||
commonTestScript = { nodes, ... }:
|
||||
let
|
||||
|
@ -38,11 +40,13 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
basic = pkgs.nixosTest {
|
||||
basic = pkgs.testers.runNixOSTest {
|
||||
name = "audiobookshelf-basic";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -66,11 +70,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
cert = pkgs.nixosTest {
|
||||
cert = pkgs.testers.runNixOSTest {
|
||||
name = "audiobookshelf-cert";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -115,11 +121,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
sso = pkgs.nixosTest {
|
||||
sso = pkgs.testers.runNixOSTest {
|
||||
name = "audiobookshelf-sso";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
|
||||
ldapAdminPassword = "ldapAdminPassword";
|
||||
in
|
||||
{
|
||||
basic = pkgs.nixosTest {
|
||||
basic = pkgs.testers.runNixOSTest {
|
||||
name = "authelia-basic";
|
||||
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
|
||||
# TODO: Test login
|
||||
commonTestScript = { nodes, ... }:
|
||||
let
|
||||
|
@ -38,11 +40,13 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
basic = pkgs.nixosTest {
|
||||
basic = pkgs.testers.runNixOSTest {
|
||||
name = "grocy-basic";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -65,11 +69,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
cert = pkgs.nixosTest {
|
||||
cert = pkgs.testers.runNixOSTest {
|
||||
name = "grocy-cert";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
|
||||
# TODO: Test login
|
||||
commonTestScript = { nodes, ... }:
|
||||
let
|
||||
|
@ -38,11 +40,13 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
basic = pkgs.nixosTest {
|
||||
basic = pkgs.testers.runNixOSTest {
|
||||
name = "jellyfin-basic";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -66,11 +70,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
ldap = pkgs.nixosTest {
|
||||
ldap = pkgs.testers.runNixOSTest {
|
||||
name = "jellyfin-ldap";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -114,11 +120,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
cert = pkgs.nixosTest {
|
||||
cert = pkgs.testers.runNixOSTest {
|
||||
name = "jellyfin_cert";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -164,11 +172,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
sso = pkgs.nixosTest {
|
||||
sso = pkgs.testers.runNixOSTest {
|
||||
name = "jellyfin_sso";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
in
|
||||
{
|
||||
auth = pkgs.nixosTest {
|
||||
auth = pkgs.testers.runNixOSTest {
|
||||
name = "ldap-auth";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.ssl.enable = lib.mkEnableOption "ssl";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
|
||||
shblib = pkgs.callPackage ../../lib {};
|
||||
in
|
||||
{
|
||||
|
@ -40,11 +42,13 @@ in
|
|||
generator = lib.generators.toJSON {};
|
||||
};
|
||||
in
|
||||
pkgs.nixosTest {
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "lib-template";
|
||||
nodes.machine = { config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
libtest.config = lib.mkOption {
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
in
|
||||
{
|
||||
# This test, although simple, makes sure all provisioning went fine.
|
||||
auth = pkgs.nixosTest {
|
||||
auth = pkgs.testers.runNixOSTest {
|
||||
name = "monitoring-basic";
|
||||
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.ssl.enable = lib.mkEnableOption "ssl";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
adminUser = "root";
|
||||
adminPass = "rootpw";
|
||||
|
||||
|
@ -124,11 +125,13 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
basic = pkgs.nixosTest {
|
||||
basic = pkgs.testers.runNixOSTest {
|
||||
name = "nextcloud-basic";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
@ -164,11 +167,13 @@ in
|
|||
testScript = commonTestScript;
|
||||
};
|
||||
|
||||
cert = pkgs.nixosTest {
|
||||
cert = pkgs.testers.runNixOSTest {
|
||||
name = "nextcloud-cert";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
{
|
||||
options = {
|
||||
shb.backup = lib.mkOption { type = lib.types.anything; };
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
in
|
||||
{
|
||||
peerWithoutUser = pkgs.nixosTest {
|
||||
peerWithoutUser = pkgs.testers.runNixOSTest {
|
||||
name = "postgresql-peerWithoutUser";
|
||||
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
../../modules/blocks/postgresql.nix
|
||||
];
|
||||
|
||||
|
@ -35,11 +40,13 @@
|
|||
'';
|
||||
};
|
||||
|
||||
peerAuth = pkgs.nixosTest {
|
||||
peerAuth = pkgs.testers.runNixOSTest {
|
||||
name = "postgresql-peerAuth";
|
||||
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
../../modules/blocks/postgresql.nix
|
||||
];
|
||||
|
||||
|
@ -83,11 +90,13 @@
|
|||
'';
|
||||
};
|
||||
|
||||
tcpIPWithoutPasswordAuth = pkgs.nixosTest {
|
||||
tcpIPWithoutPasswordAuth = pkgs.testers.runNixOSTest {
|
||||
name = "postgresql-tcpIpWithoutPasswordAuth";
|
||||
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
../../modules/blocks/postgresql.nix
|
||||
];
|
||||
|
||||
|
@ -119,11 +128,13 @@
|
|||
'';
|
||||
};
|
||||
|
||||
tcpIPPasswordAuth = pkgs.nixosTest {
|
||||
tcpIPPasswordAuth = pkgs.testers.runNixOSTest {
|
||||
name = "postgresql-tcpIPPasswordAuth";
|
||||
|
||||
nodes.machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
../../modules/blocks/postgresql.nix
|
||||
];
|
||||
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = pkgs;
|
||||
in
|
||||
{
|
||||
test = pkgs.nixosTest {
|
||||
test = pkgs.testers.runNixOSTest {
|
||||
name = "ssl-test";
|
||||
|
||||
nodes.server = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
|
||||
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
|
||||
../../modules/blocks/ssl.nix
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue