Skip to content

Commit a0c0eb9

Browse files
authored
Merge pull request #1412 from mokibit/github-root-rootless
github: Setup tests for both rootful and rootless modes
2 parents fc5b17c + e999eae commit a0c0eb9

File tree

1 file changed

+60
-34
lines changed

1 file changed

+60
-34
lines changed

.github/workflows/test.yml

Lines changed: 60 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,36 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
conf: [
14-
{dist: bookworm, python: '3.9', podman: '4.3.1'},
15-
{dist: bookworm, python: '3.9', podman: '4.9.5'},
16-
{dist: bookworm, python: '3.9', podman: '5.0.3'},
17-
{dist: bookworm, python: '3.9', podman: '5.4.2'},
18-
{dist: bookworm, python: '3.10', podman: '4.3.1'},
19-
{dist: bookworm, python: '3.10', podman: '4.9.5'},
20-
{dist: bookworm, python: '3.10', podman: '5.0.3'},
21-
{dist: bookworm, python: '3.10', podman: '5.4.2'},
22-
{dist: bookworm, python: '3.11', podman: '4.3.1'},
23-
{dist: bookworm, python: '3.11', podman: '4.9.5'},
24-
{dist: bookworm, python: '3.11', podman: '5.0.3'},
25-
{dist: bookworm, python: '3.11', podman: '5.4.2'},
26-
{dist: bookworm, python: '3.12', podman: '4.3.1'},
27-
{dist: bookworm, python: '3.12', podman: '4.9.5'},
28-
{dist: bookworm, python: '3.12', podman: '5.0.3'},
29-
{dist: bookworm, python: '3.12', podman: '5.4.2'},
30-
{dist: bookworm, python: '3.13', podman: '4.3.1'},
31-
{dist: bookworm, python: '3.13', podman: '4.9.5'},
32-
{dist: bookworm, python: '3.13', podman: '5.0.3'},
33-
{dist: bookworm, python: '3.13', podman: '5.4.2'},
34-
{dist: trixie, python: '3.9', podman: '5.7.1'},
35-
{dist: trixie, python: '3.9', podman: '5.7.1'},
36-
{dist: trixie, python: '3.10', podman: '5.7.1'},
37-
{dist: trixie, python: '3.10', podman: '5.7.1'},
38-
{dist: trixie, python: '3.11', podman: '5.7.1'},
39-
{dist: trixie, python: '3.11', podman: '5.7.1'},
40-
{dist: trixie, python: '3.12', podman: '5.7.1'},
41-
{dist: trixie, python: '3.12', podman: '5.7.1'},
42-
{dist: trixie, python: '3.13', podman: '5.7.1'},
43-
{dist: trixie, python: '3.13', podman: '5.7.1'},
14+
{dist: bookworm, python: '3.9', podman: '4.3.1', mode: 'root'},
15+
{dist: bookworm, python: '3.9', podman: '4.9.5', mode: 'root'},
16+
{dist: bookworm, python: '3.9', podman: '5.0.3', mode: 'root'},
17+
{dist: bookworm, python: '3.9', podman: '5.4.2', mode: 'root'},
18+
{dist: bookworm, python: '3.10', podman: '4.3.1', mode: 'root'},
19+
{dist: bookworm, python: '3.10', podman: '4.9.5', mode: 'root'},
20+
{dist: bookworm, python: '3.10', podman: '5.0.3', mode: 'root'},
21+
{dist: bookworm, python: '3.10', podman: '5.4.2', mode: 'root'},
22+
{dist: bookworm, python: '3.11', podman: '4.3.1', mode: 'root'},
23+
{dist: bookworm, python: '3.11', podman: '4.9.5', mode: 'root'},
24+
{dist: bookworm, python: '3.11', podman: '5.0.3', mode: 'root'},
25+
{dist: bookworm, python: '3.11', podman: '5.4.2', mode: 'root'},
26+
{dist: bookworm, python: '3.12', podman: '4.3.1', mode: 'root'},
27+
{dist: bookworm, python: '3.12', podman: '4.9.5', mode: 'root'},
28+
{dist: bookworm, python: '3.12', podman: '5.0.3', mode: 'root'},
29+
{dist: bookworm, python: '3.12', podman: '5.4.2', mode: 'root'},
30+
{dist: bookworm, python: '3.13', podman: '4.3.1', mode: 'root'},
31+
{dist: bookworm, python: '3.13', podman: '4.9.5', mode: 'root'},
32+
{dist: bookworm, python: '3.13', podman: '5.0.3', mode: 'root'},
33+
{dist: bookworm, python: '3.13', podman: '5.4.2', mode: 'root'},
34+
{dist: trixie, python: '3.9', podman: '5.7.1', mode: 'root'},
35+
{dist: trixie, python: '3.9', podman: '5.7.1', mode: 'rootless'},
36+
{dist: trixie, python: '3.10', podman: '5.7.1', mode: 'root'},
37+
{dist: trixie, python: '3.10', podman: '5.7.1', mode: 'rootless'},
38+
{dist: trixie, python: '3.11', podman: '5.7.1', mode: 'root'},
39+
{dist: trixie, python: '3.11', podman: '5.7.1', mode: 'rootless'},
40+
{dist: trixie, python: '3.12', podman: '5.7.1', mode: 'root'},
41+
{dist: trixie, python: '3.12', podman: '5.7.1', mode: 'rootless'},
42+
{dist: trixie, python: '3.13', podman: '5.7.1', mode: 'root'},
43+
{dist: trixie, python: '3.13', podman: '5.7.1', mode: 'rootless'},
4444
]
4545
runs-on: ubuntu-latest
4646
container:
@@ -131,21 +131,47 @@ jobs:
131131
curl -fsSLO "$DEB_FILE"
132132
echo "Installing package ..."
133133
apt-get install -y ./podman_5.7.1+compose1-1_amd64.deb
134-
- name: Install other test dependencies
134+
- name: Setup root/rootless
135135
run: |
136136
set -e
137-
python -m pip install --upgrade pip
138-
pip install -r requirements.txt
139-
pip install -r test-requirements.txt
137+
if [ "${{ matrix.conf.mode }}" = "rootless" ]; then
138+
useradd -m myuser
139+
echo "USER_EXEC_CMD=su myuser" >> $GITHUB_ENV
140+
chown -R myuser:myuser .
141+
else
142+
echo "USER_EXEC_CMD=/bin/bash" >> $GITHUB_ENV
143+
fi
144+
- name: Setup virtualenv, install other test dependencies
145+
run: |
146+
$USER_EXEC_CMD -c "
147+
set -e
148+
python3 -m venv .venv
149+
. .venv/bin/activate
150+
pip install --upgrade pip
151+
pip install -r requirements.txt -r test-requirements.txt
152+
"
140153
- name: Run integration tests
141154
run: |
155+
$USER_EXEC_CMD -c "
156+
set -e
157+
. .venv/bin/activate
142158
python -m unittest discover -v tests/integration
159+
"
143160
env:
144161
TESTS_DEBUG: 1
145162
- name: Run unit tests
146163
run: |
164+
$USER_EXEC_CMD -c "
165+
set -e
166+
. .venv/bin/activate
147167
coverage run --source podman_compose -m unittest discover tests/unit
168+
"
148169
- name: Report coverage
149170
run: |
171+
chmod o+w "$GITHUB_STEP_SUMMARY"
172+
$USER_EXEC_CMD -c "
173+
set -e
174+
. .venv/bin/activate
150175
coverage combine
151176
coverage report --format=markdown | tee -a $GITHUB_STEP_SUMMARY
177+
"

0 commit comments

Comments
 (0)