Skip to content

Commit

Permalink
Merge pull request #34 from eMoflon/hotfix/self-hosted-runner
Browse files Browse the repository at this point in the history
GitHub Actions CI: use self-hosted runners
  • Loading branch information
maxkratz authored Dec 5, 2023
2 parents 89729ca + a3a49ed commit 2fdbeb6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/vagrant-up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ on:

jobs:
vagrant-provision:
# Running on macOS, because macOS-based GitHub-hosted action runners do support nested virtualization.
# Running on self-hosted system(s), because GitHub-hosted action runners did break too often.
# https://github.com/actions/runner-images/issues/433
runs-on: macos-12

runs-on:
group: Default
labels: [self-hosted, Linux, X64]
steps:
- name: clean up old VMs
run: |
vboxmanage list vms | \
grep -o -P '(?<={).*(?=})' | \
while read line ; do vboxmanage unregistervm $line --delete ; done
- uses: actions/checkout@v3
- name: install dependencies
run: |
brew install wget unzip gnu-tar gnu-sed
- name: show Vagrant version
run: vagrant --version
- name: run vagrant up
Expand All @@ -45,9 +48,8 @@ jobs:
vboxmanage export emoflon -o emoflon.ovf
sed -i -e '/<BIOS>/,/<\/BIOS>/d' emoflon.ovf
sed -i -e '/<RemoteDisplay enabled="true">/,/<\/RemoteDisplay>/d' emoflon.ovf
gtar -cvf emoflon.ova emoflon.ovf emoflon-disk001.vmdk
tar -cvf emoflon.ova emoflon.ovf emoflon-disk001.vmdk
rm -rf emoflon.ovf emoflon-disk001.vmdk
# ^gtar (to use gnu-tar) instead of macOS tar
- name: upload artifact
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Unfortunately, only the macOS-based GitHub-hosted action runners do support nest

Therefore, we've adapted the CI-configuration to provision the **eMoflon-IBeX-VM** on a macOS-based runner until nested virtualization support gets added to the Linux-based runners.

Unfortunately, these workflows did break **very often** lately so we switched back to self-hosted Linux-based runners.

### Self-hosted Linux-based runners

Currently, all actions must be run by a self-hosted GitHub runner, because GitHub-hosted runners do not provide the VT-x flag:
Expand All @@ -62,4 +64,4 @@ Required packages (at least):
- `VirtualBox`
- `vagrant`
**Please keep in mind that your runner (VM) needs the virtualization flag enabled and at least 6 GB of RAM!**
**Please keep in mind that your runner (VM) needs the virtualization flag enabled and at least 10 GB of RAM!**
22 changes: 22 additions & 0 deletions runner-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

USERNAME=maxkratz

# utilities + sudo
apt-get update
apt-get install -yq sudo tmux htop wget grep sed gpg unzip tar
/sbin/adduser $USERNAME sudo

# VirtualBox
wget -O- -q https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmour -o /usr/share/keyrings/oracle_vbox_2016.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle_vbox_2016.gpg] http://download.virtualbox.org/virtualbox/debian bookworm contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list

apt-get update
apt-get install -yq virtualbox-7.0

# Vagrant
apt-get install -yq vagrant

echo "=> Prerequisites installed. Ready for GitHub Actions runner installation."

0 comments on commit 2fdbeb6

Please sign in to comment.