Moves FreeBSD to compilation test only. (#1010)

FreeBSD is not natively supported by GitHub actions or Docker. To test
it, we had to run vagrant which is both time-consuming (~7minutes), and
frequently fails to setup, resulting in false negatives. Meanwhile the
code related to FreeBSD is quite limited and doesn't change.

This changes our approach to testing FreeBSD to the same as how we deal
with 386, which is to do compilation tests only.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-01-05 19:03:30 +08:00
committed by GitHub
parent bedde6dc7a
commit b5badb986f
5 changed files with 6 additions and 118 deletions

View File

@@ -87,39 +87,6 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
test_freebsd: # See /Vagrantfile for notes
name: amd64, FreeBSD, Go-${{ matrix.go-version }}
runs-on: macos-12
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: # Use versions consistent with wazero's Go support policy.
go-version:
- "1.19" # Current Go version
- "1.17" # Floor Go version of wazero (current - 2)
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with: # Note: This isn't really used, it is just to match versions.
go-version: ${{ matrix.go-version }}
- uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: spectest-${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum','Vagrantfile') }}-${{ matrix.spec-version }}
- name: Install Vagrant
run: brew install --cask vagrant
- name: Configure Vagrant
run: | # This ensures the same version of Go is used inside Vagrant.
GOVERSION=$(go env GOVERSION) GOARCH=$(go env GOARCH) vagrant up
- name: make test
run: vagrant ssh -c "cd wazero && make test"
test_scratch:
name: ${{ matrix.arch }}, Linux (scratch), Go-${{ matrix.go-version }}
runs-on: ubuntu-20.04

View File

@@ -46,41 +46,6 @@ jobs:
- run: make spectest.${{ matrix.spec-version }}
test_freebsd: # See /Vagrantfile for notes
name: ${{ matrix.spec-version }} - freebsd/amd64, Go-${{ matrix.go-version }}
runs-on: macos-12
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: # Use versions consistent with wazero's Go support policy.
go-version:
- "1.19" # Current Go version
- "1.17" # Floor Go version of wazero (current - 2)
spec-version:
- "v1"
- "v2"
steps:
- uses: actions/setup-go@v3
with: # Note: This isn't really used, it is just to match versions.
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: spectest-${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum','Vagrantfile') }}-${{ matrix.spec-version }}
- name: Install Vagrant
run: brew install --cask vagrant
- name: Configure Vagrant
run: | # This ensures the same version of Go is used inside Vagrant.
GOVERSION=$(go env GOVERSION) GOARCH=$(go env GOARCH) vagrant up
- name: make spectest.${{ matrix.spec-version }}
run: vagrant ssh -c "cd wazero && make spectest.${{ matrix.spec-version }}"
test_scratch:
name: ${{ matrix.spec-version }} / ${{ matrix.arch }}, Go-${{ matrix.go-version }}
runs-on: ubuntu-20.04

View File

@@ -225,6 +225,9 @@ check:
# Ensure we build on linux 386 for Trivy:
# gh release view -R aquasecurity/trivy --json assets --jq 'first(.assets[] | select(.name| test("Linux-32bit.*tar.gz")) | {url, downloadCount})'
@GOARCH=386 GOOS=linux go build ./...
# Ensure we build on FreeBSD amd64 for Trivy:
# gh release view -R aquasecurity/trivy --json assets --jq 'first(.assets[] | select(.name| test("FreeBSD-64bit.*tar.gz")) | {url, downloadCount})'
@GOARCH=amd64 GOOS=freebsd go build ./...
@$(MAKE) lint golangci_lint_goarch=arm64
@$(MAKE) lint golangci_lint_goarch=amd64
@$(MAKE) format

View File

@@ -96,14 +96,14 @@ systems are ones we test, but that doesn't necessarily mean other operating
system versions won't work.
We currently test Linux (Ubuntu and scratch), MacOS and Windows as packaged by
[GitHub Actions][11], as well FreeBSD via Vagrant/VirtualBox.
[GitHub Actions][11], as well compilation of 32-bit Linux and 64-bit FreeBSD.
* Interpreter
* Linux is tested on amd64 (native) as well arm64 and riscv64 via emulation.
* FreeBSD, MacOS and Windows are only tested on amd64.
* MacOS and Windows are only tested on amd64.
* Compiler
* Linux is tested on amd64 (native) as well arm64 via emulation.
* FreeBSD, MacOS and Windows are only tested on amd64.
* MacOS and Windows are only tested on amd64.
wazero has no dependencies and doesn't require CGO. This means it can also be
embedded in an application that doesn't use an operating system. This is a main

47
Vagrantfile vendored
View File

@@ -1,47 +0,0 @@
# 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