Skip to content

Commit

Permalink
Fix FreeBSD CI
Browse files Browse the repository at this point in the history
Fix freebsd ci issues, as mentioned in rbspy/freebsd-vagrant-box#1
  • Loading branch information
benfred committed Nov 17, 2023
1 parent bb0e7e8 commit 28a3b6b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,46 +118,48 @@ jobs:
path: dist

build-freebsd:
runs-on: macos-latest
runs-on: ubuntu-22.04
needs: [lint]
timeout-minutes: 30
strategy:
matrix:
include:
- box: fbsd_13_1
release: FreeBSD-13.1-STABLE
url: https://github.com/rbspy/freebsd-vagrant-box/releases/download/20221112/fbsd_13_1.box
- box: fbsd_14
steps:
- uses: actions/checkout@v3
- name: Cache Vagrant box
uses: actions/[email protected]
with:
path: ~/.vagrant.d
key: ${{ matrix.box }}-vagrant-boxes-20221112-${{ hashFiles('ci/Vagrantfile') }}
path: .vagrant.d
key: ${{ matrix.box }}-vagrant-boxes-20231115-${{ hashFiles('ci/Vagrantfile') }}
restore-keys: |
${{ matrix.box }}-vagrant-boxes-20221112-
${{ matrix.box }}-vagrant-boxes-20231115-
- name: Cache Cargo and build artifacts
uses: actions/[email protected]
with:
path: build-artifacts.tar
key: ${{ matrix.box }}-cargo-20221112-${{ hashFiles('**/Cargo.lock') }}
key: ${{ matrix.box }}-cargo-20231115-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.box }}-cargo-20221112-
${{ matrix.box }}-cargo-20231115-
- name: Display CPU info
run: lscpu
- name: Install VM tools
run: |
sudo apt-get install -qq -o=Dpkg::Use-Pty=0 moreutils
sudo chronic apt-get install -qq -o=Dpkg::Use-Pty=0 vagrant virtualbox qemu libvirt-daemon-system
- name: Set up VM
shell: sudo bash {0}
run: |
brew install vagrant
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-libvirt
vagrant plugin install vagrant-scp
ln -sf ci/Vagrantfile Vagrantfile
if [ ! -d ~/.vagrant.d/boxes/rbspy-VAGRANTSLASH-${{ matrix.release }} ]; then
vagrant box add --no-tty rbspy/${{ matrix.release }} ${{ matrix.url }}
fi
vagrant up ${{ matrix.box }}
vagrant status
vagrant up --no-tty --provider libvirt ${{ matrix.box }}
- name: Build and test
shell: sudo bash {0}
run: vagrant ssh ${{ matrix.box }} -- bash /vagrant/ci/test_freebsd.sh
- name: Retrieve build artifacts for caching purposes
shell: sudo bash {0}
run: |
vagrant scp ${{ matrix.box }}:/vagrant/build-artifacts.tar build-artifacts.tar
ls -ahl build-artifacts.tar
Expand Down
27 changes: 17 additions & 10 deletions ci/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
Vagrant.configure("2") do |config|
config.vm.define "fbsd_12_2" do |fbsd_12_2|
fbsd_12_2.vm.box = "rbspy/FreeBSD-12.2-STABLE"
config.vm.define "freebsd-14" do |c|
c.vm.box = "roboxes/freebsd14"
end
config.vm.define "fbsd_13_1" do |c|
c.vm.box = "rbspy/FreeBSD-13.1-STABLE"

config.vm.boot_timeout = 600

config.vm.provider "libvirt" do |qe|
# https://vagrant-libvirt.github.io/vagrant-libvirt/configuration.html
qe.driver = "kvm"
qe.cpus = 3
qe.memory = 8192
end

config.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: [".git", ".vagrant.d"]

config.vm.provision "shell", inline: <<~SHELL
pkg install -y python devel/llvm11
set -e
pkg install -y curl bash python llvm
chsh -s /usr/local/bin/bash vagrant
pw groupmod wheel -m vagrant
su -l vagrant <<'EOF'
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain 1.73.0
EOF
SHELL

config.vm.provider "virtualbox" do |v|
v.memory = 4096
v.cpus = 2
end
end

0 comments on commit 28a3b6b

Please sign in to comment.