From 860cf13bb452d90d604d8e64e8199fe3927d29fa Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sat, 7 Feb 2026 18:41:54 +0100 Subject: [PATCH] Init workflow action: build and test --- .gitea/workflows/build-test.yaml | 81 ++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .gitea/workflows/build-test.yaml diff --git a/.gitea/workflows/build-test.yaml b/.gitea/workflows/build-test.yaml new file mode 100644 index 0000000..95e8c5e --- /dev/null +++ b/.gitea/workflows/build-test.yaml @@ -0,0 +1,81 @@ +name: Build and test +run-name: Build and test ${{ gitea.repository }} @ ${{ gitea.sha }} by ${{ gitea.actor }} +on: + push: + branches: + - main + +jobs: + build: + runs-on: debian-latest + steps: + - name: Debug output + run: | + echo "PVV-DNS build triggered by a ${{ gitea.event_name }} event" + echo "Building ${{ gitea.repository }} on ref ${{ gitea.ref }}" + + - name: Install sudo + run: apt-get install --update --assume-yes sudo + + - name: Install nix + uses: https://github.com/cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Build zonefiles + run: nix build .#zoneFiles + + - name: Build nsd-config + run: nix build .#nsdConfig + + - name: Build default + run: nix build --out-link /tmp/result .# + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: build-output + path: /tmp/result + if-no-files-found: error + + test: + runs-on: debian-latest + needs: build + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: build-output + path: /tmp/result + + - name: Install sudo + run: apt-get install --update --assume-yes sudo + + - name: Install nsd + run: sudo apt-get install --update -y nsd + + - name: Check configuration file + run: | + echo "Checking nsd configuration file" + nsd-checkconf /tmp/result/etc/nsd/nsd.conf && echo "/tmp/result/etc/nsd/nsd.conf is ok" + + - name: Check zonefiles + run: | + declare -a domains=( + "128-255.210.241.129.in-addr.arpa" + "210.241.129.in-addr.arpa" + "9.1.0.0.3.0.0.0.7.0.1.0.0.2.ip6.arpa" + "nucc.org" + "pvv.no" + "pvv.ntnu.no" + "pvv.org" + ) + for domain in "${domains[@]}" + do + echo "Checking domain '$domain'" + nsd-checkzone "$domain" "/tmp/result/zones/${domain}.zone" + done