-
Notifications
You must be signed in to change notification settings - Fork 213
208 lines (179 loc) · 4.88 KB
/
main.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# Validates that we can compile on the targets below
compile:
strategy:
matrix:
go_version:
- "1.22"
- "1.23"
goos:
- darwin
- freebsd
- linux
- windows
goarch:
- amd64
- arm64
name: cross-compilation (GOOS=${{ matrix.goos }}, GOARCH=${{ matrix.goarch }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.1.0
with:
go-version: "1.x"
- run: go build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
test:
strategy:
matrix:
go_version:
- "1.22"
- "1.23"
os:
- macos
- ubuntu
- windows
name: tests (${{ matrix.os }}/go-${{ matrix.go_version }}
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.1.0
id: go
with:
go-version: ${{ matrix.go_version }}
- name: run-tests-race
run: go test -race -vet all -mod readonly ./...
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: golangci/golangci-lint-action@v6.1.1
staticcheck:
name: staticcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.1.0
id: go
with:
go-version: "1.23"
- run: |
go install honnef.co/go/tools/cmd/staticcheck@master
- name: get staticcheck version
id: get-staticcheck-version
run: |
echo "version=$(staticcheck --version | sed -e 's/,//g')" >>${GITHUB_OUTPUT}
- name: staticcheck cache
id: staticcheck-cache
uses: actions/cache@v4.1.2
with:
path: ~/.cache/staticcheck
key: "${{ steps.get-staticcheck-version.outputs.version }}"
- name: run staticcheck
run: |
staticcheck ./...
build-artifact:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.1.0
id: go
with:
go-version: "1.23"
- name: go-build
run: go build -o fake-gcs-server
env:
CGO_ENABLED: 0
- name: sanity-check
uses: docker://alpine
with:
entrypoint: sh
args: -c "./fake-gcs-server -h"
- name: upload binary
uses: actions/upload-artifact@v4.4.3
with:
name: fake-gcs-server
path: ./fake-gcs-server
retention-days: 1
test-examples:
strategy:
matrix:
include:
- lang: python
docker-image: python:latest
entrypoint: /bin/bash
- lang: gsutil
docker-image: python:3.11
entrypoint: /bin/bash
- lang: node
docker-image: node:20-alpine
entrypoint: /bin/sh
- lang: go
docker-image: golang:1.23-alpine
entrypoint: /bin/sh
- lang: dotnet
docker-image: mcr.microsoft.com/dotnet/sdk:5.0-alpine
entrypoint: /bin/sh
- lang: scala
docker-image: mozilla/sbt:8u292_1.5.7
entrypoint: /bin/sh
- lang: java
docker-image: openjdk:17
entrypoint: /bin/sh
- lang: cpp
docker-image: alpine:3.15.4
entrypoint: /bin/sh
- lang: curl
docker-image: alpine
entrypoint: /bin/sh
- lang: curl-both-scheme-default-ports
docker-image: alpine
entrypoint: /bin/sh
- lang: curl-both-scheme-non-default-ports
docker-image: alpine
entrypoint: /bin/sh
name: test-${{ matrix.lang }}-example
runs-on: ubuntu-latest
needs:
- build-artifact
- lint
- staticcheck
steps:
- uses: actions/checkout@v4.2.2
- name: download binary
uses: actions/download-artifact@v4.1.8
with:
name: fake-gcs-server
- name: fix permissions
run: chmod +x fake-gcs-server
- name: docker pull ${{ matrix.docker-image }}
run: docker pull ${DOCKER_IMAGE}
env:
DOCKER_IMAGE: ${{ matrix.docker-image }}
- name: test-${{ matrix.lang }}-example
run: |
docker run --entrypoint ${ENTRYPOINT} -v ${PWD}:${PWD} -w ${PWD} ${DOCKER_IMAGE} ci/run-${LANG}-example.sh
env:
DOCKER_IMAGE: ${{ matrix.docker-image }}
ENTRYPOINT: ${{ matrix.entrypoint }}
LANG: ${{ matrix.lang }}
unblock-pr:
name: unblock-pr
runs-on: ubuntu-latest
needs:
- test-examples
- test
steps:
- run: "true"