Skip to content

chore: add image builds inside ci #279

chore: add image builds inside ci

chore: add image builds inside ci #279

Workflow file for this run

name: test
on:
pull_request:
paths-ignore:
- "docs/**"
- README.md
jobs:
build:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
python-version: "3.6"
- runs-on: ubuntu-latest
python-version: "3.7"
- runs-on: ubuntu-latest
python-version: "3.8"
- runs-on: ubuntu-latest
python-version: "3.9"
- runs-on: ubuntu-latest
python-version: "3.10"
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Install Poetry
run: make poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
cache: poetry
python-version: ${{ matrix.python-version }}
- name: Build package
run: make build
install:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
openstack-version: yoga
python-version: "3.6"
- runs-on: ubuntu-latest
python-version: "3.8"
openstack-version: zed
- runs-on: ubuntu-latest
python-version: "3.8"
openstack-version: "2023.1"
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Install Poetry
run: make poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
cache: poetry
python-version: ${{ matrix.python-version }}
- name: Build package
run: make build
- name: Install package using constraints
run: pip install --constraint https://releases.openstack.org/constraints/upper/${{ matrix.openstack-version }} ./dist/*.whl
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: pipx install flake8
- uses: suo/flake8-github-action@releases/v1
with:
checkName: flake8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: isort/isort-action@master
unit:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
python-version: "3.6"
- runs-on: ubuntu-latest
python-version: "3.7"
- runs-on: ubuntu-latest
python-version: "3.8"
- runs-on: ubuntu-latest
python-version: "3.9"
- runs-on: ubuntu-latest
python-version: "3.10"
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Install Poetry
run: make poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
cache: poetry
python-version: ${{ matrix.python-version }}
- name: Run unit tests
run: make unit-tests
build-images:
runs-on: ubuntu-latest-16-cores
if: contains(github.event.pull_request.body, '/build-new-image')
strategy:
fail-fast: false
matrix:
kube:
# - v1.23.17
# - v1.24.15
# - v1.25.11
# - v1.26.6
- v1.27.3
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Install Cluster API driver for Magnum
run: |
pip install -U setuptools pip
$HOME/.local/bin/pip3 install -e .
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- name: Build image
timeout-minutes: 30
run: |
magnum-cluster-api-image-builder
--operating-system ubuntu-2204
--version ${{ matrix.kube }}
env:
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload built image
uses: actions/upload-artifact@v3
with:
name: ubuntu-2204-kube-${{ matrix.kube }}.qcow2
path: ubuntu-2204-kube-${{ matrix.kube }}.qcow2
# functional:
# runs-on: ubuntu-latest-16-cores
# strategy:
# fail-fast: false
# matrix:
# kube:
# - v1.23.17
# - v1.24.15
# - v1.25.11
# - v1.26.6
# - v1.27.3
# concurrency:
# group: ${{ github.ref }}-${{ matrix.kube }}
# cancel-in-progress: true
# steps:
# - name: Checkout project
# uses: actions/checkout@v3
# - name: Clean-up node
# run: sudo apt-get purge -y postgresql* mysql-*
# - name: Install Magnum with Cluster API
# run: ./hack/stack.sh
# # - name: Setup "tmate" session
# # uses: mxschmitt/action-tmate@v3
# - name: Wait for images
# if: contains(github.event.pull_request.body, '/build-new-image')
# uses: lewagon/wait-on-check-action@v1.3.1
# with:
# ref: ${{ github.event.pull_request.head.sha }}
# check-name: "build-images (${{ matrix.kube }})"
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# wait-interval: 10
# - name: Download built image
# if: contains(github.event.pull_request.body, '/build-new-image')
# uses: actions/download-artifact@v3
# with:
# name: ubuntu-2204-kube-${{ matrix.kube }}.qcow2
# - name: Run functional tests
# run: |
# ./hack/run-functional-tests.sh
# env:
# BUILD_NEW_IMAGE: "${{ contains(github.event.pull_request.body, '/build-new-image') }}"
# KUBE_TAG: "${{ matrix.kube }}"
# NODE_COUNT: 2
# - name: Upload Sonobuoy results
# uses: actions/upload-artifact@v3
# if: always()
# continue-on-error: true
# with:
# name: "sonobuoy-results-${{ matrix.kube }}"
# path: sonobuoy-results.tar.gz