-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (61 loc) · 1.77 KB
/
pr.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
name: Tests
on:
pull_request:
paths:
- '.github/workflows/*'
- 'Dockerfile'
- 'go.*'
- '**.go'
- '**.sh'
- '**.js'
- '**.html'
- 'examples/example-config.yaml'
push:
branches:
- main
jobs:
build-and-run-tests:
name: Build & run tests
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Checkout
# https://github.com/actions/checkout/tree/v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Get GO version
id: goversion
run: echo "goversion=$(<.goversion)" > "${GITHUB_OUTPUT}"
- name: Set up Go
# https://github.com/actions/setup-go/tree/v5.0.0
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: ${{steps.goversion.outputs.goversion}}
- name: Generate files
run: go generate ./...
- name: Build
run: go build ./...
- name: Run go vet
run: go vet ./...
- name: Run go fmt
run: |
out="$(go fmt ./...)"
if [[ -n "${out}" ]]; then
echo "Need to run `go fmt` on:"
echo "${out}"
exit 1
fi
- name: Run go tests
run: go test -failfast ./...
- name: Run go tests (noquic)
run: go test -failfast -tags noquic ./...
- name: Run go tests (-race)
run: go test -race -timeout=5m -failfast ./...
- name: Run govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest && govulncheck ./...
- name: Build example
run: cd examples/backend && go build -o /tmp/backend .
- name: Build test docker image
run: |
touch version.sh
docker build -t c2fmzq/tlsproxy:test .
docker run --rm --interactive c2fmzq/tlsproxy:test -v