update #6
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
name: Build | |
on: | |
push: | |
pull_request: | |
jobs: | |
cross-build: | |
strategy: | |
matrix: | |
go-version: ["1.23.3"] | |
os: | |
- ubuntu-latest | |
- macos-latest | |
# - windows-latest # Windows seems to have some issues with the Zig installation | |
runs-on: ${{ matrix.os }} | |
env: | |
# Our script only installs the dependencies automatically if it's running inside Docker. | |
# GitHub Actions is not running inside Docker, so we need to set this environment variable | |
# to allow the automatic installation of the dependencies. | |
ALLOW_OUTSIDE_DOCKER: "1" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up Zig | |
uses: mlugg/setup-zig@v1 | |
with: | |
version: 0.14.0-dev.2265+8a00bd4ce | |
- name: Build | |
run: | | |
go mod vendor | |
make all | |
# check if the binary is working | |
- name: Test | |
run: | | |
case ${{ matrix.os }} in | |
ubuntu-latest) | |
./dist/linux-amd64/demo --database-url=sqlite://./test.sqlite3 | |
;; | |
macos-latest) | |
./dist/darwin/demo --database-url=sqlite://./test.sqlite3 | |
;; | |
windows-latest) | |
./dist/windows-amd64/demo --database-url=sqlite://./test.sqlite3 | |
;; | |
esac | |
cross-build-in-docker: | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.23.3 | |
env: | |
# Disable the build version control system to avoid issues with Containers on GitHub Actions | |
GOFLAGS: "-buildvcs=false" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
go mod vendor | |
make all | |
- name: Test | |
run: | | |
./dist/linux-amd64/demo --database-url=sqlite://./test.sqlite3 | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist |