Init workflow action: build and test
This commit is contained in:
81
.gitea/workflows/build-test.yaml
Normal file
81
.gitea/workflows/build-test.yaml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user