forked from magao-x/MagAOX
-
Notifications
You must be signed in to change notification settings - Fork 1
189 lines (189 loc) · 6.67 KB
/
build-vm-arm.yml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Build ARM virtual machine
on:
# schedule:
# - cron: '12 6 * * *'
# workflow_run:
# workflows: ["Rocky build"]
# types: [completed]
push:
branches: [xvm]
env:
vmArch: aarch64
jobs:
build-arm-stage1:
runs-on: macos-14
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Rocky ISO
uses: actions/cache@v4
id: cache-iso
with:
path: setup/xvm/input/iso
key: rocky-iso-${{ hashFiles('setup/xvm/_common.sh','setup/xvm/download_rocky_iso.sh') }}
- name: Cache first stage VM
uses: actions/cache@v4
id: cache-vm-stage1
with:
path: setup/xvm/stage1_outputs.tar
key: xvm-stage1-${{ runner.os }}-${{ hashFiles('setup/xvm/*','setup/xvm/kickstart/*','setup/xvm/utm/**') }}
- name: Download Rocky ISO
if: steps.cache-iso.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/setup/xvm/
bash download_rocky_iso.sh
- name: Install Homebrew
if: runner.os == 'macOS' && steps.cache-vm-stage1.outputs.cache-hit != 'true'
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Install QEMU for Ubuntu
if: runner.os == 'Linux' && steps.cache-vm-stage1.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-arm rpm2cpio
- name: Install QEMU for macOS
if: runner.os == 'macOS' && steps.cache-vm-stage1.outputs.cache-hit != 'true'
run: |
sysctl machdep.cpu
brew install qemu
- name: Create VM and install Rocky 9
if: steps.cache-vm-stage1.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/setup/xvm/
bash build_vm_stage1.sh
- name: Bundle outputs as tar file
if: steps.cache-vm-stage1.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/setup/xvm/
tar -cvf stage1_outputs.tar ./output/
rm ./output/*
- name: Upload stage 1 outputs
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: arm_stage1_vm
path: setup/xvm/stage1_outputs.tar
build-arm-stage2:
runs-on: macos-14
needs: build-arm-stage1
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache second stage VM
uses: actions/cache@v4
id: cache-vm-stage2
with:
path: setup/xvm/stage2_outputs.tar
key: xvm-stage2-${{ env.vmArch }}-${{ hashFiles('setup/**','!setup/xvm/**') }}
- name: Install QEMU for Ubuntu
if: runner.os == 'Linux' && steps.cache-vm-stage2.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-arm rpm2cpio
- name: Install QEMU for macOS
if: runner.os == 'macOS' && steps.cache-vm-stage2.outputs.cache-hit != 'true'
run: |
sysctl machdep.cpu
brew install qemu
- name: Download initial Rocky VM
if: steps.cache-vm-stage2.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: arm_stage1_vm
path: setup/xvm/
- name: Extract previous job outputs
if: steps.cache-vm-stage2.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/setup/xvm/
tar -xvf stage1_outputs.tar
mv -v output/xvm_stage1.qcow2 output/xvm.qcow2
- name: Install MagAO-X software
if: steps.cache-vm-stage2.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/setup/xvm/
bash build_vm_stage2.sh
- name: Bundle outputs as tar file
if: steps.cache-vm-stage2.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE/setup/xvm/
tar -cvf stage2_outputs.tar ./output/xvm_stage2.qcow2 ./output/xvm_key ./output/xvm_key.pub ./output/firmware_vars.fd ./output/firmware_code.fd
- name: Upload stage 2 outputs
uses: actions/upload-artifact@v4
with:
name: arm_stage2_vm
path: setup/xvm/stage2_outputs.tar
# build-arm-stage3:
# runs-on: macos-14
# needs: build-arm-stage2
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Install QEMU for Ubuntu
# if: runner.os == 'Linux'
# run: |
# sudo apt-get update
# sudo apt-get install -y qemu-system-arm rpm2cpio
# - name: Install QEMU for macOS
# if: runner.os == 'macOS'
# run: |
# sysctl machdep.cpu
# brew install qemu
# - name: Download Rocky VM with dependencies
# uses: actions/download-artifact@v4
# with:
# name: arm_stage2_vm
# path: setup/xvm/
# - name: Extract previous job outputs
# run: |
# cd $GITHUB_WORKSPACE/setup/xvm/
# tar -xvf stage2_outputs.tar
# mv -v output/xvm_stage2.qcow2 output/xvm.qcow2
# - name: Install MagAO-X software
# run: |
# cd $GITHUB_WORKSPACE/setup/xvm/
# bash build_vm_stage3.sh
# - name: Bundle outputs as tar file
# run: |
# cd $GITHUB_WORKSPACE/setup/xvm/
# tar -cvf stage3_outputs.tar ./output/xvm_stage3.qcow2 ./output/xvm_key ./output/xvm_key.pub ./output/firmware_vars.fd ./output/firmware_code.fd
# - name: Upload stage 3 outputs
# uses: actions/upload-artifact@v4
# with:
# name: arm_stage3_vm
# path: setup/xvm/stage3_outputs.tar
# build-arm-stage4-utm:
# runs-on: macos-14
# needs: build-arm-stage3
# permissions:
# contents: read
# packages: write
# steps:
# - name: Get built VM artifact
# uses: actions/download-artifact@v4
# with:
# name: arm_stage3_vm
# path: setup/xvm/output/
# - name: Extract previous job outputs
# run: |
# cd $GITHUB_WORKSPACE/setup/xvm/
# tar -xvf stage3_outputs.tar
# - name: Create UTM bundle
# run: |
# cd $GITHUB_WORKSPACE/setup/xvm/
# bash bundle_utm.sh
# - name: Upload UTM image
# uses: actions/upload-artifact@v4
# with:
# name: MagAO-X_VM
# path: |
# setup/xvm/output/MagAO-X_VM_bundle.tar.xz
# setup/xvm/output/xvm_key
# setup/xvm/output/xvm_key.pub