Files
wazero/Vagrantfile
Takeshi Yoneda 1b1da58e93 ci: fix DNS issue with FreeBSD VM (#864)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-11-28 13:17:45 +09:00

48 lines
1.6 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Vagrant file for FreeBSD
#
# Here's an example:
# GOVERSION=$(go env GOVERSION) GOARCH=$(go env GOARCH) vagrant up
# vagrant rsync
# vagrant ssh -c "cd wazero; go test ./..."
#
# Notes on FreeBSD:
# * GitHub Actions doesnt support FreeBSD, and may never.
# * We could use Travis to run FreeBSD, but it would split our CI config.
# * Using Vagrant directly is easier to debug than vmactions/freebsd-vm.
# * GitHub Actions only supports virtualization on MacOS.
# * GitHub Actions removed vagrant from the image starting with macos-11.
# * Since VirtualBox doesn't work on arm64, freebsd/arm64 is untestable.
Vagrant.configure("2") do |config|
config.vm.box = "generic/freebsd13"
config.vm.synced_folder ".", "/home/vagrant/wazero",
type: "rsync",
rsync__exclude: ".git/"
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 1
# To prevent any DNS-related provisioning errors:
# https://serverfault.com/questions/453185/vagrant-virtualbox-dns-10-0-2-3-not-working/506206
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
# Similar to `GOVERSION=$(go env GOVERSION) GOARCH=$(go env GOARCH) vagrant provision`
config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
sh.env = {
'GOVERSION': ENV['GOVERSION'],
'GOARCH': ENV['GOARCH'],
}
sh.inline = <<~GOINSTALL
set -eux -o pipefail
curl -fsSL "https://dl.google.com/go/${GOVERSION}.freebsd-${GOARCH}.tar.gz" | tar Cxz /usr/local
cat >> /usr/local/etc/profile <<EOF
export GOROOT=/usr/local/go
export PATH=/usr/local/go/bin:$PATH
EOF
GOINSTALL
end
end