-
Notifications
You must be signed in to change notification settings - Fork 52
128 lines (106 loc) · 3.47 KB
/
Copy pathgo.yml
File metadata and controls
128 lines (106 loc) · 3.47 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# 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: Go
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Setup Golang with cache
uses: actions/setup-go@v5.5.0
with:
go-version-file: go.mod
cache: false
- name: TidyTree
run: if [ "$(go mod tidy && git diff | wc -l)" -gt 0 ]; then exit 1; fi
- name: Format
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- name: Install sqlclosecheck
# TODO revert to github.com/ryanrolds/sqlclosecheck when https://github.com/ryanrolds/sqlclosecheck/pull/47 is merged
run: go install github.com/LeMikaelF/sqlclosecheck@b53ecaccb94623dfa6050e4ada4eeecd3a130829
- name: sqlclosecheck
run: go vet -vettool=${HOME}/go/bin/sqlclosecheck ./...
- name: Staticcheck
uses: dominikh/staticcheck-action@v1.4.1
with:
version: "2025.1.1"
build-tags: "preview"
install-go: false
release-plan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
fetch-depth: 0
- name: Setup Golang
uses: actions/setup-go@v5.5.0
with:
go-version-file: go.mod
cache: false
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
install-only: true
- name: Snapshot release (includes Windows)
run: goreleaser release --snapshot --clean --skip=publish --config .goreleaser-self.yaml
- name: Assert Windows archives exist
run: |
ls -la dist/
test -f dist/turso-cli_Windows_x86_64.zip
test -f dist/turso-cli_Windows_arm64.zip
unzip -l dist/turso-cli_Windows_x86_64.zip | grep -E 'turso\.exe$'
build:
needs: lint
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
fetch-depth: 0
- name: Setup Golang with cache
uses: actions/setup-go@v5.5.0
with:
go-version-file: go.mod
cache: false
- name: Build
run: go build -v ./...
- name: Vet
run: go vet -v ./...
- name: Test
run: go test -v ./...
- name: Build Turso binary (dev)
shell: bash
run: |
EXT=""
if [[ "${{ runner.os }}" == "Windows" ]]; then
EXT=".exe"
fi
go build -o "turso${EXT}" ./cmd/turso
"./turso${EXT}" --help >/dev/null
"./turso${EXT}" auth --help >/dev/null
- name: Prod generate and build
shell: bash
run: |
go generate --tags=prod ./...
EXT=""
if [[ "${{ runner.os }}" == "Windows" ]]; then
EXT=".exe"
fi
go build -tags prod -o "turso-prod${EXT}" ./cmd/turso
"./turso-prod${EXT}" --help >/dev/null