-
Notifications
You must be signed in to change notification settings - Fork 186
152 lines (127 loc) · 5.64 KB
/
tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: 'tests'
on:
pull_request:
branches: ['master']
paths:
- '.github/**'
- '**.py'
- 'behave/**'
- 'tests/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-ro:
name: "unit - read only fixtures"
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
steps:
- name: 'Install packages'
run: |
sudo apt-get -y update
sudo apt-get -y --no-install-recommends install git-lfs
sudo apt-get -y --no-install-recommends install diffstat diffutils git-core python3 python3-cryptography python3-pip python3-rpm python3-ruamel.yaml python3-setuptools python3-urllib3
- uses: actions/checkout@v3
- name: 'Change owner to root:root'
run: |
sudo chown -R root:root tests
- name: 'Run unit tests'
run: |
pip3 config set global.break-system-packages 1
pip3 install -e .
python3 -m unittest
unit:
name: "unit"
needs: unit-ro
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
- 'registry.fedoraproject.org/fedora:38'
- 'registry.fedoraproject.org/fedora:39'
- 'registry.fedoraproject.org/fedora:rawhide'
# openSUSE
# leap < 15.2 doesn't contain git-lfs which causes actions/checkout to fail
- 'registry.opensuse.org/opensuse/leap:15.3'
- 'registry.opensuse.org/opensuse/leap:15.4'
- 'registry.opensuse.org/opensuse/leap:15.5'
- 'registry.opensuse.org/opensuse/tumbleweed'
# CentOS Stream
- 'quay.io/centos/centos:stream9'
# Debian
- 'docker.io/library/debian:stable'
- 'docker.io/library/debian:unstable'
# Ubuntu
- 'docker.io/library/ubuntu:latest'
container:
image: ${{ matrix.container }}
steps:
- name: 'Install packages (openSUSE)'
if: ${{ contains(matrix.container, '/opensuse/') }}
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-ruamel.yaml python3-setuptools python3-urllib3
- name: 'Install packages (Fedora/CentOS)'
if: ${{ contains(matrix.container, '/fedora:') || contains(matrix.container, '/centos:') }}
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-ruamel-yaml python3-setuptools python3-urllib3
- name: 'Install packages (Debian/Ubuntu)'
if: ${{ contains(matrix.container, '/debian:') || contains(matrix.container, '/ubuntu:') }}
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-ruamel.yaml python3-setuptools python3-urllib3
- uses: actions/checkout@v3
- name: 'Run unit tests'
run: |
pip3 config set global.break-system-packages 1
pip3 install -e .
python3 -m unittest
- name: 'Generate coverage reports (openSUSE Tumbleweed)'
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)'
if: ${{ contains(matrix.container, '/opensuse/tumbleweed') }}
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 sh -c '. /etc/os-release; echo "deb [trusted=yes] http://download.opensuse.org/repositories/openSUSE:Tools/xUbuntu_${VERSION_ID} ./" > /etc/apt/sources.list.d/openSUSE-Tools.list'
sudo apt-get -y update
sudo apt-get -y --no-install-recommends install git python3-behave diffstat diffutils python3 python3-cryptography python3-pip python3-rpm python3-ruamel.yaml python3-setuptools python3-urllib3 obs-build obs-service-set-version
# obs-scm-bridge is not available as a package at the moment, install it from github
sudo pip3 config set global.break-system-packages 1
sudo pip3 install git+https://github.com/openSUSE/obs-scm-bridge
sudo chmod a+x /usr/local/lib/*/*/obs_scm_bridge
sudo mkdir -p /usr/lib/obs/service
sudo ln -s /usr/local/lib/*/*/obs_scm_bridge /usr/lib/obs/service/obs_scm_bridge
- 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 -Dgit-obs=../git-obs.py -Dpodman_max_containers=2