diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b29f294d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: Tests + +on: + push: + pull_request: + +jobs: + test: + strategy: + # Default is true, cancels jobs for other platforms in the matrix if one fails + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + go: [ '1.15' ] + + runs-on: ${{ matrix.os }} + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Print Go version and environment + id: vars + run: | + printf "Using go at: $(which go)\n" + printf "Go version: $(go version)\n" + printf "\n\nGo environment:\n\n" + go env + printf "\n\nSystem environment:\n\n" + env + # Calculate the short SHA1 hash of the git commit + echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" + echo "::set-output name=go_cache::$(go env GOCACHE)" + + - name: Cache the build cache + uses: actions/cache@v2 + with: + path: ${{ steps.vars.outputs.go_cache }} + key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.go }}-go-ci + + - name: Install dependencies + run: | + go mod download + + - name: Run tests + run: | + ./cover.sh $HOME/build coverage.out + + - uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: coverage.out + + golangci: + name: Lint + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.31 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f5b72f8e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This is a weird way of telling Travis to use the fast container-based test -# runner instead of the slow VM-based runner. -sudo: false - -language: go - -go: - - "1.15" - -# Don't email me the results of the test runs. -notifications: - email: false - -before_script: - - go get github.com/mattn/goveralls - -script: - - bash cover.sh $HOME/build coverage.out || travis_terminate 1 - -after_success: - - goveralls -service=travis-ci -coverprofile=coverage.out || true - - goveralls -coverprofile=coverage.out -service=travis-ci -