-
Notifications
You must be signed in to change notification settings - Fork 8
executable file
·170 lines (143 loc) · 5.71 KB
/
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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download dependencies
run: |
sudo apt update && sudo apt install -y build-essential libpng-dev protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- name: Go Generate
run: go generate -tags tools -x ./...
- name: Build
run: go build -v -o api-linux-amd64 cmd/api/serve.go
env:
CGO_ENABLED: 1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download dependencies
run: |
sudo apt update && sudo apt install -y build-essential libpng-dev protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- name: Go Generate
run: go generate -tags tools -x ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
skip-pkg-cache: true
skip-build-cache: true
args: --timeout 5m
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download dependencies
run: |
sudo apt update && sudo apt install -y build-essential libpng-dev protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- name: Go Generate
run: go generate -tags tools -x ./...
- name: Start stack
run: docker compose up -d
- name: Setup Minio
run: |
go install github.com/minio/mc@latest
mc alias set local http://localhost:9000 minio minio123
mc admin user svcacct add local minio --access-key REPLACE_ME_KEY --secret-key REPLACE_ME_SECRET
mc anonymous set public local/smr
- name: Test
run: go test -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... ./...
env:
CGO_ENABLED: 1
REPO_PASETO.PUBLIC_KEY: 408c5155a389aeabf1c1b0da73ff5a3079b6aa6628e4c661b1e1ce412181cc8a
REPO_PASETO.PRIVATE_KEY: a5f7409588f6b72d443db0d432f37f1214a5ec88cb55a70e24b90194ed549465408c5155a389aeabf1c1b0da73ff5a3079b6aa6628e4c661b1e1ce412181cc8a
REPO_FEATURE_FLAGS.ALLOW_MULTI_TARGET_UPLOAD: "true"
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
seeded_test:
name: Seeded Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- download_url: "S3_URL_PROD"
s3_bucket: "smr-prod-s3"
s3_key: "S3_KEY_PROD"
s3_secret: "S3_SECRET_PROD"
s3_base_url: "https://storage.ficsit.app"
- download_url: "S3_URL_STAGING"
s3_bucket: "smr-staging-s3"
s3_key: "S3_KEY_STAGING"
s3_secret: "S3_SECRET_STAGING"
s3_base_url: "https://storage-staging.ficsit.app"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download dependencies
run: |
sudo apt update && sudo apt install -y build-essential libpng-dev protobuf-compiler
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- name: Go Generate
run: go generate -tags tools -x ./...
- name: Start stack
run: docker compose up -d
- name: Setup Minio
run: |
go install github.com/minio/mc@latest
mc alias set local http://localhost:9000 minio minio123
mc admin user svcacct add local minio --access-key REPLACE_ME_KEY --secret-key REPLACE_ME_SECRET
mc anonymous set public local/smr
- name: Download and seed database
run: |
curl ${{ secrets[matrix.download_url] }} | psql -h localhost -p 5432 -U postgres
env:
PGPASSWORD: REPLACE_ME
- name: Test
run: go test -v -run '^TestSetup$' ./...
env:
CGO_ENABLED: 1
REPO_PASETO.PUBLIC_KEY: 408c5155a389aeabf1c1b0da73ff5a3079b6aa6628e4c661b1e1ce412181cc8a
REPO_PASETO.PRIVATE_KEY: a5f7409588f6b72d443db0d432f37f1214a5ec88cb55a70e24b90194ed549465408c5155a389aeabf1c1b0da73ff5a3079b6aa6628e4c661b1e1ce412181cc8a
REPO_FEATURE_FLAGS.ALLOW_MULTI_TARGET_UPLOAD: "true"
REPO_STORAGE.READER.TYPE: "s3"
REPO_STORAGE.READER.REGION: "us-west-002"
REPO_STORAGE.READER.BUCKET: "${{ matrix.s3_bucket }}"
REPO_STORAGE.READER.KEY: "${{ secrets[matrix.s3_key] }}"
REPO_STORAGE.READER.SECRET: "${{ secrets[matrix.s3_secret] }}"
REPO_STORAGE.READER.ENDPOINT: "https://s3.us-west-002.backblazeb2.com"
REPO_STORAGE.READER.BASE_URL: "${{ matrix.s3_base_url }}"
REPO_STORAGE.READER.KEYPATH: "%s/file/%s/%s"