1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-15 08:36:13 +01:00
github.com_openSUSE_osc/.github/workflows/tests.yaml

119 lines
4.1 KiB
YAML
Raw Normal View History

name: 'tests'
2022-06-21 13:51:25 +02:00
on:
pull_request:
branches: ['master']
paths:
- '.github/**'
- '**.py'
- 'behave/**'
- 'tests/**'
2022-06-21 13:51:25 +02:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2022-06-21 13:51:25 +02:00
jobs:
unit:
name: "unit"
2022-06-21 13:51:25 +02:00
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
# Testing per python-version using actions/setup-python is not possible,
# because rpm doesn't exist on pypi and cannot be installed via pip on ubuntu.
# That's why we're going to test on the target distros directly.
container:
# Fedora
2023-06-01 13:37:27 +02:00
- 'registry.fedoraproject.org/fedora:36'
- 'registry.fedoraproject.org/fedora:rawhide'
2022-06-21 13:51:25 +02:00
# openSUSE
2022-06-21 13:51:25 +02:00
# leap < 15.2 doesn't contain git-lfs which causes actions/checkout to fail
2023-06-01 13:37:27 +02:00
- 'registry.opensuse.org/opensuse/leap:15.3'
- 'registry.opensuse.org/opensuse/leap:15.4'
- 'registry.opensuse.org/opensuse/leap:15.5'
2023-06-01 13:37:27 +02:00
- 'registry.opensuse.org/opensuse/tumbleweed'
2022-06-21 13:51:25 +02:00
# CentOS Stream
- 'quay.io/centos/centos:stream9'
2022-06-21 13:51:25 +02:00
# Debian
2023-06-01 13:37:27 +02:00
- 'docker.io/library/debian:stable'
- 'docker.io/library/debian:unstable'
2022-06-21 13:51:25 +02:00
# Ubuntu
2023-06-01 13:37:27 +02:00
- 'docker.io/library/ubuntu:latest'
2022-06-21 13:51:25 +02:00
container:
image: ${{ matrix.container }}
steps:
- name: 'Install packages (openSUSE)'
2023-06-01 13:37:27 +02:00
if: ${{ contains(matrix.container, '/opensuse/') }}
2022-06-21 13:51:25 +02:00
run: |
zypper -n modifyrepo --disable repo-openh264 || :
zypper -n --gpg-auto-import-keys refresh
zypper -n lr --details
grep -qi tumbleweed /etc/os-release && zypper -n dist-upgrade || zypper -n patch || zypper -n patch
zypper -n install git-lfs
zypper -n install diffstat diffutils git-core python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3
2022-06-21 13:51:25 +02:00
- name: 'Install packages (Fedora/CentOS)'
2023-06-01 13:37:27 +02:00
if: ${{ contains(matrix.container, '/fedora:') || contains(matrix.container, '/centos:') }}
2022-06-21 13:51:25 +02:00
run: |
dnf -y makecache
dnf -y distro-sync
dnf -y install git-lfs
dnf -y install diffstat diffutils git-core python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3
2022-06-21 13:51:25 +02:00
- name: 'Install packages (Debian/Ubuntu)'
2023-06-01 13:37:27 +02:00
if: ${{ contains(matrix.container, '/debian:') || contains(matrix.container, '/ubuntu:') }}
2022-06-21 13:51:25 +02:00
run: |
apt-get -y update
apt-get -y upgrade
apt-get -y --no-install-recommends install git-lfs
apt-get -y --no-install-recommends install diffstat diffutils git-core python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3
2022-06-21 13:51:25 +02:00
- uses: actions/checkout@v3
- name: 'Run unit tests'
run: |
pip3 config set global.break-system-packages 1
2022-06-21 13:51:25 +02:00
pip3 install -e .
python3 setup.py test
- name: 'Generate coverage reports (openSUSE Tumbleweed)'
2023-06-01 13:37:27 +02:00
if: ${{ contains(matrix.container, '/opensuse/tumbleweed') }}
run: |
zypper -n install python3-pytest python3-pytest-cov
pytest --cov=osc
- name: 'Upload coverage reports to Codecov (openSUSE Tumbleweed)'
2023-06-01 13:37:27 +02:00
if: ${{ contains(matrix.container, '/opensuse/tumbleweed') }}
2022-06-21 13:51:25 +02:00
uses: codecov/codecov-action@v3
behave:
name: "behave"
# to save resources, run only after unit tests have passed
needs: unit
runs-on: "ubuntu-latest"
steps:
- name: "Install packages"
run: |
sudo apt-get -y update
sudo apt-get -y --no-install-recommends install python3-behave diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-setuptools python3-urllib3
- name: "Checkout sources"
uses: actions/checkout@v3
- name: "Pull container image"
run: |
podman pull ghcr.io/suse-autobuild/obs-server:latest
- name: "Run tests"
run: |
cd behave
behave -Dosc=../osc-wrapper.py -Dmax_podman_containers=2