|
| 1 | +name: test |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | +jobs: |
| 6 | + integration: |
| 7 | + runs-on: ubuntu-22.04 |
| 8 | + timeout-minutes: 30 |
| 9 | + steps: |
| 10 | + - uses: actions/setup-go@v4 |
| 11 | + with: |
| 12 | + go-version: 1.20.x |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + with: |
| 15 | + fetch-depth: 1 |
| 16 | + - name: Run golangci-lint |
| 17 | + |
| 18 | + with: |
| 19 | + version: v1.52.2 |
| 20 | + args: --verbose |
| 21 | + - name: Unit tests |
| 22 | + run: go test -v ./... |
| 23 | + - name: Install go-qcow2reader-example |
| 24 | + run: go install ./cmd/go-qcow2reader-example |
| 25 | + - name: Install qemu-img as a test dependency |
| 26 | + run: | |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install -y qemu-utils |
| 29 | + - name: Cache test-images-ro |
| 30 | + id: cache-test-images-ro |
| 31 | + uses: actions/cache@v3 |
| 32 | + with: |
| 33 | + path: test-images-ro |
| 34 | + key: ${{ runner.os }}-integration |
| 35 | + - name: Prepare test-images-ro |
| 36 | + if: steps.cache-test-images-ro.outputs.cache-hit != 'true' |
| 37 | + run: | |
| 38 | + set -eux -o pipefail |
| 39 | + mkdir -p test-images-ro |
| 40 | + cd test-images-ro |
| 41 | + # version: 3, virtual size: 2GiB, cluster size: 16 bits (65536 bytes) |
| 42 | + curl -SL -O https://cloud.debian.org/images/cloud/bullseye/20230501-1367/debian-11-genericcloud-amd64-20230501-1367.qcow2 |
| 43 | + # Create a child image, with a custom size |
| 44 | + 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 |
| 45 | + # TODO: write something to the child image (with qemu-nbd?) |
| 46 | + - name: Prepare test-images |
| 47 | + run: cp -a test-images-ro test-images |
| 48 | + - name: "Test debian-11-genericcloud-amd64-20230501-1367.qcow2" |
| 49 | + run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.qcow2 |
| 50 | + - name: "Test debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2 (child image, with a custom size)" |
| 51 | + run: hack/compare-with-qemu-img.sh test-images/debian-11-genericcloud-amd64-20230501-1367.child_4G.qcow2 |
0 commit comments