-
Notifications
You must be signed in to change notification settings - Fork 7
154 lines (135 loc) · 4.8 KB
/
Copy pathcheck-stage3.yml
File metadata and controls
154 lines (135 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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: cache-rom
uses: actions/cache@v5
with:
path: pxe/virtio-net.rom
key: rom-cache
- name: Get working version of iPXE pcbios ROM
if: env.TAG_EXISTS == 'false' && steps.cache-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 -j4
cp src/bin/virtio-net.rom ../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@v5
with:
fail-on-cache-miss: true
path: pxe/virtio-net.rom
key: rom-cache
- name: Initialize QEMU and System Dependencies
run: |
sudo apt update && sudo apt install -y qemu-system-x86 ovmf
sudo chmod 666 /dev/kvm
ls -l /usr/share/qemu/firmware/ /usr/lib/ipxe/qemu/ /usr/share/qemu/ /usr/lib/ipxe/
sudo cp pxe/virtio-net.rom /usr/lib/ipxe/pxe-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@v5
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@v5
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.
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"