Debian Codegraph @

.github/workflows/test.yml

raw symbols SCIP
1 name: Tests
2
3 on:
4 workflow_dispatch:
5 push:
6 pull_request:
7
8 jobs:
9 test:
10 strategy:
11 fail-fast: false
12 matrix:
13 conf: [
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'},
44 ]
45 runs-on: ubuntu-latest
46 container:
47 image: "docker.io/library/python:${{ matrix.conf.python }}-${{ matrix.conf.dist }}"
48 # cgroupns needed to address the following error:
49 # write /sys/fs/cgroup/cgroup.subtree_control: operation not supported
50 options: --privileged --cgroupns=host
51 steps:
52 - uses: actions/checkout@v6
53 - name: Install podman-4.3.1
54 if: matrix.conf.podman == '4.3.1'
55 run: |
56 set -e
57 apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y podman
58 - name: Install dependencies for podman-4.9.5
59 if: matrix.conf.podman == '4.9.5'
60 shell: bash
61 run: |
62 DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y buildah
63 BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
64 DEB_FILES=(
65 "${BASE_URL}/deb-files-podman-4.9.5/podman_4.9.5+compose1-1_amd64.deb"
66 "${BASE_URL}/deb-files-crun-1-21/crun_1.21-1_amd64.deb"
67 )
68 TMPDIR=$(mktemp -d)
69 trap 'rm -rf "$TMPDIR"' EXIT
70 for url in "${DEB_FILES[@]}"; do
71 # strip everything up to the last slash
72 filename=${url##*/}
73 echo "Downloading $url ..."
74 curl -fsSL -o "$TMPDIR/$filename" "$url"
75 done
76 echo "Installing packages ..."
77 apt-get update -qq
78 apt-get install -y -qq "$TMPDIR"/*.deb
79 - name: Install dependencies for podman-5.0.3
80 if: matrix.conf.podman == '5.0.3'
81 shell: bash
82 run: |
83 DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y buildah
84 BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
85 DEB_FILES=(
86 "${BASE_URL}/deb-files-podman-5.0.3/podman_5.0.3+compose1-1_amd64.deb"
87 "${BASE_URL}/deb-files-crun-1-21/crun_1.21-1_amd64.deb"
88 )
89 TMPDIR=$(mktemp -d)
90 trap 'rm -rf "$TMPDIR"' EXIT
91 for url in "${DEB_FILES[@]}"; do
92 # strip everything up to the last slash
93 filename=${url##*/}
94 echo "Downloading $url ..."
95 curl -fsSL -o "$TMPDIR/$filename" "$url"
96 done
97 echo "Installing packages ..."
98 apt-get update -qq
99 apt-get install -y -qq "$TMPDIR"/*.deb
100 - name: Install dependencies for podman-5.4.2
101 if: matrix.conf.podman == '5.4.2'
102 shell: bash
103 run: |
104 DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y buildah
105 BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
106 DEB_FILES=(
107 "${BASE_URL}/deb-files-podman-5.4.2/podman_5.4.2+composetest-1_amd64.deb"
108 "${BASE_URL}/deb-files-crun-1-21/crun_1.21-1_amd64.deb"
109 "${BASE_URL}/deb-files-netavark-1-14/netavark_1.14.0-1_amd64.deb"
110 "${BASE_URL}/deb-files-aardvark-dns-1-14/aardvark-dns_1.14.0-1_amd64.deb"
111 )
112 TMPDIR=$(mktemp -d)
113 trap 'rm -rf "$TMPDIR"' EXIT
114 for url in "${DEB_FILES[@]}"; do
115 # strip everything up to the last slash
116 filename=${url##*/}
117 echo "Downloading $url ..."
118 curl -fsSL -o "$TMPDIR/$filename" "$url"
119 done
120 echo "Installing packages ..."
121 apt-get update -qq
122 apt-get install -y -qq "$TMPDIR"/*.deb
123 - name: Install dependencies for podman-5.7.1
124 if: matrix.conf.podman == '5.7.1'
125 shell: bash
126 run: |
127 DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y crun netavark aardvark-dns
128 BASE_URL="https://github.com/p12tic/podman-compose-test-data/raw/refs/heads/master/deb_files"
129 DEB_FILE="${BASE_URL}/deb-files-podman-5.7.1/podman_5.7.1+compose1-1_amd64.deb"
130 echo "Downloading ${DEB_FILE##*/} ..."
131 curl -fsSLO "$DEB_FILE"
132 echo "Installing package ..."
133 apt-get install -y ./podman_5.7.1+compose1-1_amd64.deb
134 - name: Setup root/rootless
135 run: |
136 set -e
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 "
153 - name: Run integration tests
154 run: |
155 $USER_EXEC_CMD -c "
156 set -e
157 . .venv/bin/activate
158 python -m unittest discover -v tests/integration
159 "
160 env:
161 TESTS_DEBUG: 1
162 - name: Run unit tests
163 run: |
164 $USER_EXEC_CMD -c "
165 set -e
166 . .venv/bin/activate
167 coverage run --source podman_compose -m unittest discover tests/unit
168 "
169 - name: Report coverage
170 run: |
171 chmod o+w "$GITHUB_STEP_SUMMARY"
172 $USER_EXEC_CMD -c "
173 set -e
174 . .venv/bin/activate
175 coverage combine
176 coverage report --format=markdown | tee -a $GITHUB_STEP_SUMMARY
177 "