0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

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.
This commit is contained in:
Will Norris 2019-11-01 19:18:03 -07:00
parent 8ae8c1b2ea
commit 5c76261bfd
4 changed files with 63 additions and 43 deletions

View file

@ -1,18 +0,0 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.12.x, 1.13.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v1
- name: Test
run: go test ./...

62
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,62 @@
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 ./...

View file

@ -1,24 +0,0 @@
language: go
go:
- "1.x"
- "1.11.x"
go_import_path: willnorris.com/go/imageproxy
cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
env:
global:
- GO111MODULE=on
script:
- diff -u <(echo -n) <(gofmt -d -s .)
- go vet ./...
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -1,7 +1,7 @@
# imageproxy
[![GoDoc](https://godoc.org/willnorris.com/go/imageproxy?status.svg)](https://godoc.org/willnorris.com/go/imageproxy)
[![Build Status](https://travis-ci.org/willnorris/imageproxy.svg?branch=master)](https://travis-ci.org/willnorris/imageproxy)
[![Test Status](https://github.com/willnorris/imageproxy/workflows/tests/badge.svg)](https://github.com/willnorris/imageproxy/actions?query=workflow%3Atests)
[![Test Coverage](https://codecov.io/gh/willnorris/imageproxy/branch/master/graph/badge.svg)](https://codecov.io/gh/willnorris/imageproxy)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2611/badge)](https://bestpractices.coreinfrastructure.org/projects/2611)