switch from travis to GitHub actions
This commit is contained in:
parent
b090fa2924
commit
9c7e626f7d
78
.github/workflows/go.yml
vendored
Normal file
78
.github/workflows/go.yml
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
name: GitHub Actions CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
# Run on the latest minor release of Go 1.14:
|
||||
go-version: ^1.14
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Ensure all files were formatted as per gofmt
|
||||
run: |
|
||||
gofmt -l $(find . -name '*.go') >/dev/null
|
||||
|
||||
- name: Go Vet
|
||||
run: |
|
||||
go vet
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
go build -v ./cmd/...
|
||||
|
||||
test:
|
||||
name: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
# Run on the latest minor release of Go 1.14:
|
||||
go-version: ^1.14
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
go test -v -race ./internal/...
|
||||
|
||||
integrationtest:
|
||||
name: integrationtest
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
# Run on the latest minor release of Go 1.14:
|
||||
go-version: ^1.14
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build Docker container with the tools our tests require
|
||||
run: |
|
||||
docker build --pull --no-cache --rm -t=router7 -f travis/Dockerfile .
|
||||
|
||||
- name: Run tests in Docker container
|
||||
run: |
|
||||
exit=0; for pkg in $(go list ./integration/...); do go test -c $pkg && docker run --privileged --net=host -v $PWD:/usr/src:ro router7 /bin/sh -c "./$(basename $pkg).test -test.v" || exit=1; done; [ $exit = 0 ]
|
28
.travis.yml
28
.travis.yml
@ -1,28 +0,0 @@
|
||||
# Use the (faster) container-based infrastructure, see also
|
||||
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||
sudo: required
|
||||
dist: xenial
|
||||
services:
|
||||
- docker
|
||||
|
||||
language: go
|
||||
go:
|
||||
- "1.14"
|
||||
|
||||
install:
|
||||
- go get -t -v -d ./...
|
||||
|
||||
script:
|
||||
# Check whether files are syntactically correct.
|
||||
- "gofmt -l $(find . -name '*.go' | tr '\\n' ' ') >/dev/null"
|
||||
# Check whether files were not gofmt'ed.
|
||||
- "gosrc=$(find . -name '*.go' | tr '\\n' ' '); [ $(gofmt -l $gosrc 2>&- | wc -l) -eq 0 ] || (echo 'gofmt was not run on these files:'; gofmt -l $gosrc 2>&-; false)"
|
||||
# TODO: remove the || true suffix once vet errors are fixed
|
||||
- go vet . || true
|
||||
- sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
|
||||
- go build ./cmd/...
|
||||
- go test -v -race ./internal/...
|
||||
- docker build --pull --no-cache --rm -t=router7 -f travis/Dockerfile .
|
||||
- sudo service docker restart
|
||||
# NOTE: this must be the last command because of the travis_terminate usage:
|
||||
- exit=0; for pkg in $(go list ./integration/...); do go test -c $pkg && docker run --privileged --net=host -v $PWD:/usr/src:ro router7 /bin/sh -c "./$(basename $pkg).test -test.v" || exit=1; done; [ $exit = 0 ] || travis_terminate 1
|
Loading…
x
Reference in New Issue
Block a user