Skip to content

Run a full integration test with a ZFS filesystem during build #82

Run a full integration test with a ZFS filesystem during build

Run a full integration test with a ZFS filesystem during build #82

Workflow file for this run

name: Build
on:
pull_request:
push:
workflow_call:
outputs:
artifact_name:
description: Name of the sanoid-portable artifact uploaded during the build.
value: ${{ jobs.build.outputs.artifact_name }}
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
outputs:
artifact_name: ${{ steps.set_artifact_name.outputs.artifact_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize build environment
run: ./init.sh
- name: Build sanoid-portable binary
run: |
# Build on Ubuntu
set -e
# Add a new binfmt entry that matches APE's (Actually Portable Executable)'s
# magic number to avoid execution by Ubuntu's built-in "MZ" binfmt
# interpreter which "helpfully" tries to run the binary with Wine.
sudo apt install -y binfmt-support
sudo update-binfmts --install APE /bin/sh --magic MZqFpD
./build.sh
- name: Set artifact name
id: set_artifact_name
run: echo "artifact_name=sanoid-portable.${{ github.sha }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Upload built sanoid-portable artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set_artifact_name.outputs.artifact_name }}
path: output/sanoid-portable
if-no-files-found: error
retention-days: 1
test:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download sanoid-portable artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
- name: Test on Ubuntu
run: |
# Test on Ubuntu
set -e
# Add a new binfmt entry that matches APE's (Actually Portable Executable)'s
# magic number to avoid execution by Ubuntu's built-in "MZ" binfmt
# interpreter which "helpfully" tries to run the binary with Wine.
sudo apt install -y binfmt-support
sudo update-binfmts --install APE /bin/sh --magic MZqFpD
./test-smoke.sh
- name: Test in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y bash jq
run: |
set -e
echo 'Begin smoke tests...'
./test-smoke.sh
echo 'Completed smoke tests.'
echo ''
echo 'Begin integration tests...'
./test-integration.sh
echo 'Completed integration tests.'