Skip to content

Commit 4b0ac03

Browse files
committed
testing: Replace artifacts with cache
Unfortunately creating a gentoo image takes much longer than other images. Therefore, images will be cached for a week. Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
1 parent 834b371 commit 4b0ac03

File tree

5 files changed

+69
-36
lines changed

5 files changed

+69
-36
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -71,50 +71,59 @@ jobs:
7171
make check-unit
7272
7373
e2e-images:
74-
name: "prepare: ${{ matrix.name }}"
74+
name: "prepare: ${{ matrix.vendor }}"
7575
runs-on: ubuntu-latest
7676
needs: [ verify ]
7777
strategy:
7878
matrix:
79-
name: [
79+
vendor: [
8080
"altlinux",
8181
"fedora",
8282
"gentoo",
8383
"ubuntu",
8484
]
8585
fail-fast: true
8686
steps:
87+
- name: "Get Date"
88+
id: date
89+
run: |
90+
echo "date=$(date +'%Y-%V')" > "$GITHUB_OUTPUT"
91+
92+
- name: "Get Cache"
93+
uses: actions/cache@v4
94+
id: cache
95+
with:
96+
path: ~/.images/${{ matrix.vendor }}
97+
key: vendor-${{ matrix.vendor }}-${{ steps.date.outputs.date }}
98+
8799
- name: "Checkout Repository"
100+
if: steps.cache.outputs.cache-hit != 'true'
88101
uses: actions/checkout@v4
89102

90103
- name: "Create images"
91-
run: testing/testing-${{ matrix.name }}-local create-images
104+
if: steps.cache.outputs.cache-hit != 'true'
105+
run: testing/testing-${{ matrix.vendor }}-local create-images
92106

93107
- name: "Check image existence"
108+
if: steps.cache.outputs.cache-hit != 'true'
94109
run: |
95-
test -n "$(podman images -an --format='1' -f reference=localhost/image-${{ matrix.name }}:sysimage)"
96-
test -n "$(podman images -an --format='1' -f reference=localhost/image-${{ matrix.name }}:devel)"
110+
test -n "$(podman images -an --format='1' -f reference=localhost/image-${{ matrix.vendor }}:sysimage)"
111+
test -n "$(podman images -an --format='1' -f reference=localhost/image-${{ matrix.vendor }}:devel)"
97112
98113
- name: "Save podman images"
114+
if: steps.cache.outputs.cache-hit != 'true'
99115
run: |
100-
podman image save "localhost/image-${{ matrix.name }}:sysimage" | gzip -c > "/tmp/image-${{ matrix.name }}-sysimage.tar.gz"
101-
podman image save "localhost/image-${{ matrix.name }}:devel" | gzip -c > "/tmp/image-${{ matrix.name }}-devel.tar.gz"
102-
103-
- uses: actions/upload-artifact@v4
104-
with:
105-
name: image-${{ matrix.name }}
106-
path: /tmp/image-${{ matrix.name }}-*.tar.gz
107-
overwrite: true
108-
compression-level: 0
109-
retention-days: 1
116+
mkdir -p -- ~/.images/${{ matrix.vendor }}
117+
podman image save "localhost/image-${{ matrix.vendor }}:sysimage" | gzip -c > ~/.images/${{ matrix.vendor }}/image-sysimage.tar.gz
118+
podman image save "localhost/image-${{ matrix.vendor }}:devel" | gzip -c > ~/.images/${{ matrix.vendor }}/image-devel.tar.gz
110119
111120
e2e-local:
112-
name: "check: ${{ matrix.name }} ${{ matrix.testcase }}"
121+
name: "check: ${{ matrix.vendor }} ${{ matrix.testcase }}"
113122
needs: [ e2e-images ]
114123
runs-on: ubuntu-latest
115124
strategy:
116125
matrix:
117-
name: [
126+
vendor: [
118127
"altlinux",
119128
"fedora",
120129
"gentoo",
@@ -146,17 +155,35 @@ jobs:
146155
"zfs-partition",
147156
]
148157
exclude:
149-
- name: fedora
158+
- vendor: fedora
150159
testcase: zfs-partition
151160

152-
- name: altlinux
161+
- vendor: altlinux
153162
testcase: zfs-partition
154163

155-
- name: gentoo
164+
- vendor: gentoo
156165
testcase: zfs-partition
157166

158167
fail-fast: false
159168
steps:
169+
- name: "Get Date"
170+
id: date
171+
run: |
172+
echo "date=$(date +'%Y-%V')" > "$GITHUB_OUTPUT"
173+
174+
- name: "Get Cache"
175+
uses: actions/cache@v4
176+
id: cache
177+
with:
178+
path: ~/.images/${{ matrix.vendor }}
179+
key: vendor-${{ matrix.vendor }}-${{ steps.date.outputs.date }}
180+
fail-on-cache-miss: true
181+
182+
- name: "Load podman images"
183+
run: |
184+
podman image load -i=$HOME/.images/${{ matrix.vendor }}/image-sysimage.tar.gz
185+
podman image load -i=$HOME/.images/${{ matrix.vendor }}/image-devel.tar.gz
186+
160187
- name: "Prepare Node"
161188
run: |
162189
for m in kvm kvm-amd kvm-intel; do sudo modprobe -v "$m" ||:; done
@@ -175,43 +202,33 @@ jobs:
175202
git submodule set-url external/busybox/upstream https://github.com/mirror/busybox
176203
git submodule update --init --recursive
177204
178-
- uses: actions/download-artifact@v4
179-
with:
180-
name: image-${{ matrix.name }}
181-
path: /tmp/artifacts
182-
183-
- name: "Load podman images"
184-
run: |
185-
podman image load -i="/tmp/artifacts/image-${{ matrix.name }}-sysimage.tar.gz"
186-
podman image load -i="/tmp/artifacts/image-${{ matrix.name }}-devel.tar.gz"
187-
188205
- name: "Build Sources"
189-
run: testing/testing-${{ matrix.name }}-local test-root-${{ matrix.testcase }} build-sources
206+
run: testing/testing-${{ matrix.vendor }}-local test-root-${{ matrix.testcase }} build-sources
190207

191208
- name: "Build Sysimage"
192-
run: testing/testing-${{ matrix.name }}-local test-root-${{ matrix.testcase }} build-sysimage
209+
run: testing/testing-${{ matrix.vendor }}-local test-root-${{ matrix.testcase }} build-sysimage
193210

194211
- name: "Build Kickstart"
195-
run: testing/testing-${{ matrix.name }}-local test-root-${{ matrix.testcase }} build-kickstart
212+
run: testing/testing-${{ matrix.vendor }}-local test-root-${{ matrix.testcase }} build-kickstart
196213

197214
- name: "Run Kickstart"
198215
env:
199216
QEMU_TIMEOUT: 40m
200217
QEMU_MEMORY: 1G
201218
QEMU_DISK_FORMAT: qcow2
202-
run: testing/testing-${{ matrix.name }}-local test-root-${{ matrix.testcase }} run-kickstart
219+
run: testing/testing-${{ matrix.vendor }}-local test-root-${{ matrix.testcase }} run-kickstart
203220

204221
- name: "Boot System"
205222
env:
206223
QEMU_TIMEOUT: 10m
207224
QEMU_MEMORY: 1G
208225
QEMU_DISK_FORMAT: qcow2
209-
run: testing/testing-${{ matrix.name }}-local test-root-${{ matrix.testcase }} run-boot
226+
run: testing/testing-${{ matrix.vendor }}-local test-root-${{ matrix.testcase }} run-boot
210227

211228
- name: "Archive Metrics"
212229
uses: actions/upload-artifact@v4
213230
with:
214-
name: "metrics-${{ matrix.name }}-local-${{ matrix.testcase }}"
231+
name: "metrics-${{ matrix.vendor }}-local-${{ matrix.testcase }}"
215232
path: testing/status/artifact-*.txt
216233
if-no-files-found: ignore
217234
retention-days: 1

testing/testing-altlinux-local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ image_cleanup()
4848
for step in "$@"; do
4949
case "$step" in
5050
create-images)
51+
gh_group_start "create sysimage image"
5152
run podman image build --squash --force-rm \
5253
--pull=missing \
5354
-t "localhost/image-$VENDOR:sysimage" \
@@ -61,7 +62,9 @@ for step in "$@"; do
6162
RUN $(image_depmod)
6263
RUN $(image_cleanup)
6364
EOF
65+
gh_group_end
6466

67+
gh_group_start "create devel image"
6568
run podman image build --squash --force-rm \
6669
--pull=never \
6770
-t "localhost/image-$VENDOR:devel" \
@@ -74,6 +77,7 @@ for step in "$@"; do
7477
RUN $(image_depmod)
7578
RUN $(image_cleanup)
7679
EOF
80+
gh_group_end
7781
;;
7882
build-sources)
7983
gh_group_start "building from git tree"

testing/testing-fedora-local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ image_cleanup()
6262
for step in "$@"; do
6363
case "$step" in
6464
create-images)
65+
gh_group_start "create sysimage image"
6566
run podman image build --squash --force-rm \
6667
--pull=missing \
6768
-t "localhost/image-$VENDOR:sysimage" \
@@ -73,7 +74,9 @@ for step in "$@"; do
7374
RUN $(image_depmod)
7475
RUN $(image_cleanup)
7576
EOF
77+
gh_group_end
7678

79+
gh_group_start "create devel image"
7780
run podman image build --squash --force-rm \
7881
--pull=never \
7982
-t "localhost/image-$VENDOR:devel" \
@@ -85,6 +88,7 @@ for step in "$@"; do
8588
RUN $(image_depmod)
8689
RUN $(image_cleanup)
8790
EOF
91+
gh_group_end
8892
;;
8993
build-sources)
9094
gh_group_start "building from git tree"

testing/testing-gentoo-local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ image_cleanup()
5353
for step in "$@"; do
5454
case "$step" in
5555
create-images)
56+
gh_group_start "create sysimage image"
5657
run podman image build --squash --force-rm \
5758
--pull=missing \
5859
-t "localhost/image-$VENDOR:sysimage" \
@@ -83,7 +84,9 @@ for step in "$@"; do
8384
done
8485
RUN mkdir -p /srv
8586
EOF
87+
gh_group_end
8688

89+
gh_group_start "create devel image"
8790
run podman image build --squash --force-rm \
8891
--pull=never \
8992
-t "localhost/image-$VENDOR:devel" \
@@ -98,6 +101,7 @@ for step in "$@"; do
98101
RUN $(image_cleanup)
99102
RUN mkdir -p /srv
100103
EOF
104+
gh_group_end
101105
;;
102106
build-sources)
103107
gh_group_start "building from git tree"

testing/testing-ubuntu-local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ image_cleanup()
4848
for step in "$@"; do
4949
case "$step" in
5050
create-images)
51+
gh_group_start "create sysimage image"
5152
run podman image build --squash --force-rm \
5253
--pull=missing \
5354
-t "localhost/image-$VENDOR:sysimage" \
@@ -61,7 +62,9 @@ for step in "$@"; do
6162
RUN $(image_depmod)
6263
RUN $(image_cleanup)
6364
EOF
65+
gh_group_end
6466

67+
gh_group_start "create devel image"
6568
run podman image build --squash --force-rm \
6669
--pull=never \
6770
-t "localhost/image-$VENDOR:devel" \
@@ -75,6 +78,7 @@ for step in "$@"; do
7578
RUN $(image_depmod)
7679
RUN $(image_cleanup)
7780
EOF
81+
gh_group_end
7882
;;
7983
build-sources)
8084
gh_group_start "building from git tree"

0 commit comments

Comments
 (0)