Skip to content

Merge pull request #970 from zonedb/dependabot/go_modules/golang.org/… #1726

Merge pull request #970 from zonedb/dependabot/go_modules/golang.org/…

Merge pull request #970 from zonedb/dependabot/go_modules/golang.org/… #1726

Workflow file for this run

name: Go
on:
push:
branches:
- main
pull_request:
jobs:
# Vet Go code
vet-go:
name: Vet Go code
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repo
uses: actions/checkout@v4.1.2
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5.0.0
with:
go-version-file: go.mod
- name: Vet Go code
run: go vet ./...
# Test with Go
test-go:
name: Test with Go
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
go-version: ["1.20", "1.21", "1.22"]
steps:
- name: Checkout repo
uses: actions/checkout@v4.1.2
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5.0.0
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Run Go tests
run: go test -v -bench . ./...
- name: Run Go tests with race detector
run: go test -v -race ./...
- name: Test Go without cgo
env:
CGO_ENABLED: 0
run: go test -v ./...
- name: Verify repo is unchanged
run: git diff --exit-code HEAD
# Test with TinyGo
test-tinygo:
name: Test with TinyGo
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
tinygo-version: ["0.30.0"]
go-version: ["1.20", "1.21"] # Disable Go 1.22 until TinyGo releases update
steps:
- name: Checkout repo
uses: actions/checkout@v4.1.2
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5.0.0
with:
go-version: ${{ matrix.go-version }}
- name: Set up TinyGo
uses: acifani/setup-tinygo@v2.0.0
with:
tinygo-version: ${{ matrix.tinygo-version }}
- name: Test with TinyGo
# This only tests the apex package, not ./internal/build
# due to TinyGo support for net.UDPConn and net.IPConn
run: tinygo test -v -bench . ./
- name: Verify repo is unchanged
run: git diff --exit-code HEAD
# Test with WebAssembly
test-wasm:
name: Test with WebAssembly
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
go-version: ["1.21"] # Disable Go 1.22 until TinyGo releases update
tinygo-version: ["0.30.0"]
wasmtime-version: ["v14.0.4", "v15.0.0"]
steps:
- name: Checkout repo
uses: actions/checkout@v4.1.2
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5.0.0
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Set up TinyGo
uses: acifani/setup-tinygo@v2.0.0
with:
tinygo-version: ${{ matrix.tinygo-version }}
- name: Set up Wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1.1.0
with:
version: ${{ matrix.wasmtime-version }}
- name: Add Go wasm exec to $PATH
run: echo "$(go env GOROOT)/misc/wasm" >> $GITHUB_PATH
- name: Test WebAssembly with Go + Wasmtime
env:
GOOS: wasip1
GOARCH: wasm
run: go test -v ./...
- name: Test WebAssembly with TinyGo + Wasmtime
# This only tests the apex package, not ./internal/build
# due to TinyGo support for net.UDPConn and net.IPConn
env:
GOOS: wasip1
GOARCH: wasm
run: tinygo test -v ./
- name: Verify repo is unchanged
run: git diff --exit-code HEAD
# Tag release
tag-release:
name: Tag release
runs-on: ubuntu-latest
timeout-minutes: 1
needs: [vet-go, test-go, test-tinygo, test-wasm]
steps:
- name: Checkout repo
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0 # Retrieve all commit history, so `git rev-list --count` works correctly
submodules: recursive
- name: Tag release
if: github.ref == 'refs/heads/main'
run: make tag-version
- name: Notify if failure
if: ${{ failure() }}
run: |
curl -Ss -X POST -H 'Content-type: application/json' --data '{"text":"❌ ZoneDB tests failed"}' ${{ secrets.SLACK_WEBHOOK_URL_GH_ACTIONS }}
# - name: Notify if success
# if: ${{ success() }}
# run: |
# curl -Ss -X POST -H 'Content-type: application/json' --data '{"text":"✅ ZoneDB tests passed"}' ${{ secrets.SLACK_WEBHOOK_URL_GH_ACTIONS }}