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