Skip to content

Commit

Permalink
update github actions config
Browse files Browse the repository at this point in the history
- combine windows and linux configs into a single matrix, now that
  actions/cache handles file paths properly
- update to latest actions/checkout and codecov actions
  • Loading branch information
willnorris committed Jan 27, 2020
1 parent ee2732a commit fdde57c
Showing 1 changed file with 13 additions and 29 deletions.
42 changes: 13 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,66 +4,50 @@ env:
GO111MODULE: on

jobs:
linux:
test:
strategy:
matrix:
go-version: [1.x, 1.12.x]
runs-on: ubuntu-latest
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: Cache go modules
uses: actions/cache@preview
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Run go fmt
if: runner.os != 'Windows'
run: diff -u <(echo -n) <(gofmt -d -s .)

- name: Ensure go generate produces a zero diff
shell: bash
run: go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)

- name: Run go vet
run: go vet ./...

- name: Run go test
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
run: go test -v -race -coverprofile coverage.txt -covermode atomic ./...

- name: Ensure integration tests build
# don't actually run tests since they hit live GitHub API
run: go test -v -tags=integration -run=^$ ./test/integration

- name: Run scrape tests
run: cd scrape && go test ./...
run: |
cd scrape
go test ./...
- name: Upload coverage to Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)

# On Windows, just run the local tests. Don't bother with checking gofmt, go
# vet, or uploading results to Codecov
windows:
strategy:
matrix:
go-version: [1.x, 1.12.x]
runs-on: windows-latest

steps:
- uses: actions/setup-go@v1
uses: codecov/codecov-action@v1
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v1
- name: Cache go modules
uses: actions/cache@preview
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: go test ./...
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit fdde57c

Please sign in to comment.