From 644edc33bd77d48fdc6f61a58677f7397b1f9602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 5 Dec 2023 21:51:15 +0100 Subject: [PATCH 1/3] Add go test workflow --- .gitea/workflows/go-test.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .gitea/workflows/go-test.yml diff --git a/.gitea/workflows/go-test.yml b/.gitea/workflows/go-test.yml new file mode 100644 index 0000000..6230546 --- /dev/null +++ b/.gitea/workflows/go-test.yml @@ -0,0 +1,54 @@ +name: Run go tests +on: + - test + - pull_request + +env: + GOPATH: /go_path + GOCACHE: /go_cache + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 5 + env: + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: https://github.com/actions/setup-go@v4 + with: + go-version: 1.21 + use-latest: true + + - name: Hash go.mod and go.sum + uses: https://gitea.com/actions/go-hashfiles@v0.0.1 + id: hash-go + with: + patterns: | + go.mod + go.sum + + - name: Cache go + uses: actions/cache@v3 + + - name: Go mod download + run: go mod download + + - name: Go mod verify + run: go mod verify + + - name: Go mod tidy + run: go mod tidy && git diff --exit-code + + - name: Check gofmt + run: gofmt -s -w . && git diff --exit-code + + - name: Check go vet + run: go vet ./... + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -cover -v ./... From 555ce22479279b72ac0584dfbc62ded70a9e320f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 5 Dec 2023 21:58:28 +0100 Subject: [PATCH 2/3] Go mod tidy --- go.mod | 8 ++++---- go.sum | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index bcdfbbd..4488ff9 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,10 @@ go 1.21.3 require ( github.com/go-chi/chi/v5 v5.0.10 + github.com/pelletier/go-toml/v2 v2.1.0 + github.com/pion/interceptor v0.1.25 + github.com/pion/sdp/v3 v3.0.6 + github.com/pion/webrtc/v4 v4.0.0-beta.7 github.com/urfave/cli/v2 v2.25.7 golang.org/x/crypto v0.15.0 ) @@ -12,24 +16,20 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.4.0 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pion/datachannel v1.5.5 // indirect github.com/pion/dtls/v2 v2.2.8 // indirect github.com/pion/ice/v3 v3.0.2 // indirect - github.com/pion/interceptor v0.1.25 // indirect github.com/pion/logging v0.2.2 // indirect github.com/pion/mdns v0.0.9 // indirect github.com/pion/randutil v0.1.0 // indirect github.com/pion/rtcp v1.2.12 // indirect github.com/pion/rtp v1.8.3 // indirect github.com/pion/sctp v1.8.9 // indirect - github.com/pion/sdp/v3 v3.0.6 // indirect github.com/pion/srtp/v3 v3.0.1 // indirect github.com/pion/stun/v2 v2.0.0 // indirect github.com/pion/transport/v2 v2.2.4 // indirect github.com/pion/transport/v3 v3.0.1 // indirect github.com/pion/turn/v3 v3.0.1 // indirect - github.com/pion/webrtc/v4 v4.0.0-beta.7 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/stretchr/testify v1.8.4 // indirect diff --git a/go.sum b/go.sum index 68c8fd7..17d3ab8 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,10 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -196,6 +198,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= From d346944e206564942e6b352f7d2406a939e9fe87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 5 Dec 2023 22:11:09 +0100 Subject: [PATCH 3/3] Publish coverage report --- .gitea/workflows/go-test.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/go-test.yml b/.gitea/workflows/go-test.yml index 6230546..be8571f 100644 --- a/.gitea/workflows/go-test.yml +++ b/.gitea/workflows/go-test.yml @@ -51,4 +51,14 @@ jobs: run: go build -v ./... - name: Test - run: go test -cover -v ./... + run: go test -cover -coverprofile=/tmp/cov.out -v ./... + + - name: Make coverage report + run: go tool cover -html=/tmp/cov.out -o /tmp/cov.html + + - name: Publish coverage report + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: /tmp/cov.html +