Skip to content

Build Packages on Centos 7 (old kernel) #62

Build Packages on Centos 7 (old kernel)

Build Packages on Centos 7 (old kernel) #62

Workflow file for this run

name: Build Packages on Centos 7 (old kernel)
on:
workflow_dispatch:
inputs:
url:
description: The url of the GCC toolchain
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 10G
qemu-img convert -f qcow2 -O raw -o preallocation=full CentOS-7-x86_64-GenericCloud.qcow2 centos.img
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=raw,file=centos.img \
-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' || true
- name: Build
run: |
ref="${{ github.ref_name }}"
url="${{ inputs.url }}"
cat >build.sh <<EOF
set -e
uname -a
kernel="\$(uname -a | awk '{print \$3}')"
if [[ ! "\${kernel}" =~ 3.10.0-123.1.2* ]]; then
echo "The version of the kernel is wrong."
exit 1
fi
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 git
git clone https://github.com/adonis0147/devel-env
cd devel-env
git fetch --all --tags
git checkout "${ref}"
pushd devel/scripts
if [[ -z '${url}' ]]; then
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
else
curl -L '${url}' -o install_toolchain.sh
fi
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
cd devel/scripts
packages=(
tzdb
m4
zlib
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'