xref: /freebsd/sys/contrib/openzfs/.github/workflows/zfs-qemu.yml (revision 160a2ba804973e4b258c24247fa7c0cdc230dfb4)
1name: zfs-qemu
2
3on:
4  push:
5  pull_request:
6  workflow_dispatch:
7    inputs:
8      include_stream9:
9        type: boolean
10        required: false
11        default: false
12        description: 'Test on CentOS 9 stream'
13      include_stream10:
14        type: boolean
15        required: false
16        default: false
17        description: 'Test on CentOS 10 stream'
18
19concurrency:
20  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21  cancel-in-progress: true
22
23jobs:
24  test-config:
25    name: Setup
26    runs-on: ubuntu-24.04
27    outputs:
28      test_os: ${{ steps.os.outputs.os }}
29      ci_type: ${{ steps.os.outputs.ci_type }}
30    steps:
31      - uses: actions/checkout@v4
32        with:
33          fetch-depth: 0
34      - name: Generate OS config and CI type
35        id: os
36        run: |
37          FULL_OS='["almalinux8", "almalinux9", "debian11", "debian12", "fedora40", "fedora41", "freebsd13-4r", "freebsd14-2r", "freebsd15-0c", "ubuntu20", "ubuntu22", "ubuntu24"]'
38          QUICK_OS='["almalinux8", "almalinux9", "debian12", "fedora41", "freebsd14-2r", "ubuntu24"]'
39          # determine CI type when running on PR
40          ci_type="full"
41          if ${{ github.event_name == 'pull_request' }}; then
42            head=${{ github.event.pull_request.head.sha }}
43            base=${{ github.event.pull_request.base.sha }}
44            ci_type=$(python3 .github/workflows/scripts/generate-ci-type.py $head $base)
45          fi
46          if [ "$ci_type" == "quick" ]; then
47            os_selection="$QUICK_OS"
48          else
49            os_selection="$FULL_OS"
50          fi
51          os_json=$(echo ${os_selection} | jq -c)
52
53          # Add optional runners
54          if [ "${{ github.event.inputs.include_stream9 }}" == 'true' ]; then
55            os_json=$(echo $os_json | jq -c '. += ["centos-stream9"]')
56          fi
57          if [ "${{ github.event.inputs.include_stream10 }}" == 'true' ]; then
58            os_json=$(echo $os_json | jq -c '. += ["centos-stream10"]')
59          fi
60
61          echo $os_json
62          echo "os=$os_json" >> $GITHUB_OUTPUT
63          echo "ci_type=$ci_type" >> $GITHUB_OUTPUT
64
65  qemu-vm:
66    name: qemu-x86
67    needs: [ test-config ]
68    strategy:
69      fail-fast: false
70      matrix:
71        # rhl:     almalinux8, almalinux9, centos-stream9, fedora40, fedora41
72        # debian:  debian11, debian12, ubuntu20, ubuntu22, ubuntu24
73        # misc:    archlinux, tumbleweed
74        # FreeBSD variants of 2024-12:
75        # FreeBSD Release: freebsd13-4r, freebsd14-2r
76        # FreeBSD Stable:  freebsd13-4s, freebsd14-2s
77        # FreeBSD Current: freebsd15-0c
78        os: ${{ fromJson(needs.test-config.outputs.test_os) }}
79    runs-on: ubuntu-24.04
80    steps:
81    - uses: actions/checkout@v4
82      with:
83        ref: ${{ github.event.pull_request.head.sha }}
84
85    - name: Setup QEMU
86      timeout-minutes: 10
87      run: .github/workflows/scripts/qemu-1-setup.sh
88
89    - name: Start build machine
90      timeout-minutes: 10
91      run: .github/workflows/scripts/qemu-2-start.sh ${{ matrix.os }}
92
93    - name: Install dependencies
94      timeout-minutes: 20
95      run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }}
96
97    - name: Build modules
98      timeout-minutes: 30
99      run: .github/workflows/scripts/qemu-4-build.sh --poweroff --enable-debug ${{ matrix.os }}
100
101    - name: Setup testing machines
102      timeout-minutes: 5
103      run: .github/workflows/scripts/qemu-5-setup.sh
104
105    - name: Run tests
106      timeout-minutes: 270
107      run: .github/workflows/scripts/qemu-6-tests.sh
108      env:
109        CI_TYPE: ${{ needs.test-config.outputs.ci_type }}
110
111    - name: Prepare artifacts
112      if: always()
113      timeout-minutes: 10
114      run: .github/workflows/scripts/qemu-7-prepare.sh
115
116    - uses: actions/upload-artifact@v4
117      id: artifact-upload
118      if: always()
119      with:
120        name: Logs-functional-${{ matrix.os }}
121        path: /tmp/qemu-${{ matrix.os }}.tar
122        if-no-files-found: ignore
123
124    - name: Test Summary
125      if: always()
126      run: .github/workflows/scripts/qemu-8-summary.sh '${{ steps.artifact-upload.outputs.artifact-url }}'
127
128  cleanup:
129    if: always()
130    name: Cleanup
131    runs-on: ubuntu-latest
132    needs: [ qemu-vm ]
133
134    steps:
135    - uses: actions/checkout@v4
136      with:
137        ref: ${{ github.event.pull_request.head.sha }}
138    - uses: actions/download-artifact@v4
139    - name: Generating summary
140      run: .github/workflows/scripts/qemu-9-summary-page.sh
141    - name: Generating summary...
142      run: .github/workflows/scripts/qemu-9-summary-page.sh 2
143    - name: Generating summary...
144      run: .github/workflows/scripts/qemu-9-summary-page.sh 3
145    - name: Generating summary...
146      run: .github/workflows/scripts/qemu-9-summary-page.sh 4
147    - name: Generating summary...
148      run: .github/workflows/scripts/qemu-9-summary-page.sh 5
149    - name: Generating summary...
150      run: .github/workflows/scripts/qemu-9-summary-page.sh 6
151    - name: Generating summary...
152      run: .github/workflows/scripts/qemu-9-summary-page.sh 7
153    - name: Generating summary...
154      run: .github/workflows/scripts/qemu-9-summary-page.sh 8
155    - name: Generating summary...
156      run: .github/workflows/scripts/qemu-9-summary-page.sh 9
157    - name: Generating summary...
158      run: .github/workflows/scripts/qemu-9-summary-page.sh 10
159    - name: Generating summary...
160      run: .github/workflows/scripts/qemu-9-summary-page.sh 11
161    - name: Generating summary...
162      run: .github/workflows/scripts/qemu-9-summary-page.sh 12
163    - name: Generating summary...
164      run: .github/workflows/scripts/qemu-9-summary-page.sh 13
165    - name: Generating summary...
166      run: .github/workflows/scripts/qemu-9-summary-page.sh 14
167    - name: Generating summary...
168      run: .github/workflows/scripts/qemu-9-summary-page.sh 15
169    - name: Generating summary...
170      run: .github/workflows/scripts/qemu-9-summary-page.sh 16
171    - name: Generating summary...
172      run: .github/workflows/scripts/qemu-9-summary-page.sh 17
173    - name: Generating summary...
174      run: .github/workflows/scripts/qemu-9-summary-page.sh 18
175    - name: Generating summary...
176      run: .github/workflows/scripts/qemu-9-summary-page.sh 19
177    - uses: actions/upload-artifact@v4
178      with:
179        name: Summary Files
180        path: out-*
181