-
Notifications
You must be signed in to change notification settings - Fork 579
177 lines (175 loc) · 7.43 KB
/
test.yml
File metadata and controls
177 lines (175 loc) · 7.43 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
name: Tests
on:
workflow_dispatch:
push:
pull_request:
jobs:
test:
strategy:
fail-fast: false
matrix:
conf: [
{dist: bookworm, python: '3.9', podman: '4.3.1', mode: 'root'},
{dist: bookworm, python: '3.9', podman: '4.9.5', mode: 'root'},
{dist: bookworm, python: '3.9', podman: '5.0.3', mode: 'root'},
{dist: bookworm, python: '3.9', podman: '5.4.2', mode: 'root'},
{dist: bookworm, python: '3.10', podman: '4.3.1', mode: 'root'},
{dist: bookworm, python: '3.10', podman: '4.9.5', mode: 'root'},
{dist: bookworm, python: '3.10', podman: '5.0.3', mode: 'root'},
{dist: bookworm, python: '3.10', podman: '5.4.2', mode: 'root'},
{dist: bookworm, python: '3.11', podman: '4.3.1', mode: 'root'},
{dist: bookworm, python: '3.11', podman: '4.9.5', mode: 'root'},
{dist: bookworm, python: '3.11', podman: '5.0.3', mode: 'root'},
{dist: bookworm, python: '3.11', podman: '5.4.2', mode: 'root'},
{dist: bookworm, python: '3.12', podman: '4.3.1', mode: 'root'},
{dist: bookworm, python: '3.12', podman: '4.9.5', mode: 'root'},
{dist: bookworm, python: '3.12', podman: '5.0.3', mode: 'root'},
{dist: bookworm, python: '3.12', podman: '5.4.2', mode: 'root'},
{dist: bookworm, python: '3.13', podman: '4.3.1', mode: 'root'},
{dist: bookworm, python: '3.13', podman: '4.9.5', mode: 'root'},
{dist: bookworm, python: '3.13', podman: '5.0.3', mode: 'root'},
{dist: bookworm, python: '3.13', podman: '5.4.2', mode: 'root'},
{dist: trixie, python: '3.9', podman: '5.7.1', mode: 'root'},
{dist: trixie, python: '3.9', podman: '5.7.1', mode: 'rootless'},
{dist: trixie, python: '3.10', podman: '5.7.1', mode: 'root'},
{dist: trixie, python: '3.10', podman: '5.7.1', mode: 'rootless'},
{dist: trixie, python: '3.11', podman: '5.7.1', mode: 'root'},
{dist: trixie, python: '3.11', podman: '5.7.1', mode: 'rootless'},
{dist: trixie, python: '3.12', podman: '5.7.1', mode: 'root'},
{dist: trixie, python: '3.12', podman: '5.7.1', mode: 'rootless'},
{dist: trixie, python: '3.13', podman: '5.7.1', mode: 'root'},
{dist: trixie, python: '3.13', podman: '5.7.1', mode: 'rootless'},
]
runs-on: ubuntu-latest
container:
image: "docker.io/library/python:${{ matrix.conf.python }}-${{ matrix.conf.dist }}"
# cgroupns needed to address the following error:
# write /sys/fs/cgroup/cgroup.subtree_control: operation not supported
options: --privileged --cgroupns=host
steps:
- uses: actions/checkout@v6
- name: Install podman-4.3.1
if: matrix.conf.podman == '4.3.1'
run: |
set -e
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y podman
- name: Install dependencies for podman-4.9.5
if: matrix.conf.podman == '4.9.5'
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y buildah
BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
DEB_FILES=(
"${BASE_URL}/deb-files-podman-4.9.5/podman_4.9.5+compose1-1_amd64.deb"
"${BASE_URL}/deb-files-crun-1-21/crun_1.21-1_amd64.deb"
)
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
for url in "${DEB_FILES[@]}"; do
# strip everything up to the last slash
filename=${url##*/}
echo "Downloading $url ..."
curl -fsSL -o "$TMPDIR/$filename" "$url"
done
echo "Installing packages ..."
apt-get update -qq
apt-get install -y -qq "$TMPDIR"/*.deb
- name: Install dependencies for podman-5.0.3
if: matrix.conf.podman == '5.0.3'
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y buildah
BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
DEB_FILES=(
"${BASE_URL}/deb-files-podman-5.0.3/podman_5.0.3+compose1-1_amd64.deb"
"${BASE_URL}/deb-files-crun-1-21/crun_1.21-1_amd64.deb"
)
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
for url in "${DEB_FILES[@]}"; do
# strip everything up to the last slash
filename=${url##*/}
echo "Downloading $url ..."
curl -fsSL -o "$TMPDIR/$filename" "$url"
done
echo "Installing packages ..."
apt-get update -qq
apt-get install -y -qq "$TMPDIR"/*.deb
- name: Install dependencies for podman-5.4.2
if: matrix.conf.podman == '5.4.2'
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y buildah
BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
DEB_FILES=(
"${BASE_URL}/deb-files-podman-5.4.2/podman_5.4.2+composetest-1_amd64.deb"
"${BASE_URL}/deb-files-crun-1-21/crun_1.21-1_amd64.deb"
"${BASE_URL}/deb-files-netavark-1-14/netavark_1.14.0-1_amd64.deb"
"${BASE_URL}/deb-files-aardvark-dns-1-14/aardvark-dns_1.14.0-1_amd64.deb"
)
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
for url in "${DEB_FILES[@]}"; do
# strip everything up to the last slash
filename=${url##*/}
echo "Downloading $url ..."
curl -fsSL -o "$TMPDIR/$filename" "$url"
done
echo "Installing packages ..."
apt-get update -qq
apt-get install -y -qq "$TMPDIR"/*.deb
- name: Install dependencies for podman-5.7.1
if: matrix.conf.podman == '5.7.1'
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y crun netavark aardvark-dns
BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
DEB_FILE="${BASE_URL}/deb-files-podman-5.7.1/podman_5.7.1+compose1-1_amd64.deb"
echo "Downloading ${DEB_FILE##*/} ..."
curl -fsSLO "$DEB_FILE"
echo "Installing package ..."
apt-get install -y ./podman_5.7.1+compose1-1_amd64.deb
- name: Setup root/rootless
run: |
set -e
if [ "${{ matrix.conf.mode }}" = "rootless" ]; then
useradd -m myuser
echo "USER_EXEC_CMD=su myuser" >> $GITHUB_ENV
chown -R myuser:myuser .
else
echo "USER_EXEC_CMD=/bin/bash" >> $GITHUB_ENV
fi
- name: Setup virtualenv, install other test dependencies
run: |
$USER_EXEC_CMD -c "
set -e
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt -r test-requirements.txt
"
- name: Run integration tests
run: |
$USER_EXEC_CMD -c "
set -e
. .venv/bin/activate
python -m unittest discover -v tests/integration
"
env:
TESTS_DEBUG: 1
- name: Run unit tests
run: |
$USER_EXEC_CMD -c "
set -e
. .venv/bin/activate
coverage run --source podman_compose -m unittest discover tests/unit
"
- name: Report coverage
run: |
chmod o+w "$GITHUB_STEP_SUMMARY"
$USER_EXEC_CMD -c "
set -e
. .venv/bin/activate
coverage combine
coverage report --format=markdown | tee -a $GITHUB_STEP_SUMMARY
"