-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (76 loc) · 3.25 KB
/
build.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
name: Build Packages on Centos 7 (old kernel)
on: push
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Install prerequisites
run: |
sudo apt install qemu-system cloud-image-utils
cd .github/qemu
curl -LO 'https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2'
qemu-img resize CentOS-7-x86_64-GenericCloud.qcow2 50G
cloud-localds cloud-init.iso cloud-init/user-data.yaml cloud-init/meta-data.yaml
nohup qemu-system-x86_64 \
-accel tcg \
-smp "$(nproc)" \
-m 7G \
-drive if=virtio,format=qcow2,file=CentOS-7-x86_64-GenericCloud.qcow2 \
-cdrom cloud-init.iso \
-nic user,model=virtio-net-pci,hostfwd=tcp::2222-:22 \
-nographic &>/dev/null &
chmod 600 "$(pwd)"/cloud-init/ssh/id_rsa
while ! scp -o StrictHostKeyChecking=no -i "$(pwd)"/cloud-init/ssh/id_rsa -P 2222 "$(pwd)"/downgrade-kernel.sh [email protected]:~/; do
echo 'Retry...'
sleep 1
done
ssh -o StrictHostKeyChecking=no -i "$(pwd)"/cloud-init/ssh/id_rsa -p 2222 -n [email protected] 'sudo bash downgrade-kernel.sh'
- name: Build
run: |
ref="${{ github.ref_name }}"
cat >build.sh <<EOF
set -e
uname -a
sudo sed -i -e 's|mirrorlist=|#mirrorlist=|' -e 's|#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=https://vault.centos.org/7.9.2009|' /etc/yum.repos.d/CentOS-Base.repo
sudo yum -y install xz file make gettext texinfo git
git clone https://github.com/adonis0147/devel-env
cd devel-env
git fetch --all --tags
git checkout "${ref}"
pushd devel/scripts
latest="\$(curl -s 'https://api.github.com/repos/adonis0147/devel-env/releases/latest' | \
python -c "import json; import sys; print(json.load(sys.stdin)['tag_name'])")"
curl -L "https://github.com/adonis0147/devel-env/releases/download/\${latest}/install_toolchain_x86_64.sh" -o install_toolchain.sh
chmod a+x install_toolchain.sh
popd
devel/downloads/download_packages.sh
# Don't install llvm
sed -i '/function install_packages/,/^}/ s/llvm//' devel/scripts/install.sh
# Don't install zsh
sed -i '/function install_packages/,/^}/ s/zsh//' devel/scripts/install.sh
cd devel/scripts
packages=(
tzdb
m4
zlib
libdb
perl
autoconf
automake
libtool
make
pkg_config
cmake
ninja
)
bash install.sh "\${packages[@]}"
EOF
chmod 600 "$(pwd)"/.github/qemu/cloud-init/ssh/id_rsa
while ! scp -o StrictHostKeyChecking=no -i "$(pwd)"/.github/qemu/cloud-init/ssh/id_rsa -P 2222 build.sh [email protected]:~/; do
echo 'Retry...'
sleep 1
done
ssh -o StrictHostKeyChecking=no -i "$(pwd)"/.github/qemu/cloud-init/ssh/id_rsa -p 2222 -n [email protected] 'bash -x build.sh'