imageproxy/.github/workflows/tests.yml
Will Norris 5c76261bfd github actions: cache go modules; disable travis
This is mostly an experiment, but I think it will work well.  GitHub
Actions provides MacOS and Windows builds (though I'm only adding in
Windows at the moment), and cleaner integration.  Builds also seem to be
completing faster than Travis.
2019-11-02 11:39:05 -07:00

62 lines
1.5 KiB
YAML

on: [push, pull_request]
name: tests
env:
GO111MODULE: on
jobs:
test:
strategy:
matrix:
go-version: [1.12.x, 1.13.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@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-
- name: Run go fmt
run: diff -u <(echo -n) <(gofmt -d -s .)
- name: Run go vet
run: go vet ./...
- name: Run go test
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.3
with:
token: ${{ secrets.CODECOV_TOKEN }}
# On Windows, just run the local tests. Don't bother with checking gofmt, go
# vet, or uploading results to Codecov
test-windows:
strategy:
matrix:
go-version: [1.12.x, 1.13.x]
platform: [windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@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 ./...