-
Notifications
You must be signed in to change notification settings - Fork 7
61 lines (61 loc) · 2.86 KB
/
test.yml
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
name: test
on:
push:
branches:
- master
pull_request:
jobs:
integration:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.20.x
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run golangci-lint
uses: golangci/[email protected]
with:
version: v1.52.2
args: --verbose
- name: Install qemu-img as a test dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-utils
- name: Unit tests
run: go test -v ./...
- name: Install go-qcow2reader-example
run: cd ./cmd/go-qcow2reader-example && go install
- name: Cache test-images-ro
id: cache-test-images-ro
uses: actions/cache@v4
with:
path: test-images-ro
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/test.yml') }}
- name: Prepare test-images-ro
if: steps.cache-test-images-ro.outputs.cache-hit != 'true'
run: |
set -eux -o pipefail
mkdir -p test-images-ro
cd test-images-ro
# version: 3, virtual size: 2GiB, cluster size: 16 bits (65536 bytes)
curl -SL -O https://cloud.debian.org/images/cloud/bullseye/20230501-1367/debian-11-genericcloud-amd64-20230501-1367.qcow2
# Create a child image, with a custom size
qemu-img create -f qcow2 -b debian-11-genericcloud-amd64-20230501-1367.qcow2 -F qcow2 debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2 4G
# TODO: write something to the child image (with qemu-nbd?)
# Convert to zstd
qemu-img convert -f qcow2 -O qcow2 -o compression_type=zstd debian-11-genericcloud-amd64-20230501-1367.qcow2 debian-11-genericcloud-amd64-20230501-1367.zstd.qcow2
# Convert to ext_l2
qemu-img convert -f qcow2 -O qcow2 -o extended_l2=on debian-11-genericcloud-amd64-20230501-1367.qcow2 debian-11-genericcloud-amd64-20230501-1367.ext_l2.qcow2
- name: Prepare test-images
run: cp -a test-images-ro test-images
- name: "Test debian-11-genericcloud-amd64-20230501-1367.qcow2"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.qcow2
- name: "Test debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2 (child image, with a custom size)"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2
- name: "Test debian-11-genericcloud-amd64-20230501-1367.zstd.qcow2"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.zstd.qcow2
- name: "Test debian-11-genericcloud-amd64-20230501-1367.ext_l2.qcow2"
run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.ext_l2.qcow2