Browse Source

Migrate to using Github Actions for CI

pull/350/head
Daniele Sluijters 4 years ago
parent
commit
7d6f6afdc6
  1. 34
      .github/workflows/ci.yaml
  2. 22
      .travis.yml
  3. 1
      goneb_services_test.go
  4. 4
      hooks/pre-commit

34
.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

22
.travis.yml

@ -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

1
goneb_services_test.go

@ -103,6 +103,7 @@ func TestRespondToEcho(t *testing.T) {
"UserID": "@link:hyrule", "UserID": "@link:hyrule",
"Config": {} "Config": {}
}`)) }`))
mux.ServeHTTP(mockWriter, serviceConfigReq) mux.ServeHTTP(mockWriter, serviceConfigReq)
// send neb an invite to a room // send neb an invite to a room

4
hooks/pre-commit

@ -2,8 +2,8 @@
set -eu set -eu
go fmt ./...
gofmt -d ./..
go vet -composites=false ./... go vet -composites=false ./...
staticcheck ./... staticcheck ./...
gocyclo -over 12 . gocyclo -over 12 .
go test ./...
go test -v ./...
Loading…
Cancel
Save