-
Notifications
You must be signed in to change notification settings - Fork 123
209 lines (192 loc) · 6.4 KB
/
python-ci.yml
File metadata and controls
209 lines (192 loc) · 6.4 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
---
name: Backend Tests
on:
push:
branches:
- main
paths:
- 'slurmweb/**'
- 'tests/**'
- 'pyproject.toml'
- 'setup.py'
- '.github/workflows/python-ci.yml'
pull_request:
branches:
- main
paths:
- 'slurmweb/**'
- 'tests/**'
- 'pyproject.toml'
- 'setup.py'
- '.github/workflows/python-ci.yml'
workflow_dispatch: {}
permissions:
contents: read
jobs:
python_tests:
name: Python unit tests
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tests dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3-dev libldap2-dev libsasl2-dev libcairo2-dev libgirepository-1.0-dev libgirepository-2.0-dev libpango1.0-dev
python -m pip install --upgrade pip
- name: Install application with its dependencies
run: |
pip install . .[agent] .[gateway] .[tests]
- name: Run tests
run: pytest
os_rpm_tests:
name: OS integration tests (rpm)
strategy:
fail-fast: false
matrix:
envs:
- container: rockylinux/rockylinux:8
epel: 8
repo: powertools
rackslab-repo: el8
racksdb-pkg: python3-racksdb-web
- container: rockylinux/rockylinux:9
epel: 9
rackslab-repo: el9
repo: crb
racksdb-pkg: python3-racksdb+web
- container: fedora:42
rackslab-repo: fc42
racksdb-pkg: python3-racksdb+web
runs-on: ubuntu-latest
container:
image: ${{ matrix.envs.container }}
steps:
- uses: actions/checkout@v4
- name: Enable EPEL repository (Rocky Linux)
if: ${{ startsWith(matrix.envs.container, 'rockylinux') }}
run: |
dnf -y install 'dnf-command(config-manager)'
dnf config-manager --set-enabled ${{ matrix.envs.repo }}
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${{ matrix.envs.epel }}.noarch.rpm
- name: Add Rackslab repository
run: |
curl --silent https://pkgs.rackslab.io/keyring.asc --output /etc/pki/rpm-gpg/RPM-GPG-KEY-Rackslab
cat <<EOF > /etc/yum.repos.d/rackslab.repo
[rackslab]
name=Rackslab
baseurl=https://pkgs.rackslab.io/rpm/${{ matrix.envs.rackslab-repo }}/main/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rackslab
EOF
- name: Install tests dependencies
run: |
dnf -y install \
python3-aiohttp \
python3-clustershell \
python3-flask \
python3-importlib-metadata \
python3-markdown \
python3-parameterized \
python3-pip \
python3-prometheus_client \
python3-pytest \
python3-PyYAML \
${{ matrix.envs.racksdb-pkg }} \
python3-redis \
python3-requests \
python3-rfl-authentication \
python3-rfl-build \
python3-rfl-core \
python3-rfl-log \
python3-rfl-settings \
python3-rfl-web
# Unfortunately, pip and setuptools in RHEL8 do not fully support
# PEP517 pyproject.toml. As a workaround for this version, the setup.py
# script provided by RFL.build package is copied and executed.
#
# Latest version of setuptools build wheels following PEP-491 naming
# conventions (eg. RFL.core becomes rfl-core) published with this name on
# PyPI but old versions of setuptools do not support this naming
# equivalence. For this reason, RFL dependencies are renamed with sed in
# pyproject.toml so old versions of setuptools can find the wheels on
# PyPI.
- name: Install RFL.build setup wrapper (Rocky Linux 8)
if: ${{ matrix.envs.container == 'rockylinux/rockylinux:8' }}
run: |
cp -v /usr/lib/python3.6/site-packages/rfl/build/scripts/setup setup.py
sed -i 's/RFL\./rfl-/' pyproject.toml
- name: Install application
run: pip3 install -e .
- name: Run tests
run: pytest-3
os_deb_tests:
name: OS integration tests (deb)
strategy:
fail-fast: false
matrix:
envs:
- container: debian:oldstable
rackslab-repo: bookworm
- container: debian:stable
rackslab-repo: trixie
- container: debian:testing
rackslab-repo: forky
- container: debian:unstable
rackslab-repo: sid
- container: ubuntu:noble
rackslab-repo: ubuntu24.04
runs-on: ubuntu-latest
container:
image: ${{ matrix.envs.container }}
steps:
- uses: actions/checkout@v4
- name: Add Rackslab repository
run: |
apt update
apt install -y ca-certificates curl gpg
curl -sS https://pkgs.rackslab.io/keyring.asc | gpg --dearmor | tee /usr/share/keyrings/rackslab.gpg > /dev/null
cat <<EOF > /etc/apt/sources.list.d/rackslab.sources
Types: deb
URIs: https://pkgs.rackslab.io/deb
Suites: ${{ matrix.envs.rackslab-repo }}
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/rackslab.gpg
EOF
- name: Install tests dependencies
run: |
apt update
apt install -y \
python3-aiohttp \
python3-clustershell \
python3-flask \
python3-markdown \
python3-parameterized \
python3-pip \
python3-prometheus-client \
python3-pytest \
python3-yaml \
python3-racksdb-web \
python3-redis \
python3-requests \
python3-rfl-authentication \
python3-rfl-build \
python3-rfl-core \
python3-rfl-log \
python3-rfl-settings \
python3-rfl-web \
python3-venv
- name: Install application
run: |
python3 -m venv --system-site-packages ~/venv
~/venv/bin/pip install -e .
- name: Run tests
run: pytest