xref: /freebsd/sys/contrib/openzfs/.github/workflows/zfs-qemu.yml (revision df21a004be237a1dccd03c7b47254625eea62fa9)
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", "debian12", "debian13", "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=$os_json" | tee -a $GITHUB_OUTPUT
57          echo "ci_type=$ci_type" | tee -a $GITHUB_OUTPUT
58
59  qemu-vm:
60    name: qemu-x86
61    needs: [ test-config ]
62    strategy:
63      fail-fast: false
64      matrix:
65        # rhl:     almalinux8, almalinux9, centos-stream9, fedora4x
66        # debian:  debian12, debian13, ubuntu22, ubuntu24
67        # misc:    archlinux, tumbleweed
68        # FreeBSD variants of 2025-06:
69        # FreeBSD Release: freebsd13-5r, freebsd14-2r, freebsd14-3r
70        # FreeBSD Stable:  freebsd13-5s, freebsd14-3s
71        # FreeBSD Current: freebsd15-0c, freebsd16-0c
72        os: ${{ fromJson(needs.test-config.outputs.test_os) }}
73    runs-on: ubuntu-24.04
74    steps:
75    - uses: actions/checkout@v4
76      with:
77        ref: ${{ github.event.pull_request.head.sha }}
78
79    - name: Setup QEMU
80      timeout-minutes: 20
81      run: |
82        # Add a timestamp to each line to debug timeouts
83        while IFS=$'\n' read -r line; do
84            echo "$(date +'%H:%M:%S') $line"
85        done < <(.github/workflows/scripts/qemu-1-setup.sh)
86
87    - name: Start build machine
88      timeout-minutes: 10
89      run: .github/workflows/scripts/qemu-2-start.sh ${{ matrix.os }}
90
91    - name: Install dependencies
92      timeout-minutes: 20
93      run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }} ${{ github.event.inputs.fedora_kernel_ver }}
94
95    - name: Build modules
96      timeout-minutes: 30
97      run: .github/workflows/scripts/qemu-4-build.sh --poweroff --enable-debug ${{ matrix.os }}
98
99    - name: Setup testing machines
100      timeout-minutes: 5
101      run: .github/workflows/scripts/qemu-5-setup.sh
102
103    - name: Run tests
104      timeout-minutes: 270
105      run: .github/workflows/scripts/qemu-6-tests.sh
106      env:
107        CI_TYPE: ${{ needs.test-config.outputs.ci_type }}
108
109    - name: Prepare artifacts
110      if: always()
111      timeout-minutes: 10
112      run: .github/workflows/scripts/qemu-7-prepare.sh
113
114    - uses: actions/upload-artifact@v4
115      id: artifact-upload
116      if: always()
117      with:
118        name: Logs-functional-${{ matrix.os }}
119        path: /tmp/qemu-${{ matrix.os }}.tar
120        if-no-files-found: ignore
121
122    - name: Test Summary
123      if: always()
124      run: .github/workflows/scripts/qemu-8-summary.sh '${{ steps.artifact-upload.outputs.artifact-url }}'
125
126  cleanup:
127    if: always()
128    name: Cleanup
129    runs-on: ubuntu-latest
130    needs: [ qemu-vm ]
131
132    steps:
133    - uses: actions/checkout@v4
134      with:
135        ref: ${{ github.event.pull_request.head.sha }}
136    - uses: actions/download-artifact@v4
137    - name: Generating summary
138      run: .github/workflows/scripts/qemu-9-summary-page.sh
139    - name: Generating summary...
140      run: .github/workflows/scripts/qemu-9-summary-page.sh 2
141    - name: Generating summary...
142      run: .github/workflows/scripts/qemu-9-summary-page.sh 3
143    - name: Generating summary...
144      run: .github/workflows/scripts/qemu-9-summary-page.sh 4
145    - name: Generating summary...
146      run: .github/workflows/scripts/qemu-9-summary-page.sh 5
147    - name: Generating summary...
148      run: .github/workflows/scripts/qemu-9-summary-page.sh 6
149    - name: Generating summary...
150      run: .github/workflows/scripts/qemu-9-summary-page.sh 7
151    - name: Generating summary...
152      run: .github/workflows/scripts/qemu-9-summary-page.sh 8
153    - name: Generating summary...
154      run: .github/workflows/scripts/qemu-9-summary-page.sh 9
155    - name: Generating summary...
156      run: .github/workflows/scripts/qemu-9-summary-page.sh 10
157    - name: Generating summary...
158      run: .github/workflows/scripts/qemu-9-summary-page.sh 11
159    - name: Generating summary...
160      run: .github/workflows/scripts/qemu-9-summary-page.sh 12
161    - name: Generating summary...
162      run: .github/workflows/scripts/qemu-9-summary-page.sh 13
163    - name: Generating summary...
164      run: .github/workflows/scripts/qemu-9-summary-page.sh 14
165    - name: Generating summary...
166      run: .github/workflows/scripts/qemu-9-summary-page.sh 15
167    - name: Generating summary...
168      run: .github/workflows/scripts/qemu-9-summary-page.sh 16
169    - name: Generating summary...
170      run: .github/workflows/scripts/qemu-9-summary-page.sh 17
171    - name: Generating summary...
172      run: .github/workflows/scripts/qemu-9-summary-page.sh 18
173    - name: Generating summary...
174      run: .github/workflows/scripts/qemu-9-summary-page.sh 19
175    - uses: actions/upload-artifact@v4
176      with:
177        name: Summary Files
178        path: out-*
179