Skip to content

Commit 2638a75

Browse files
committed
Add workflows for gigabyte-ampere-cuttlefish-installer
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
1 parent dc292b9 commit 2638a75

2 files changed

Lines changed: 350 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Prepare testbed for Gigabyte Ampere Cuttlefish installer'
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Install required packages
7+
shell: bash
8+
run: |
9+
apt-get update
10+
apt-get upgrade -y
11+
apt-get install -y sudo
12+
apt-get install -y debconf-utils
13+
echo "tzdata tzdata/Areas select Etc" | debconf-set-selections -v
14+
echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections -v
15+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
16+
dpkg-reconfigure --frontend noninteractive tzdata
17+
echo "pbuilder pbuilder/mirrorsite string http://deb.debian.org/debian/" | debconf-set-selections -v
18+
DEBIAN_FRONTEND=noninteractive apt-get install -y pbuilder
19+
dpkg-reconfigure --frontend noninteractive pbuilder
20+
apt-get install -y util-linux util-linux-extra
21+
apt-get install -y xz-utils
22+
apt-get install -y qemu-system-arm
23+
apt-get install -y expect
24+
apt-get install -y gdisk
25+
apt-get install -y e2tools e2fsprogs
26+
apt-get install -y fatcat mtools dosfstools
27+
apt-get install -y guestfish
28+
apt-get install -y lvm2
29+
apt-get install -y ubuntu-dev-tools
30+
apt-get install -y sshpass
31+
apt-get install -y openssh-client
32+
apt-get install -y u-boot-qemu
33+
apt-get install -y udev libgudev-1.0-dev
34+
apt-get install -y wget curl
35+
apt-get install -y screen
36+
- name: Extract artifacts
37+
working-directory: ./gigabyte-ampere-cuttlefish-installer
38+
shell: bash
39+
run: |
40+
mv ../preseed-mini.iso.xz .
41+
xz -d preseed-mini.iso.xz
42+
chmod a-w preseed-mini.iso
Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
name: Workflow for Gigabyte Ampere Server Cuttlefish Installer
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'gigabyte-ampere-cuttlefish-installer/**'
7+
push:
8+
branchs:
9+
- '**'
10+
11+
jobs:
12+
build-installer-iso-job:
13+
runs-on: ubuntu-22.04
14+
container:
15+
image: debian@sha256:9258a75a7e4323c9e5562b361effc84ee747920116d8adfc98a465a5cdc9150e # debian:bookworm-20250407 (amd64)
16+
defaults:
17+
run:
18+
working-directory: ./gigabyte-ampere-cuttlefish-installer
19+
env:
20+
DEBIAN_ISO_URL: "https://deb.debian.org/debian/dists/bookworm/main/installer-arm64/current/images/netboot/mini.iso"
21+
CI_PROJECT_NAME: ${{ github.event.repository.name }}
22+
CI_PIPELINE_ID: ${{ github.run_id }}
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
- name: Setting up build environment
27+
run: |
28+
apt-get update
29+
apt-get upgrade -y
30+
apt-get install -y sudo
31+
apt-get install -y wget libarchive-tools
32+
apt-get install -y xorriso
33+
apt-get install -y cpio xz-utils
34+
apt-get install -y fdisk
35+
- name: Build the iso image
36+
run: |
37+
sed -i "2i CI_PROJECT_NAME=${CI_PROJECT_NAME}" preseed/after_install_1.sh
38+
sed -i "3i CI_PIPELINE_ID=${CI_PIPELINE_ID}" preseed/after_install_1.sh
39+
wget -nv -c ${DEBIAN_ISO_URL}
40+
./addpreseed.sh
41+
xz -9e preseed-mini.iso
42+
- name: Upload artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: gigabyte-ampere-cuttlefish-installer-artifacts
46+
path: gigabyte-ampere-cuttlefish-installer/preseed-mini.iso.xz
47+
48+
test-iso-qemu-job:
49+
needs: [build-installer-iso-job]
50+
runs-on: ubuntu-22.04-arm
51+
container:
52+
image: debian@sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91 # debian:trixie-20260202
53+
defaults:
54+
run:
55+
working-directory: ./gigabyte-ampere-cuttlefish-installer
56+
env:
57+
TEST_DISK_SIZE: "10G"
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
- name: Download artifacts
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: gigabyte-ampere-cuttlefish-installer-artifacts
65+
- name: Prepare test environment
66+
uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-prepare-testbed
67+
- name: Copy test scripts
68+
run: |
69+
cp -f tests/installer-iso-* .
70+
- name: Run installer on qemu
71+
run: |
72+
./installer-iso-install.expect successful_install sheeFei2
73+
- name: Extract partitions
74+
run: |
75+
./installer-iso-extract-partitions.sh
76+
- name: Check if installation is successful
77+
run: |
78+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
79+
echo sheeFei2 > successful_install_compare
80+
cmp successful_install successful_install_compare
81+
- name: Check if kernel is installed
82+
run: |
83+
e2ls -l boot.img:/vmlinuz-*
84+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
85+
test -e vmlinuz-*
86+
- name: Check if Cuttlefish Debian packages are installed
87+
run: |
88+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
89+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
90+
- name: Check we don't have home partition
91+
run: |
92+
test '!' -e home.img
93+
94+
test-iso-multidisk-qemu-empty-disk-job:
95+
needs: [build-installer-iso-job]
96+
runs-on: ubuntu-22.04-arm
97+
container:
98+
image: debian@sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91 # debian:trixie-20260202
99+
defaults:
100+
run:
101+
working-directory: ./gigabyte-ampere-cuttlefish-installer
102+
steps:
103+
- name: Checkout repository
104+
uses: actions/checkout@v4
105+
- name: Download artifacts
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: gigabyte-ampere-cuttlefish-installer-artifacts
109+
- name: Prepare test environment
110+
uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-prepare-testbed
111+
- name: Copy test scripts
112+
run: |
113+
cp -f tests/installer-iso-* .
114+
cp -f tests/multidisk/installer-iso-* .
115+
- name: Create Empty 2 disks
116+
run: |
117+
./tests/multidisk/installer-create-empty-disk2.sh
118+
- name: Run installer on qemu
119+
run: |
120+
./installer-iso-install.expect successful_install eD4uvei1
121+
- name: Extract partitions
122+
run: |
123+
./installer-iso-extract-partitions-multidisk.sh
124+
- name: Check if rootfs is larger than 8G.
125+
run: |
126+
test $(stat -c '%s' rootfs.img) '-gt' 8589934592
127+
- name: Check if installation is successful
128+
run: |
129+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
130+
echo eD4uvei1 > successful_install_compare
131+
cmp successful_install successful_install_compare
132+
- name: Check if kernel is installed
133+
run: |
134+
e2ls -l boot.img:/vmlinuz-*
135+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
136+
test -e vmlinuz-*
137+
- name: Check if Cuttlefish Debian packages are installed
138+
run: |
139+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
140+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
141+
142+
test-iso-multidisk-qemu-disk2-with-data-job:
143+
needs: [build-installer-iso-job]
144+
runs-on: ubuntu-22.04-arm
145+
container:
146+
image: debian@sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91 # debian:trixie-20260202
147+
defaults:
148+
run:
149+
working-directory: ./gigabyte-ampere-cuttlefish-installer
150+
steps:
151+
- name: Checkout repository
152+
uses: actions/checkout@v4
153+
- name: Download artifacts
154+
uses: actions/download-artifact@v4
155+
with:
156+
name: gigabyte-ampere-cuttlefish-installer-artifacts
157+
- name: Prepare test environment
158+
uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-prepare-testbed
159+
- name: Copy test scripts
160+
run: |
161+
cp -f tests/installer-iso-* .
162+
cp -f tests/multidisk/installer-iso-* .
163+
- name: Create 2 disks with preinstalled partitions.
164+
run: |
165+
./tests/multidisk/installer-create-preinstalled-disk2.sh
166+
- name: Run installer on qemu
167+
run: |
168+
./installer-iso-install.expect successful_install Daiyaik0
169+
- name: Extract partitions
170+
run: |
171+
./installer-iso-extract-partitions-multidisk.sh
172+
- name: Check if rootfs is larger than 8G.
173+
run: |
174+
test $(stat -c '%s' rootfs.img) '-gt' 8589934592
175+
- name: Check if installation is successful
176+
run: |
177+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
178+
echo Daiyaik0 > successful_install_compare
179+
cmp successful_install successful_install_compare
180+
- name: Check if kernel is installed
181+
run: |
182+
e2ls -l boot.img:/vmlinuz-*
183+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
184+
test -e vmlinuz-*
185+
- name: Check if Cuttlefish Debian packages are installed
186+
run: |
187+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
188+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
189+
190+
test-iso-multidisk-qemu-disk5-with-data-job:
191+
needs: [build-installer-iso-job]
192+
runs-on: ubuntu-22.04-arm
193+
container:
194+
image: debian@sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91 # debian:trixie-20260202
195+
defaults:
196+
run:
197+
working-directory: ./gigabyte-ampere-cuttlefish-installer
198+
steps:
199+
- name: Checkout repository
200+
uses: actions/checkout@v4
201+
- name: Download artifacts
202+
uses: actions/download-artifact@v4
203+
with:
204+
name: gigabyte-ampere-cuttlefish-installer-artifacts
205+
- name: Prepare test environment
206+
uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-prepare-testbed
207+
- name: Copy test scripts
208+
run: |
209+
cp -f tests/installer-iso-* .
210+
cp -f tests/multidisk/installer-iso-* .
211+
- name: Create 5 disks with preinstalled partitions.
212+
run: |
213+
./tests/multidisk/installer-create-preinstalled-disk5.sh
214+
- name: Run installer on qemu
215+
run: |
216+
./installer-iso-install.expect successful_install AiT7eipi
217+
- name: Extract partitions
218+
run: |
219+
./installer-iso-extract-partitions-multidisk.sh
220+
- name: Check if rootfs is larger than 8G.
221+
run: |
222+
test $(stat -c '%s' rootfs.img) '-gt' 8589934592
223+
- name: Check if installation is successful
224+
run: |
225+
e2cp rootfs.img:/home/vsoc-01/successful_install successful_install
226+
echo AiT7eipi > successful_install_compare
227+
cmp successful_install successful_install_compare
228+
- name: Check if kernel is installed
229+
run: |
230+
e2ls -l boot.img:/vmlinuz-*
231+
e2cp boot.img:/$(e2ls boot.img:/vmlinuz-* | tail -1) .
232+
test -e vmlinuz-*
233+
- name: Check if Cuttlefish Debian packages are installed
234+
run: |
235+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator
236+
e2ls -l rootfs.img:/usr/bin/cvd_host_orchestrator | grep cvd_host_orchestrator | grep root
237+
238+
test-iso-cf-qemu-job:
239+
needs: [build-installer-iso-job]
240+
runs-on: ubuntu-22.04-arm
241+
container:
242+
image: debian@sha256:2c91e484d93f0830a7e05a2b9d92a7b102be7cab562198b984a84fdbc7806d91 # debian:trixie-20260202
243+
defaults:
244+
run:
245+
working-directory: ./gigabyte-ampere-cuttlefish-installer
246+
steps:
247+
- name: Checkout repository
248+
uses: actions/checkout@v4
249+
- name: Download artifacts
250+
uses: actions/download-artifact@v4
251+
with:
252+
name: gigabyte-ampere-cuttlefish-installer-artifacts
253+
- name: Prepare test environment
254+
uses: ./.github/actions/gigabyte-ampere-cuttlefish-installer-prepare-testbed
255+
- name: Copy test scripts
256+
run: |
257+
cp -f tests/installer-iso-* .
258+
- name: Run installer on qemu
259+
run: |
260+
./installer-iso-install.expect
261+
- name: Download Cuttlefish
262+
run: |
263+
./utils/download-ci-cf.sh
264+
- name: Start qemu again. Normal boot.
265+
run: |
266+
screen -d -m -L -Logfile console_001.log ./installer-iso-run-qemu.sh
267+
while ! egrep "[^[:space:]]+[[:space:]]login:" console_001.log; do sleep 30; done
268+
cp -f console_001.log console_001_p1.log
269+
CONSOLELINES=$(cat console_001_p1.log | wc -l)
270+
cat console_001_p1.log
271+
grep "login:" console_001_p1.log > /dev/null
272+
echo "CONSOLELINES=${CONSOLELINES}" >> $GITHUB_ENV
273+
- name: Deploy cuttlefish
274+
run: |
275+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k apt-get install -y unzip'
276+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'mkdir cf'
277+
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 cvd-host_package.tar.gz vsoc-01@localhost:/home/vsoc-01/
278+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; tar -xvf ../cvd-host_package.tar.gz'
279+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'rm -f cvd-host_package.tar.gz'
280+
sshpass -p cuttlefish scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -P 33322 aosp_cf_arm64*_phone-*.zip vsoc-01@localhost:/home/vsoc-01/
281+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; unzip ../aosp_cf_arm64*_phone-*.zip'
282+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'rm -f aosp_cf_arm64*_phone-*.zip'
283+
- name: Run cuttlefish command line
284+
run: |
285+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'cd cf; HOME=$PWD ./bin/launch_cvd -help' || true
286+
- name: Run apt-cache policy
287+
run: |
288+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'apt-cache policy'
289+
- name: Test for lzop
290+
run: |
291+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'lzop -V'
292+
- name: Test for Google NTP server
293+
run: |
294+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p'
295+
CHECK_GOOGLE_TIME_SERVER=0
296+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p' | grep 'time1.google' && CHECK_GOOGLE_TIME_SERVER=1
297+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ntpq -p' | grep '.GOOG.' && CHECK_GOOGLE_TIME_SERVER=1
298+
if [ x"${CHECK_GOOGLE_TIME_SERVER}" != x"1" ]; then echo "Google Time Servers not found!"; false; fi
299+
- name: Test for ulimit
300+
run: |
301+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ulimit -a'
302+
test $(sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'ulimit -n') -ge 2048
303+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'update-alternatives --display iptables' | grep "link currently points to /usr/sbin/iptables-legacy"
304+
- name: Shutdown qemu
305+
run: |
306+
sshpass -p cuttlefish ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -p 33322 vsoc-01@localhost 'echo cuttlefish | sudo -S -k shutdown -h 1'
307+
while ! grep "reboot: Power down" console_001.log; do sleep 30; done
308+
tail -n +"${CONSOLELINES}" console_001.log

0 commit comments

Comments
 (0)