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-3r", "freebsd13-4s", "freebsd14-1r", "freebsd14-2s", "freebsd15-0c", "ubuntu20", "ubuntu22", "ubuntu24"]' 38 QUICK_OS='["almalinux8", "almalinux9", "debian12", "fedora41", "freebsd13-3r", "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 66 67 68 qemu-vm: 69 name: qemu-x86 70 needs: [ test-config ] 71 strategy: 72 fail-fast: false 73 matrix: 74 # rhl: almalinux8, almalinux9, centos-stream9, fedora40, fedora41 75 # debian: debian11, debian12, ubuntu20, ubuntu22, ubuntu24 76 # misc: archlinux, tumbleweed 77 # FreeBSD variants of 2024-12: 78 # FreeBSD Release: freebsd13-3r, freebsd13-4r, freebsd14-1r, freebsd14-2r 79 # FreeBSD Stable: freebsd13-4s, freebsd14-2s 80 # FreeBSD Current: freebsd15-0c 81 os: ${{ fromJson(needs.test-config.outputs.test_os) }} 82 runs-on: ubuntu-24.04 83 steps: 84 - uses: actions/checkout@v4 85 with: 86 ref: ${{ github.event.pull_request.head.sha }} 87 88 - name: Setup QEMU 89 timeout-minutes: 10 90 run: .github/workflows/scripts/qemu-1-setup.sh 91 92 - name: Start build machine 93 timeout-minutes: 10 94 run: .github/workflows/scripts/qemu-2-start.sh ${{ matrix.os }} 95 96 - name: Install dependencies 97 timeout-minutes: 20 98 run: | 99 echo "Install dependencies in QEMU machine" 100 IP=192.168.122.10 101 while pidof /usr/bin/qemu-system-x86_64 >/dev/null; do 102 ssh 2>/dev/null zfs@$IP "uname -a" && break 103 done 104 scp .github/workflows/scripts/qemu-3-deps.sh zfs@$IP:qemu-3-deps.sh 105 PID=`pidof /usr/bin/qemu-system-x86_64` 106 ssh zfs@$IP '$HOME/qemu-3-deps.sh' ${{ matrix.os }} 107 # wait for poweroff to succeed 108 tail --pid=$PID -f /dev/null 109 sleep 5 # avoid this: "error: Domain is already active" 110 rm -f $HOME/.ssh/known_hosts 111 112 - name: Build modules 113 timeout-minutes: 30 114 run: | 115 echo "Build modules in QEMU machine" 116 sudo virsh start openzfs 117 IP=192.168.122.10 118 while pidof /usr/bin/qemu-system-x86_64 >/dev/null; do 119 ssh 2>/dev/null zfs@$IP "uname -a" && break 120 done 121 rsync -ar $HOME/work/zfs/zfs zfs@$IP:./ 122 ssh zfs@$IP '$HOME/zfs/.github/workflows/scripts/qemu-4-build.sh' ${{ matrix.os }} 123 124 - name: Setup testing machines 125 timeout-minutes: 5 126 run: .github/workflows/scripts/qemu-5-setup.sh 127 128 - name: Run tests 129 timeout-minutes: 270 130 run: .github/workflows/scripts/qemu-6-tests.sh 131 env: 132 CI_TYPE: ${{ needs.test-config.outputs.ci_type }} 133 134 - name: Prepare artifacts 135 if: always() 136 timeout-minutes: 10 137 run: .github/workflows/scripts/qemu-7-prepare.sh 138 139 - uses: actions/upload-artifact@v4 140 id: artifact-upload 141 if: always() 142 with: 143 name: Logs-functional-${{ matrix.os }} 144 path: /tmp/qemu-${{ matrix.os }}.tar 145 if-no-files-found: ignore 146 147 - name: Test Summary 148 if: always() 149 run: .github/workflows/scripts/qemu-8-summary.sh '${{ steps.artifact-upload.outputs.artifact-url }}' 150 151 cleanup: 152 if: always() 153 name: Cleanup 154 runs-on: ubuntu-latest 155 needs: [ qemu-vm ] 156 157 steps: 158 - uses: actions/checkout@v4 159 with: 160 ref: ${{ github.event.pull_request.head.sha }} 161 - uses: actions/download-artifact@v4 162 - name: Generating summary 163 run: .github/workflows/scripts/qemu-9-summary-page.sh 164 - name: Generating summary... 165 run: .github/workflows/scripts/qemu-9-summary-page.sh 2 166 - name: Generating summary... 167 run: .github/workflows/scripts/qemu-9-summary-page.sh 3 168 - name: Generating summary... 169 run: .github/workflows/scripts/qemu-9-summary-page.sh 4 170 - name: Generating summary... 171 run: .github/workflows/scripts/qemu-9-summary-page.sh 5 172 - name: Generating summary... 173 run: .github/workflows/scripts/qemu-9-summary-page.sh 6 174 - name: Generating summary... 175 run: .github/workflows/scripts/qemu-9-summary-page.sh 7 176 - name: Generating summary... 177 run: .github/workflows/scripts/qemu-9-summary-page.sh 8 178 - name: Generating summary... 179 run: .github/workflows/scripts/qemu-9-summary-page.sh 9 180 - name: Generating summary... 181 run: .github/workflows/scripts/qemu-9-summary-page.sh 10 182 - name: Generating summary... 183 run: .github/workflows/scripts/qemu-9-summary-page.sh 11 184 - name: Generating summary... 185 run: .github/workflows/scripts/qemu-9-summary-page.sh 12 186 - name: Generating summary... 187 run: .github/workflows/scripts/qemu-9-summary-page.sh 13 188 - name: Generating summary... 189 run: .github/workflows/scripts/qemu-9-summary-page.sh 14 190 - name: Generating summary... 191 run: .github/workflows/scripts/qemu-9-summary-page.sh 15 192 - name: Generating summary... 193 run: .github/workflows/scripts/qemu-9-summary-page.sh 16 194 - name: Generating summary... 195 run: .github/workflows/scripts/qemu-9-summary-page.sh 17 196 - name: Generating summary... 197 run: .github/workflows/scripts/qemu-9-summary-page.sh 18 198 - name: Generating summary... 199 run: .github/workflows/scripts/qemu-9-summary-page.sh 19 200 - uses: actions/upload-artifact@v4 201 with: 202 name: Summary Files 203 path: out-* 204