From 1617649fb6f5ae2b1d1818c8ddc0026f203338e4 Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Fri, 17 Nov 2023 11:50:25 -0800 Subject: [PATCH] Fix FreeBSD CI Fix freebsd ci issues, as mentioned in https://github.com/rbspy/freebsd-vagrant-box/issues/1 --- .github/workflows/build.yml | 38 +++++++++++++++++++------------------ ci/Vagrantfile | 27 ++++++++++++++++---------- ci/test_freebsd.sh | 13 +++++++++---- 3 files changed, 46 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29db710..a2b7ab1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,42 +78,44 @@ jobs: # if: matrix.target == 'x86_64-musl' 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: + - freebsd-14 steps: - uses: actions/checkout@v3 - name: Cache Vagrant box uses: actions/cache@v3.0.4 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/cache@v3.0.4 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 + diff --git a/ci/Vagrantfile b/ci/Vagrantfile index d88c4ba..c22b36a 100644 --- a/ci/Vagrantfile +++ b/ci/Vagrantfile @@ -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 diff --git a/ci/test_freebsd.sh b/ci/test_freebsd.sh index afe9e29..5eff807 100755 --- a/ci/test_freebsd.sh +++ b/ci/test_freebsd.sh @@ -1,21 +1,26 @@ #!/usr/bin/env bash -source ~/.bash_profile +source "$HOME/.cargo/env" set -e python --version cargo --version -export CARGO_HOME="/vagrant/.cargo" -mkdir -p $CARGO_HOME - cd /vagrant if [ -f build-artifacts.tar ]; then + echo "Unpacking cached build artifacts..." tar xf build-artifacts.tar rm -f build-artifacts.tar fi cargo build --release --workspace --all-targets cargo test --release + +set +e +tar cf build-artifacts.tar target +tar rf build-artifacts.tar "$HOME/.cargo/git" +tar rf build-artifacts.tar "$HOME/.cargo/registry" + +exit 0