-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix freebsd ci issues, as mentioned in rbspy/freebsd-vagrant-box#1
- Loading branch information
Showing
3 changed files
with
46 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |