Skip to content

Add CI to handle auto test and promote to strict and moonray branches #3

Add CI to handle auto test and promote to strict and moonray branches

Add CI to handle auto test and promote to strict and moonray branches #3

name: Informing Integration Tests
on:
push:
branches:
- main
- 'release-[0-9]+.[0-9]+'
- 'autoupdate/sync/**'
pull_request:
permissions:
contents: read
jobs:
build:
name: Build ${{ matrix.patch }}
runs-on: ubuntu-20.04
strategy:
matrix:
patch: ["strict", "moonray"]
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Checking out repo
uses: actions/checkout@v4
- name: Install lxd
run: |
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
- name: Install snapcraft
run: |
sudo snap install snapcraft --classic
- name: Apply ${{ matrix.patch }} patch
run: |
./build-scripts/patches/${{ matrix.patch }}/apply
- name: Build snap
run: |
sg lxd -c 'snapcraft --use-lxd'
mv k8s_*.snap k8s-${{ matrix.patch }}.snap
- name: Uploading snap
uses: actions/upload-artifact@v4
with:
name: k8s-${{ matrix.patch }}.snap
path: k8s-${{ matrix.patch }}.snap
test-integration:
needs: [ build ]
name: Test ${{ matrix.patch }} ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu:20.04"]
patch: ["strict", "moonray"]
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install tox
run: pip install tox
- name: Install lxd
run: |
sudo snap refresh lxd --channel 5.19/stable
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
- name: Download snap
uses: actions/download-artifact@v4
with:
name: k8s-${{ matrix.patch }}.snap
path: build
- name: Apply ${{ matrix.patch }} patch
run: |
./build-scripts/patches/${{ matrix.patch }}/apply
- name: Run end to end tests
run: |
export TEST_SNAP="$PWD/build/k8s-${{ matrix.patch }}.snap"
export TEST_SUBSTRATE=lxd
export TEST_LXD_IMAGE=${{ matrix.os }}
cd tests/integration && sg lxd -c 'tox -e integration'