-
Notifications
You must be signed in to change notification settings - Fork 6
92 lines (71 loc) · 1.82 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Go CI
on:
push:
branches: [ main ]
tags: [ v*.*.* ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Initialize Git submodules
run: |
git submodule init
git submodule update
- name: Install dependencies
run: make deps
- name: Run go fmt
run: make fmt
- name: Run go vet
run: make vet
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run tests
run: make test
- name: Build binaries
run: make build
- name: Create tarball
run: tar -czvf das-${{ matrix.os }}.tar.gz bin
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: das-${{ matrix.os }}
path: das-${{ matrix.os }}.tar.gz
release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: das-ubuntu-latest
path: .
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: das-macos-latest
path: .
- name: Upload release asset
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: false
prerelease: false
files: |
das-ubuntu-latest.tar.gz
das-macos-latest.tar.gz