Skip to content

Commit 3a51231

Browse files
committed
ci: matrix linux container tests
1 parent 6052197 commit 3a51231

1 file changed

Lines changed: 33 additions & 55 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 33 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -42,78 +42,56 @@ jobs:
4242
run: |
4343
cd docs && make html
4444
45-
pytest-linux-386:
45+
pytest-linux-container:
4646
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
include:
51+
- arch_name: linux/386
52+
qemu_platform: 386
53+
image_name: gfloat-linux-386:py310-uv
54+
image_tar: /tmp/gfloat-linux-386-image.tar
55+
cache_prefix: linux-386-image
56+
test_script: etc/test-linux-386.sh
57+
- arch_name: linux/arm32
58+
qemu_platform: arm
59+
image_name: gfloat-linux-arm32:py310-uv
60+
image_tar: /tmp/gfloat-linux-arm32-image.tar
61+
cache_prefix: linux-arm32-image
62+
test_script: etc/test-linux-arm32.sh
4763

4864
steps:
4965
- uses: actions/checkout@v6
5066

51-
- name: Restore cached test image (linux/386)
52-
id: cache-linux-386-image
67+
- name: Restore cached test image (${{ matrix.arch_name }})
68+
id: cache-test-image
5369
uses: actions/cache@v5
5470
with:
55-
path: /tmp/gfloat-linux-386-image.tar
56-
key: ${{ runner.os }}-linux-386-image-${{ hashFiles('etc/linux-container.Dockerfile', 'requirements.txt', 'requirements-dev.txt', 'pyproject.toml') }}
71+
path: ${{ matrix.image_tar }}
72+
key: ${{ runner.os }}-${{ matrix.cache_prefix }}-${{ hashFiles('etc/linux-container.Dockerfile', 'requirements.txt', 'requirements-dev.txt', 'pyproject.toml') }}
5773

58-
- name: Enable QEMU emulation (linux/386)
74+
- name: Enable QEMU emulation (${{ matrix.arch_name }})
5975
uses: docker/setup-qemu-action@v4
6076
with:
61-
platforms: 386
77+
platforms: ${{ matrix.qemu_platform }}
6278

63-
- name: Load cached test image (linux/386)
79+
- name: Load cached test image (${{ matrix.arch_name }})
6480
run: |
65-
if [ -f /tmp/gfloat-linux-386-image.tar ]; then
66-
docker load -i /tmp/gfloat-linux-386-image.tar
81+
if [ -f "${{ matrix.image_tar }}" ]; then
82+
docker load -i "${{ matrix.image_tar }}"
6783
fi
6884
69-
- name: Ensure test image is available (linux/386)
85+
- name: Ensure test image is available (${{ matrix.arch_name }})
7086
run: |
71-
bash etc/test-linux-386.sh load
87+
bash "${{ matrix.test_script }}" load
7288
73-
- name: Run unit tests (linux/386)
89+
- name: Run unit tests (${{ matrix.arch_name }})
7490
run: |
75-
bash etc/test-linux-386.sh run -vv test
91+
bash "${{ matrix.test_script }}" run -vv test
7692
77-
- name: Save test image to cache path (linux/386)
93+
- name: Save test image to cache path (${{ matrix.arch_name }})
7894
if: always()
7995
run: |
80-
docker image inspect gfloat-linux-386:py310-uv >/dev/null 2>&1
81-
docker save gfloat-linux-386:py310-uv -o /tmp/gfloat-linux-386-image.tar
82-
83-
pytest-linux-arm32:
84-
runs-on: ubuntu-latest
85-
86-
steps:
87-
- uses: actions/checkout@v6
88-
89-
- name: Restore cached test image (linux/arm32)
90-
id: cache-linux-arm32-image
91-
uses: actions/cache@v5
92-
with:
93-
path: /tmp/gfloat-linux-arm32-image.tar
94-
key: ${{ runner.os }}-linux-arm32-image-${{ hashFiles('etc/linux-container.Dockerfile', 'requirements.txt', 'requirements-dev.txt', 'pyproject.toml') }}
95-
96-
- name: Enable QEMU emulation (linux/arm32)
97-
uses: docker/setup-qemu-action@v4
98-
with:
99-
platforms: arm
100-
101-
- name: Load cached test image (linux/arm32)
102-
run: |
103-
if [ -f /tmp/gfloat-linux-arm32-image.tar ]; then
104-
docker load -i /tmp/gfloat-linux-arm32-image.tar
105-
fi
106-
107-
- name: Ensure test image is available (linux/arm32)
108-
run: |
109-
bash etc/test-linux-arm32.sh load
110-
111-
- name: Run unit tests (linux/arm32)
112-
run: |
113-
bash etc/test-linux-arm32.sh run -vv test
114-
115-
- name: Save test image to cache path (linux/arm32)
116-
if: always()
117-
run: |
118-
docker image inspect gfloat-linux-arm32:py310-uv >/dev/null 2>&1
119-
docker save gfloat-linux-arm32:py310-uv -o /tmp/gfloat-linux-arm32-image.tar
96+
docker image inspect "${{ matrix.image_name }}" >/dev/null 2>&1
97+
docker save "${{ matrix.image_name }}" -o "${{ matrix.image_tar }}"

0 commit comments

Comments
 (0)