From b5badb986f7380acabbc9b7742dfd8715057f67d Mon Sep 17 00:00:00 2001 From: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com> Date: Thu, 5 Jan 2023 19:03:30 +0800 Subject: [PATCH] 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 --- .github/workflows/commit.yaml | 33 ----------------------- .github/workflows/spectest.yaml | 35 ------------------------ Makefile | 3 +++ README.md | 6 ++--- Vagrantfile | 47 --------------------------------- 5 files changed, 6 insertions(+), 118 deletions(-) delete mode 100644 Vagrantfile diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index 68676d4e..f584a34a 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -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 diff --git a/.github/workflows/spectest.yaml b/.github/workflows/spectest.yaml index f4debf27..719ca8b8 100644 --- a/.github/workflows/spectest.yaml +++ b/.github/workflows/spectest.yaml @@ -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 diff --git a/Makefile b/Makefile index 7bf78841..606369d3 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 7d0edb27..2eac5c6a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 4b83bfdb..00000000 --- a/Vagrantfile +++ /dev/null @@ -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 doesn’t 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 <