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 ]