-
Notifications
You must be signed in to change notification settings - Fork 38
79 lines (62 loc) · 2.08 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
# 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_target:
branches: [ "main" ]
env:
TURSO_API_TOKEN: ${{ secrets.TURSOCI_TOKEN }}
jobs:
authorize:
environment:
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true
build:
needs: authorize
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
#ref: "refs/pull/${{ github.event.number }}/merge" # THIS IS INSECURE
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v4
with:
go-version-file: go.mod
- 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 dependencies
run: go get -v ./...
- name: Build
run: go build -v ./...
- name: Vet
run: go vet -v ./...
- name: Install sqlclosecheck
run: go install github.com/ryanrolds/sqlclosecheck@latest
- name: sqlclosecheck
run: go vet -vettool=${HOME}/go/bin/sqlclosecheck ./...
- name: Staticcheck
uses: dominikh/staticcheck-action@v1.3.0
with:
version: "2023.1.2"
build-tags: "preview"
install-go: false
- name: Test
run: go test -v ./...
- name: Build Turso binary
run: go build -o turso cmd/turso/main.go
- name: Integration tests checkout
uses: actions/checkout@v3
with:
repository: chiselstrike/tursotest
ref: 'main'
path: 'tests'
token: ${{ secrets.ACCESS_TOKEN_TO_TESTS }}
- name: Integration Test
run: cd tests && export TURSO_BINARY=../turso && go run cmd/tursotest/main.go -test.v -test.count=1 run integrationtests