mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
Replace the two staging-server CI workflows and their zone-file helpers with a single lxc-test job in ci.yaml that runs 'cmdeploy lxc-test' inside an ubuntu-24.04 runner. The new workflow installs Incus from the Zabbly apt repository, initialises it, bootstraps the venv, caches the base LXC image together with SSH keys, and runs the full LXC pipeline (container creation, deploy, DNS zones, tests).
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
jobs:
|
|
tox:
|
|
name: isolated chatmaild tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# Checkout pull request HEAD commit instead of merge commit
|
|
# Otherwise `test_deployed_state` will be unhappy.
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: download filtermail
|
|
run: curl -L https://github.com/chatmail/filtermail/releases/download/v0.5.2/filtermail-x86_64 -o /usr/local/bin/filtermail && chmod +x /usr/local/bin/filtermail
|
|
- name: run chatmaild tests
|
|
working-directory: chatmaild
|
|
run: pipx run tox
|
|
|
|
scripts:
|
|
name: deploy-chatmail tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: initenv
|
|
run: scripts/initenv.sh
|
|
|
|
- name: append venv/bin to PATH
|
|
run: echo venv/bin >>$GITHUB_PATH
|
|
|
|
- name: run formatting checks
|
|
run: cmdeploy fmt -v
|
|
|
|
- name: run deploy-chatmail offline tests
|
|
run: pytest --pyargs cmdeploy
|
|
|
|
lxc-test:
|
|
name: LXC deploy and test
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: install incus
|
|
run: |
|
|
# zabbly is the official incus community packages source
|
|
curl -fsSL https://pkgs.zabbly.com/key.asc \
|
|
| sudo gpg --dearmor -o /etc/apt/keyrings/zabbly.gpg
|
|
sudo sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
|
|
Enabled: yes
|
|
Types: deb
|
|
URIs: https://pkgs.zabbly.com/incus/stable
|
|
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
|
|
Components: main
|
|
Architectures: $(dpkg --print-architecture)
|
|
Signed-By: /etc/apt/keyrings/zabbly.gpg
|
|
EOF'
|
|
sudo apt-get update
|
|
sudo apt-get install -y incus
|
|
|
|
- name: initialise incus
|
|
run: |
|
|
sudo systemctl stop docker.socket docker || true
|
|
sudo iptables -P FORWARD ACCEPT
|
|
sudo sysctl -w fs.inotify.max_user_instances=65535
|
|
sudo sysctl -w fs.inotify.max_user_watches=65535
|
|
sudo incus admin init --minimal
|
|
sudo usermod -aG incus-admin "$USER"
|
|
|
|
- name: initenv
|
|
run: scripts/initenv.sh
|
|
|
|
- name: append venv/bin to PATH
|
|
run: echo venv/bin >>$GITHUB_PATH
|
|
|
|
- name: lxc-test
|
|
run: sg incus-admin -c 'cmdeploy lxc-test'
|
|
|
|
- name: export images for cache
|
|
if: always()
|
|
run: |
|
|
for alias in localchat-base localchat-ns localchat-test0 localchat-test1; do
|
|
if ! [ -f /tmp/$alias.tar.gz ]; then
|
|
sg incus-admin -c "incus image export $alias /tmp/$alias" || true
|
|
fi
|
|
done
|