2024-06-29 15:20:08 +00:00
|
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
# Controls when the workflow will run
|
|
|
|
on:
|
|
|
|
# Triggers the workflow on push or pull request events for any branch
|
|
|
|
push:
|
2024-07-08 15:59:39 +00:00
|
|
|
branches: ["**"]
|
2024-06-29 15:20:08 +00:00
|
|
|
pull_request:
|
2024-07-08 15:59:39 +00:00
|
|
|
branches: ["**"]
|
2024-06-29 15:20:08 +00:00
|
|
|
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
|
|
jobs:
|
|
|
|
# This workflow contains a single job called "build"
|
2024-07-08 15:59:39 +00:00
|
|
|
test:
|
2024-06-29 15:20:08 +00:00
|
|
|
# The type of runner that the job will run on
|
|
|
|
runs-on: ubuntu-24.04
|
|
|
|
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
|
|
steps:
|
|
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
|
|
- uses: actions/checkout@v4
|
2024-07-16 14:46:15 +00:00
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
with:
|
|
|
|
python-version: '3.11' # TrueNAS SCALE 24.04 Dragonfish
|
2024-07-08 15:59:39 +00:00
|
|
|
- name: Tune GitHub-hosted runner network
|
|
|
|
uses: smorimoto/tune-github-hosted-runner-network@v1
|
|
|
|
|
|
|
|
# Create a network namespace in the GitHub-hosted runner VM,
|
|
|
|
# simulating a primary bridge network on TrueNAS SCALE
|
2024-07-16 14:17:40 +00:00
|
|
|
- name: Install packages and setup networking
|
2024-07-08 15:59:39 +00:00
|
|
|
run: |
|
|
|
|
sudo -s <<END
|
2024-07-16 14:17:40 +00:00
|
|
|
set -euo pipefail
|
2024-07-08 15:59:39 +00:00
|
|
|
|
|
|
|
systemctl disable systemd-resolved --now
|
|
|
|
rm /etc/resolv.conf
|
|
|
|
echo 'nameserver 1.1.1.1' > /etc/resolv.conf
|
|
|
|
|
2024-07-16 14:18:31 +00:00
|
|
|
apt-get update
|
2024-07-08 15:59:39 +00:00
|
|
|
apt-get install -qq -y systemd-container
|
|
|
|
|
|
|
|
cat <<NETWORKCONFIG >/etc/systemd/network/10-br1.network
|
|
|
|
[Match]
|
|
|
|
Kind=bridge
|
|
|
|
Name=br1
|
|
|
|
|
|
|
|
[Network]
|
|
|
|
# Default to using a /24 prefix, giving up to 253 addresses per virtual network.
|
|
|
|
Address=0.0.0.0/24
|
|
|
|
LinkLocalAddressing=yes
|
|
|
|
DHCPServer=yes
|
|
|
|
IPMasquerade=both
|
|
|
|
LLDP=yes
|
|
|
|
EmitLLDP=customer-bridge
|
|
|
|
IPv6AcceptRA=no
|
|
|
|
IPv6SendRA=yes
|
|
|
|
NETWORKCONFIG
|
|
|
|
|
|
|
|
systemctl restart systemd-networkd
|
|
|
|
ip link add name br1 type bridge
|
|
|
|
|
|
|
|
iptables -I DOCKER-USER -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
|
|
|
iptables -I DOCKER-USER -i br1 -o eth0 -j ACCEPT
|
|
|
|
END
|
|
|
|
|
|
|
|
- name: Examine the GitHub-hosted runner environment
|
|
|
|
run: |
|
|
|
|
uname -r
|
|
|
|
cat /etc/os-release
|
|
|
|
python3 --version
|
|
|
|
ip addr
|
|
|
|
|
|
|
|
# # TODO: create zpool with virtual disks, create jailmaker dataset and test jlmkr.py from there
|
|
|
|
# # https://medium.com/@abaddonsd/zfs-usage-with-virtual-disks-62898064a29b
|
|
|
|
# - name: Create a parent ZFS dataset
|
|
|
|
# run: |
|
|
|
|
# sudo -s <<END
|
|
|
|
# apt-get install -y -qq zfsutils-linux
|
|
|
|
# modinfo zfs | grep version
|
|
|
|
# zfs --version
|
|
|
|
# zpool --version
|
|
|
|
# END
|
|
|
|
|
2024-07-16 14:50:45 +00:00
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
python3 -m zipapp src/jlmkr -p "/usr/bin/env python3" -o jlmkr
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
path: jlmkr
|
|
|
|
|
2024-07-08 15:59:39 +00:00
|
|
|
# Run multiple commands using the runners shell
|
|
|
|
- name: Run the test script
|
|
|
|
env:
|
|
|
|
PYTHONUNBUFFERED: 1
|
|
|
|
run: |
|
2024-07-16 14:17:40 +00:00
|
|
|
set -euo pipefail
|
2024-07-16 14:12:12 +00:00
|
|
|
sudo chown 0:0 jlmkr ./test/test-jlmkr
|
2024-07-09 11:00:34 +00:00
|
|
|
sudo bash ./test/test-jlmkr
|
|
|
|
sudo ./test/test.sh
|