Skip to content

Check the golang image #941

Check the golang image

Check the golang image #941

Workflow file for this run

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