-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (46 loc) · 1.6 KB
/
go.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
51
52
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Build get-zap
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build local
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
build-all:
name: Build all binaries
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Build get-zap for a given architecture
run: GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} go build -o bin/get-zap-${{matrix.goos}}-${{matrix.goarch}}${{matrix.goos == 'windows' && '.exe' || ''}}
- name: Strip Linux and Windows binaries
if: matrix.goos != 'darwin' && matrix.goarch != 'arm64'
run: strip bin/get-zap-${{matrix.goos}}-${{matrix.goarch}}${{matrix.goos == 'windows' && '.exe' || ''}}
- name: Archive the binary
uses: actions/upload-artifact@v4
with:
name: get-zap-${{matrix.goos}}-${{matrix.goarch}}${{matrix.goos == 'windows' && '.exe' || ''}}
path: bin/get-zap-${{matrix.goos}}-${{matrix.goarch}}${{matrix.goos == 'windows' && '.exe' || ''}}