Migrate to github actions for testing

This commit is contained in:
Brendan C. Ward 2021-05-13 20:54:27 -07:00
parent 988a940403
commit 8c2e5aceaf
No known key found for this signature in database
GPG Key ID: 37A8A7A2D61DFE13
6 changed files with 61 additions and 29 deletions

View File

@ -1,4 +1,4 @@
FROM golang:1.14-stretch
FROM golang:1.16-buster
RUN \
apt-get update && \

57
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,57 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go: [1.13.x, 1.14.x, 1.15.x, 1.16.x]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 1
steps:
- name: Install GCC (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew update
brew install gcc
- name: Install GCC (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
apt update
apt install -y gcc-multilib g++-multilib
shell: bash
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: go test -v ./...
coverage:
runs-on: ubuntu-latest
steps:
- name: Install GCC (Ubuntu)
run: |
apt update
apt install -y gcc-multilib g++-multilib
shell: bash
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Calc coverage
run: |
go test -v -covermode=count -coverprofile=coverage.out ./...
- name: Convert coverage.out to coverage.lcov
uses: jandelgado/gcov2lcov-action@v1.0.6
- name: Coveralls
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ mbtileserver
*.pem
.certs/*
**/node_modules/*
coverage*

View File

@ -1,27 +0,0 @@
language: go
go:
- "1.10"
- "1.11.4" # required per: https://github.com/golang/go/issues/30446
- "1.12"
- "1.13"
- tip
matrix:
allow_failures:
- go: master
fast_finish: true
cache:
directories:
- $GOPATH/pkg/mod
install: true
before_script:
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/
- go get github.com/mattn/goveralls
script:
- go test -v -race ./... # Run all the tests with the race detector enabled
- go vet ./... # go vet is the official Go static analyzer
- $GOPATH/bin/goveralls -service=travis-ci # Run coverage analysis

View File

@ -50,6 +50,7 @@ Most of the updates are demonstrated in `main.go`.
- Upgraded Docker containers to Go 1.16
- Now requires Go 1.13+
- Removed `vendor` directory
- Switched from Travis-CI to Github actions for running tests
### Command-line interface

View File

@ -3,7 +3,7 @@
A simple Go-based server for map tiles stored in [mbtiles](https://github.com/mapbox/mbtiles-spec)
format.
[![Build Status](https://travis-ci.org/consbio/mbtileserver.svg?branch=master)](https://travis-ci.org/consbio/mbtileserver)
![Build Status](https://github.com/consbio/mbtileserver/actions/workflows/test.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/consbio/mbtileserver/badge.svg?branch=master)](https://coveralls.io/github/consbio/mbtileserver?branch=master)
[![GoDoc](https://godoc.org/github.com/consbio/mbtileserver?status.svg)](http://godoc.org/github.com/consbio/mbtileserver)
[![Go Report Card](https://goreportcard.com/badge/github.com/consbio/mbtileserver)](https://goreportcard.com/report/github.com/consbio/mbtileserver)