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