-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 2.37 KB
/
integration-test.yml
File metadata and controls
85 lines (72 loc) · 2.37 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Docker Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
docker-integration:
name: Docker Integration Tests
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64] # arm64 works but is very slow
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
platforms: linux/amd64,linux/arm64
- name: Create libvirt directories
run: |
sudo mkdir -p /var/run/libvirt
sudo mkdir -p /var/lib/libvirt
sudo chmod -R 777 /var/run/libvirt
sudo chmod -R 777 /var/lib/libvirt
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build and run tests
run: |
# Create test artifacts directory
mkdir -p test-artifacts
# Build the Docker image with GitHub Actions cache
docker buildx build \
--platform linux/${{ matrix.arch }} \
--build-arg BASE_IMAGE=node:20-slim \
-t libvirt-test-${{ matrix.arch }} \
--cache-from type=gha \
--cache-to type=gha,mode=max \
--load \
.
# Run the container with necessary privileges
docker run \
--platform linux/${{ matrix.arch }} \
--privileged \
-v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock \
-v /var/lib/libvirt:/var/lib/libvirt \
-v $(pwd)/test-artifacts:/app/test-artifacts \
--name test-container \
libvirt-test-${{ matrix.arch }}
# Copy coverage data from the container
docker cp test-container:/app/coverage ./coverage
docker rm test-container
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v6
with:
name: coverage-report-${{ matrix.arch }}
path: coverage/
retention-days: 14