Go #201
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
golangci: | |
name: golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.0 | |
- uses: actions/checkout@v4 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.55.2 | |
test: | |
name: Test all packages on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go: | |
- '1.22.0' | |
os: | |
- ubuntu-latest | |
- macos-latest | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Build | |
run: go build -v ./... | |
- name: Set up Tor | |
run: | | |
if [ -x "$(command -v 'apt')" ]; then sudo apt update && sudo apt install tor obfs4proxy; fi | |
if [ -x "$(command -v 'brew')" ]; then brew update && brew install tor obfs4proxy; fi | |
- name: Test | |
run: | | |
go test -count=1 -coverprofile=coverage.out -covermode=atomic ./... | |
go tool cover -func coverage.out -o cover.out | |
cat cover.out | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.out,./cover.out | |
verbose: true |