-
Notifications
You must be signed in to change notification settings - Fork 187
50 lines (42 loc) · 1.49 KB
/
test-and-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Build
on: push
jobs:
test-and-build:
strategy:
matrix:
include:
- platform: windows-latest
binary_name: scribblers-x64.exe
- platform: ubuntu-latest
binary_name: scribblers-linux-x64
- platform: macos-latest
binary_name: scribblers-macos-x64
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
# Workaround to get tags, getting git describe to work.
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.3
- name: Run tests
shell: bash
run: |
go test -v -race -covermode=atomic ./...
- name: Build artifact
shell: bash
env:
# Disable CGO to get "more static" binaries. They aren't really static ...
# since it can still happen that part of the stdlib access certain libs, but
# whatever, this will probs do for our usecase. (Can't quite remember
# anymore, but I have had issues with this in the past) :D
CGO_ENABLED: 0
run: |
go build -trimpath -ldflags "-w -s -X 'github.com/scribble-rs/scribble.rs/internal/version.Version=$(git describe --tags --dirty)'" -o ${{ matrix.binary_name }} ./cmd/scribblers
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary_name }}
path: ./${{ matrix.binary_name }}