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