gin/.github/workflows/gin.yml
Jeff fb8a113f8d
ci: add github action workflows (#2596)
* ci: add github action workflows

* test: fixed the TestUnixSocket test on windows (#20)

* ci: add github action workflows (#18)

* Remove .travis.yml

* ci: replace GITTER_ROOM_ID and upload coverage every time you go test

* ci: update coverage using codecov/codecov-action@v1

* Merge branch 'master' into github-actions

* repo: replace travis ci to github actions

* ci: add go version 1.16

* fix: go install requires a specific version

* chore(ci): remove go 1.12 support

* chore(ci): remove os windows-latest

Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-06-23 13:10:49 +08:00

63 lines
2.1 KiB
YAML

name: Run Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go: [1.13, 1.14, 1.15, 1.16]
test-tags: ['', nomsgpack]
name: ${{ matrix.os }} @ Go ${{ matrix.go }} ${{ matrix.test-tags }}
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
TESTTAGS: ${{ matrix.test-tags }}
GOPROXY: https://proxy.golang.org
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Install Dependencies
run: make tools
- name: Run Check
run: |
make vet
make fmt-check
make misspell-check
- name: Run Tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
notification-gitter:
needs: test
runs-on: ubuntu-latest
steps:
- name: Notification failure message
if: failure()
run: |
PR_OR_COMPARE="$(if [ "${{ github.event.pull_request }}" != "" ]; then echo "${{ github.event.pull_request.html_url }}"; else echo "${{ github.event.compare }}"; fi)"
curl -d message="GitHub Actions [$GITHUB_REPOSITORY]($PR_OR_COMPARE) ($GITHUB_REF) [normal]($GITHUB_API_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) ($GITHUB_RUN_NUMBER)" -d level=error https://webhooks.gitter.im/e/7f95bf605c4d356372f4
- name: Notification success message
if: success()
run: |
PR_OR_COMPARE="$(if [ "${{ github.event.pull_request }}" != "" ]; then echo "${{ github.event.pull_request.html_url }}"; else echo "${{ github.event.compare }}"; fi)"
curl -d message="GitHub Actions [$GITHUB_REPOSITORY]($PR_OR_COMPARE) ($GITHUB_REF) [normal]($GITHUB_API_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) ($GITHUB_RUN_NUMBER)" https://webhooks.gitter.im/e/7f95bf605c4d356372f4