diff --git a/.github/actions/build/Dockerfile b/.github/actions/build/Dockerfile index 8d5046a..8d8902e 100644 --- a/.github/actions/build/Dockerfile +++ b/.github/actions/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14-stretch +FROM golang:1.16-buster RUN \ apt-get update && \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..737ee04 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/.gitignore b/.gitignore index 322e0f6..54872e8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ mbtileserver *.pem .certs/* **/node_modules/* +coverage* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a6af62f..0000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index f709aa8..c107834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 693c7ad..f60f757 100644 --- a/README.md +++ b/README.md @@ -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)