Update check-stage3.yml #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check and verify Stage3 builds | |
| on: | |
| schedule: | |
| - cron: '45 15-20 * * 0' | |
| - cron: '55 */6 * * *' | |
| push: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| CACHE_PATHS: | | |
| pxe/ipxe.efi | |
| pxe/online_boot.ipxe | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| latest_version: ${{ steps.get-version.outputs.version }} | |
| tag_exists: ${{ steps.check-tag.outputs.exists }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine Latest Gentoo Version | |
| id: get-version | |
| run: | | |
| . ./list_latest.sh | |
| VERSION="${FILE_STAGE3%.tar.xz}" | |
| echo "LATEST_VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if Git Tag Already Exists | |
| id: check-tag | |
| run: | | |
| if git rev-parse "refs/tags/${{ env.LATEST_VERSION }}" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "TAG_EXISTS=true" >> $GITHUB_ENV | |
| echo "Version ${{ env.LATEST_VERSION }} has already been tagged and released." | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "TAG_EXISTS=false" >> $GITHUB_ENV | |
| fi | |
| - name: ROM Cache | |
| if: env.TAG_EXISTS == 'false' | |
| id: ipxe-rom | |
| uses: actions/cache@v6 | |
| with: | |
| path: pxe | |
| key: ipxe-rom | |
| - name: Get working version of iPXE pcbios ROM | |
| if: env.TAG_EXISTS == 'false' && steps.ipxe-rom.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt update && sudo apt install git make gcc binutils perl liblzma-dev mtools | |
| git clone --depth 1 https://github.com/ipxe/ipxe.git | |
| mkdir -p pxe | |
| cd ipxe | |
| echo "#define DOWNLOAD_PROTO_HTTPS" >> src/config/local/general.h | |
| make -C src bin/virtio-net.rom bin/virtio-net.pxe -j4 | |
| cp src/bin/virtio-net.rom ../pxe | |
| cp src/bin/virtio-net.pxe ../pxe | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: generate | |
| if: needs.generate.outputs.tag_exists == 'false' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| mode: [pcbios, efi] | |
| include: | |
| - mode: pcbios | |
| run_args: "" | |
| - mode: efi | |
| run_args: "useefi usenvme" | |
| name: Test VM (${{ matrix.mode }}) | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v7 | |
| - name: ROM Cache | |
| uses: actions/cache@v6 | |
| with: | |
| fail-on-cache-miss: true | |
| path: pxe | |
| key: ipxe-rom | |
| - name: Initialize QEMU and System Dependencies | |
| run: | | |
| sudo apt update && sudo apt install -y qemu-system-x86 ovmf | |
| sudo chmod 666 /dev/kvm | |
| # in pcbios mode we override the rom used (q35 machine), ignoring efi since it is throwaway | |
| #strace -e trace=openat qemu-system-x86_64 -enable-kvm -M q35 -m 256 -nographic -nic user,model=virtio,tftp=.,bootfile=notthisfile.ipxe 2>&1 | grep -E "virtio|rom" | |
| [[ "${{ matrix.mode }}" == "pcbios" ]] && sudo cp pxe/virtio-net.rom /usr/lib/ipxe/qemu/efi-virtio.rom | |
| [[ "${{ matrix.mode }}" == "efi" ]] && sudo ln -s /usr/share/OVMF /usr/share/edk2-ovmf || true | |
| [[ "${{ matrix.mode }}" == "efi" ]] && sudo ln -s /usr/share/edk2-ovmf/OVMF_CODE_4M.fd /usr/share/edk2-ovmf/OVMF_CODE.fd || true | |
| [[ "${{ matrix.mode }}" == "efi" ]] && sudo ln -s /usr/share/edk2-ovmf/OVMF_VARS_4M.fd /usr/share/edk2-ovmf/OVMF_VARS.fd || true | |
| - name: Restore Work Directory Cache | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ env.CACHE_PATHS }} | |
| key: gentoo-ipxe-${{ needs.generate.outputs.latest_version }} | |
| - name: Execute VM | |
| run: | | |
| export LOGPFX="${{ matrix.mode }}" | |
| export RUNOPTS="${{ matrix.run_args }}" | |
| ./run_test_published_auto.sh | |
| - name: Upload Run Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: vmrun-${{ matrix.mode }} | |
| if-no-files-found: error | |
| path: | | |
| run_full.log | |
| run_metadata.txt | |
| run_vars.sh | |
| publish-release: | |
| runs-on: ubuntu-latest | |
| needs: [generate, test] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Download All Run Artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: vmrun-* | |
| path: vmruns/ | |
| - name: Create Release | |
| run: | | |
| VERSION="${{ needs.generate.outputs.latest_version }}" | |
| echo "Tagging repository and creating release: $VERSION" | |
| set -x | |
| ls -l vmruns vmruns/* | |
| echo todo grab versions and include some verions info in notes, also make sure the artifacts are available. | |
| cat vmruns/*/run*txt vmruns/*/run_vars.sh | |
| diff vmruns/*/run_vars.sh || echo vars diff, do exit | |
| RELEASE_FILES=() | |
| RELEASE_FILES+=("$expanded") | |
| ls -l "${RELEASE_FILES[@]}" | |
| echo gh release create "$VERSION" "${RELEASE_FILES[@]}" \ | |
| --repo "${{ github.repository }}" \ | |
| --title "Gentoo $VERSION" \ | |
| --notes "Automated test ok of Gentoo $VERSION" |