GH Actions #197
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GH Actions | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
smokecheck-linux: | |
name: Smokecheck on Linux with Python ${{ matrix.python-version }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, 3.10.0, 3.11, 3.12.0] | |
fail-fast: false | |
steps: | |
- run: echo "Job triggered by a ${{ github.event_name }} event on branch is ${{ github.ref }} in repository is ${{ github.repository }}, runner on ${{ runner.os }}" | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install setuptools on Python 3.12 | |
run: python3 -c 'import setuptools' || python3 -m pip install setuptools | |
- name: Avocado smokecheck | |
run: make smokecheck | |
# Checks that Python packages builds succeeds | |
package-build: | |
name: Build Package (wheel/tarball) for Python ${{ matrix.python-version }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, 3.10.0, 3.11, 3.12.0] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install setuptools on Python 3.12 | |
run: python3 -c 'import setuptools' || python3 -m pip install setuptools | |
- name: Build tarballs and wheels | |
run: make -f Makefile.gh build-wheel check-wheel | |
- name: Save tarballs and wheels as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tarballs_and_wheels-${{ matrix.python-version }} | |
path: ${{github.workspace}}/PYPI_UPLOAD/ | |
retention-days: 1 | |
- run: echo "🥑 This job's status is ${{ job.status }}." | |
egg-build: | |
name: Build Egg for Python ${{ matrix.python-version }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, 3.10.0, 3.11, 3.12.0] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install setuptools on Python 3.12 | |
run: python3 -c 'import setuptools' || python3 -m pip install setuptools | |
- name: Build eggs | |
run: make -f Makefile.gh build-egg | |
- name: Save eggs as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: eggs-${{ matrix.python-version }} | |
path: ${{github.workspace}}/EGG_UPLOAD/ | |
retention-days: 1 | |
- run: echo "🥑 This job's status is ${{ job.status }}." | |
version_task: | |
name: Version task (${{ matrix.container }}) | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
container: ["fedora:37", | |
"fedora:38", | |
"registry.access.redhat.com/ubi8/ubi:8.8", | |
"registry.access.redhat.com/ubi9/ubi:9.2", | |
"debian:10.10", | |
"debian:11.0", | |
"ubuntu:21.10", | |
"ubuntu:20.04"] | |
container: | |
image: ${{ matrix.container }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install and run avocado --version | |
shell: bash | |
run: | | |
if command -v dnf &> /dev/null; then | |
if ! command -v python3 &> /dev/null; then | |
dnf -y install python3 python3-setuptools | |
else | |
dnf -y install python3-setuptools | |
fi | |
else | |
if ! command -v python3 &> /dev/null; then | |
apt update | |
apt -y install python3 python3-setuptools ca-certificates | |
else | |
apt update | |
apt install python3-setuptools | |
fi | |
fi | |
python3 setup.py develop --user | |
python3 -m avocado --version | |
egg_task: | |
name: Egg task (${{ matrix.container }}) | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
container: ["fedora:37", | |
"fedora:38", | |
"registry.access.redhat.com/ubi8/ubi:8.8", | |
"registry.access.redhat.com/ubi9/ubi:9.2", | |
"debian:10.10", | |
"debian:11.0", | |
"ubuntu:21.10", | |
"ubuntu:20.04"] | |
container: | |
image: ${{ matrix.container }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Test running avocado from eggs | |
shell: bash | |
run: | | |
if command -v dnf &> /dev/null; then | |
if ! command -v python3 &> /dev/null; then | |
dnf -y install python3 python3-setuptools | |
else | |
dnf -y install python3-setuptools | |
fi | |
else | |
if ! command -v python3 &> /dev/null; then | |
apt update | |
apt -y install python3 python3-setuptools ca-certificates | |
else | |
apt update | |
apt install python3-setuptools | |
fi | |
fi | |
python3 setup.py bdist_egg | |
mv dist/avocado_framework-*egg /tmp | |
python3 setup.py clean --all | |
python3 -c 'import sys; import glob; sys.path.insert(0, glob.glob("/tmp/avocado_framework-*.egg")[0]); from avocado.core.main import main; sys.exit(main())' run /bin/true | |
cd /tmp | |
python3 -c 'import sys; from pkg_resources import require; require("avocado-framework"); from avocado.core.main import main; sys.exit(main())' run /bin/true | |
podman_egg_task: | |
name: Podman Egg task | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Test running avocado from eggs under Podman spawner | |
run: | | |
apt update && apt -y install python3 python3-setuptools | |
python3 setup.py bdist_egg | |
mv dist/avocado_framework-*egg /tmp/avocado_framework.egg | |
python3 setup.py clean --all | |
python3 -c 'import sys; sys.path.insert(0, "/tmp/avocado_framework.egg"); from avocado.core.main import main; sys.exit(main())' run --spawner=podman --spawner-podman-image=fedora:38 --spawner-podman-avocado-egg=file:///tmp/avocado_framework.egg -- /bin/true | |
podman_external_runner_task: | |
name: Podman spawner with 3rd party runner plugin | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Test running avocado from released eggs under Podman spawner with 3rd party plugins | |
run: | | |
apt update && apt -y install python3 python3-setuptools | |
python3 setup.py develop --user | |
cd examples/plugins/tests/magic | |
python3 setup.py develop --user | |
cd ../../../../ | |
python3 -m avocado -V list -- magic:pass magic:fail | grep "magic: 2" | |
podman pull quay.io/avocado-framework/avocado-ci-magic | |
python3 -m avocado run --spawner=podman --spawner-podman-image=quay.io/avocado-framework/avocado-ci-magic -- magic:pass | |
tail -n1 ~/avocado/job-results/latest/results.tap | grep "ok 1 magic:pass" | |
python3 -m avocado run --spawner=podman --spawner-podman-image=quay.io/avocado-framework/avocado-ci-magic -- magic:fail || true | |
tail -n1 ~/avocado/job-results/latest/results.tap | grep "not ok 1 magic:fail" | |