Skip to content

lxd-to-incus: Be more lenient on database changes #3436

lxd-to-incus: Be more lenient on database changes

lxd-to-incus: Be more lenient on database changes #3436

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- stable-*
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
code-tests:
name: Code
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
go:
- oldstable
- stable
- tip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v4
if: github.event_name == 'pull_request'
- id: ShellCheck
name: Differential ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'pull_request' && matrix.go == 'stable'
- name: Upload artifact with ShellCheck defects in SARIF format
uses: actions/upload-artifact@v4
with:
name: Differential ShellCheck SARIF
path: ${{ steps.ShellCheck.outputs.sarif }}
if: github.event_name == 'pull_request' && matrix.go == 'stable'
- name: Install Go (${{ matrix.go }})
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
if: matrix.go != 'tip'
- name: Install Go (stable)
uses: actions/setup-go@v5
with:
go-version: stable
if: matrix.go == 'tip'
- name: Install Go (tip)
run: |
go install golang.org/dl/gotip@latest
gotip download
~/sdk/gotip/bin/go version
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
if: matrix.go == 'tip'
- name: Check compatible min Go version
run: |
go mod tidy
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
curl \
gettext \
git \
libacl1-dev \
libcap-dev \
libdbus-1-dev \
libcowsql-dev \
liblxc-dev \
lxc-templates \
libseccomp-dev \
libselinux-dev \
libsqlite3-dev \
libtool \
libudev-dev \
make \
pkg-config \
shellcheck
python3 -m pip install flake8
- name: Download go dependencies
run: |
go mod download
- name: Run Incus build
run: |
make
- name: Run static analysis
env:
GITHUB_BEFORE: ${{ github.event.before }}
run: |
make static-analysis
- name: Unit tests (all)
run: |
sudo --preserve-env=CGO_CFLAGS,CGO_LDFLAGS,CGO_LDFLAGS_ALLOW,LD_LIBRARY_PATH LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env "PATH=${PATH}" go test ./...
system-tests-hosted:
name: System (x86_64)
strategy:
fail-fast: false
matrix:
go:
- stable
suite:
- cluster
- standalone
backend:
- dir
- btrfs
- lvm
- zfs
- ceph
- random
include:
- go: oldstable
suite: cluster
backend: dir
- go: oldstable
suite: standalone
backend: dir
- go: tip
suite: cluster
backend: dir
- go: tip
suite: standalone
backend: dir
runs-on: ubuntu-22.04
steps:
- name: Performance tuning
run: |
set -eux
# optimize ext4 FSes for performance, not reliability
for fs in $(findmnt --noheading --type ext4 --list --uniq | awk '{print $1}'); do
# nombcache and data=writeback cannot be changed on remount
sudo mount -o remount,noatime,barrier=0,commit=6000 "${fs}" || true
done
# disable dpkg from calling sync()
echo "force-unsafe-io" | sudo tee /etc/dpkg/dpkg.cfg.d/force-unsafe-io
- name: Reclaim some space
run: |
set -eux
sudo snap remove lxd --purge
# Purge older snap revisions that are disabled/superseded by newer revisions of the same snap
snap list --all | while read -r name _ rev _ _ notes _; do
[ "${notes}" = "disabled" ] && snap remove "${name}" --revision "${rev}" --purge
done || true
# This was inspired from https://github.com/easimon/maximize-build-space
df -h /
# dotnet
sudo rm -rf /usr/share/dotnet
# android
sudo rm -rf /usr/local/lib/android
# haskell
sudo rm -rf /opt/ghc
df -h /
- name: Remove docker
run: |
set -eux
sudo apt-get autopurge -y moby-containerd docker uidmap
sudo ip link delete docker0
sudo nft flush ruleset
- name: Checkout
uses: actions/checkout@v4
- name: Run the testsuite
uses: ./.github/actions/testsuite
with:
backend: ${{ matrix.backend }}
go: ${{ matrix.go }}
suite: ${{ matrix.suite }}
system-tests-self-hosted:
name: System (aarch64)
strategy:
fail-fast: false
matrix:
go:
- stable
suite:
- cluster
- standalone
backend:
- dir
include:
- go: oldstable
suite: cluster
backend: dir
- go: oldstable
suite: standalone
backend: dir
- go: tip
suite: cluster
backend: dir
- go: tip
suite: standalone
backend: dir
runs-on:
- self-hosted
- cpu-4
- mem-4G
- disk-50G
- arch-arm64
- image-ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run the testsuite
uses: ./.github/actions/testsuite
with:
backend: ${{ matrix.backend }}
go: ${{ matrix.go }}
suite: ${{ matrix.suite }}
client:
name: Client
strategy:
fail-fast: false
matrix:
go:
- oldstable
- stable
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Create build directory
run: |
mkdir bin
- name: Build static x86_64 incus
env:
CGO_ENABLED: 0
GOARCH: amd64
run: |
go build -o bin/incus.x86_64 ./cmd/incus
- name: Build static aarch64 incus
env:
CGO_ENABLED: 0
GOARCH: arm64
run: |
go build -o bin/incus.aarch64 ./cmd/incus
- name: Build static incus-migrate
if: runner.os == 'Linux'
env:
CGO_ENABLED: 0
run: |
GOARCH=amd64 go build -o bin/incus-migrate.x86_64 ./cmd/incus-migrate
GOARCH=arm64 go build -o bin/incus-migrate.aarch64 ./cmd/incus-migrate
- name: Build static lxd-to-incus
if: runner.os == 'Linux'
env:
CGO_ENABLED: 0
run: |
GOARCH=amd64 go build -o bin/lxd-to-incus.x86_64 ./cmd/lxd-to-incus
GOARCH=arm64 go build -o bin/lxd-to-incus.aarch64 ./cmd/lxd-to-incus
- name: Unit tests (client)
env:
CGO_ENABLED: 0
run: go test -v ./client/...
- name: Unit tests (incus)
env:
CGO_ENABLED: 0
run: go test -v ./cmd/incus/...
- name: Unit tests (shared)
env:
CGO_ENABLED: 0
run: go test -v ./shared/...
- name: Upload incus client artifacts
if: matrix.go == 'stable'
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: ${{ runner.os }}
path: bin/
documentation:
name: Documentation
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Install dependencies
run: |
sudo apt-get install aspell aspell-en
sudo snap install mdl
- name: Run markdown linter
run: |
make doc-lint
- name: Run spell checker
run: |
make doc-spellcheck
- name: Run inclusive naming checker
uses: get-woke/woke-action@v0
with:
fail-on-error: true
woke-args: "*.md **/*.md -c https://github.com/canonical/Inclusive-naming/raw/main/config.yml"
- name: Run link checker
run: |
make doc-linkcheck
- name: Build docs (Sphinx)
run: make doc
- name: Print warnings (Sphinx)
run: if [ -s doc/.sphinx/warnings.txt ]; then cat doc/.sphinx/warnings.txt; exit 1; fi
- name: Upload documentation artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/html