Skip to content

Commit

Permalink
ci(vagrant): add CI for scripts/Vagrantfile (#21864)
Browse files Browse the repository at this point in the history
* scripts(Vagrantfile): update to Ubuntu 24.04
  • Loading branch information
truboxl authored Oct 20, 2024
1 parent 0f36797 commit fddfbcb
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 2 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Vagrant

on:
push:
branches:
- master
- dev
- 'dev/**'
paths:
- '.github/workflows/vagrant.yml'
- 'scripts/Vagrantfile'
pull_request:
paths:
- '.github/workflows/vagrant.yml'
- 'scripts/Vagrantfile'
schedule:
# approx biweekly
- cron: '0 0 7,28 * *'
workflow_dispatch:

permissions: {} # none

jobs:
build:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Vagrant repo
run: |
# https://developer.hashicorp.com/vagrant/downloads#linux
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
- name: Install packages
run: |
sudo apt update
sudo apt install -y vagrant virtualbox
- name: Install vagrant-disksize plugin
run: vagrant plugin install vagrant-disksize
- name: Run "vagrant up" in scripts directory
run: |
cd scripts
vagrant up
- name: Test build coreutils
run: |
cd scripts
vagrant ssh -c "cd ~/termux-packages; ./build-package.sh coreutils"
- name: Generate build artifacts
run: |
if [[ -z "$(find output -type f)" ]]; then
echo "ERROR: No files found in output dir" 1>&2
exit 1
fi
mkdir -p artifacts debs
find output -name "*.deb" -type f -print0 | xargs -0r mv -t debs/
# Files containing certain symbols (e.g. ":") will cause failure in actions/upload-artifact.
# Archiving *.deb files in a tarball to avoid issues with uploading.
tar cf artifacts/debs-${{ github.sha }}.tar debs
- name: Store *.deb files
uses: actions/upload-artifact@v4
with:
name: debs-${{ github.sha }}
path: ./artifacts
10 changes: 8 additions & 2 deletions scripts/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

Vagrant.configure("2") do |config|

config.vm.box = "ubuntu/jammy64"
config.vm.box = "bento/ubuntu-24.04"

# default 300 is too short
config.vm.boot_timeout = 600

# use vagrant-disksize plugin to resize partition - https://github.com/sprotheroe/vagrant-disksize
config.disksize.size = '50GB'
Expand All @@ -19,7 +22,10 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", disabled: true

# Filesystem needs to be resized
config.vm.provision "shell", inline: "resize2fs /dev/sda1", privileged: true
config.vm.provision "shell", inline: "pwd"
config.vm.provision "shell", inline: "stat -f -c%T ."
config.vm.provision "shell", inline: "mount"
config.vm.provision "shell", inline: "resize2fs /dev/sda2", privileged: true

# Run environment setup scripts
config.vm.provision "shell", inline: "cd /home/vagrant/termux-packages && ./scripts/setup-ubuntu.sh", privileged: false
Expand Down

0 comments on commit fddfbcb

Please sign in to comment.