From 7d6f6afdc61e7448300d07fa7a64b79d8fd652ed Mon Sep 17 00:00:00 2001 From: Daniele Sluijters Date: Tue, 18 May 2021 14:08:28 +0200 Subject: [PATCH] Migrate to using Github Actions for CI --- .github/workflows/ci.yaml | 34 ++++++++++++++++++++++++++++++++++ .travis.yml | 22 ---------------------- goneb_services_test.go | 1 + hooks/pre-commit | 4 ++-- 4 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c4eaedb --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,34 @@ +name: CI +on: + pull_request: + paths: + - '**.go' + branches: + - master + push: + paths: + - '**.go' + branches: + - master + tags-ignore: + - '**' + +jobs: + test: + name: Run the tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '~1.16.4' + - name: Install libolm + run: sudo apt-get -y install libolm3 libolm-dev + - name: Install linters + run: | + go install honnef.co/go/tools/cmd/staticcheck@latest + go install github.com/fzipp/gocyclo/cmd/gocyclo@latest + - name: Lint and test + run: sh ./hooks/pre-commit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4c428da..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -os: linux -dist: bionic -language: go -go: - - 1.14 -install: - - echo 'deb http://archive.ubuntu.com/ubuntu/ focal universe' | sudo tee -a /etc/apt/sources.list - - sudo apt-get update - - sudo apt-get -y install libolm3 libolm-dev - - go get golang.org/x/lint/golint - - go get github.com/fzipp/gocyclo - -script: go build github.com/matrix-org/go-neb && ./hooks/pre-commit - -notifications: - webhooks: - urls: - - "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGtlZ2FuJTNBbWF0cml4Lm9yZy8lMjFhWmthbkFuV0VkeGNSSVFrV24lM0FtYXRyaXgub3Jn" - on_success: change # always|never|change - on_failure: always - on_start: never - diff --git a/goneb_services_test.go b/goneb_services_test.go index e6c5892..2259727 100644 --- a/goneb_services_test.go +++ b/goneb_services_test.go @@ -103,6 +103,7 @@ func TestRespondToEcho(t *testing.T) { "UserID": "@link:hyrule", "Config": {} }`)) + mux.ServeHTTP(mockWriter, serviceConfigReq) // send neb an invite to a room diff --git a/hooks/pre-commit b/hooks/pre-commit index 9d07653..b8b2b3f 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -2,8 +2,8 @@ set -eu -go fmt ./... +gofmt -d ./.. go vet -composites=false ./... staticcheck ./... gocyclo -over 12 . -go test ./... +go test -v ./...