From 9caf5cf6746db861936ae915d2d4cb42077ee141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 15 May 2022 16:21:19 +0200 Subject: [PATCH] Test with GitHub actions --- .github/FUNDING.yml | 2 ++ .github/workflows/test.yml | 50 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 16 ------------ README.md | 2 +- 4 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..81325ad --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ + +github: [bep] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4d64d93 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,50 @@ +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +name: Test +permissions: + contents: read +jobs: + test: + strategy: + matrix: + go-version: [1.18.x] + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + shell: bash + - name: Install golint + run: go install golang.org/x/lint/golint@latest + shell: bash + - name: Update PATH + run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + shell: bash + - name: Checkout code + uses: actions/checkout@v1 + - name: Fmt + if: matrix.os != 'windows-latest' + run: "diff <(gofmt -d .) <(printf '')" + shell: bash + - name: Vet + run: go vet ./... + - name: Staticcheck + run: staticcheck ./... + - name: Lint + run: golint ./... + - name: Test + run: go test -race . + - name: Upload coverage + if: success() && matrix.os == 'ubuntu-latest' + run: | + curl -s https://codecov.io/bash | bash + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + shell: bash \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1d0aa29..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go -sudo: false -go: - - "1.11.x" - - tip -os: - - linux - - osx -matrix: - allow_failures: - - go: tip - fast_finish: true -script: - - env GO111MODULE=on go test -race -coverprofile=coverage.txt -covermode=atomic -after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/README.md b/README.md index eef8f7c..b26a64b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Go Debounce -[![Build Status](https://travis-ci.org/bep/debounce.svg)](https://travis-ci.org/bep/debounce) +[![Tests on Linux, MacOS and Windows](https://github.com/bep/debounce/workflows/Test/badge.svg)](https://github.com/bep/debounce/actions?query=workflow:Test) [![GoDoc](https://godoc.org/github.com/bep/debounce?status.svg)](https://godoc.org/github.com/bep/debounce) [![Go Report Card](https://goreportcard.com/badge/github.com/bep/debounce)](https://goreportcard.com/report/github.com/bep/debounce) [![codecov](https://codecov.io/gh/bep/debounce/branch/master/graph/badge.svg)](https://codecov.io/gh/bep/debounce)