From 0e62d081612dd482da2f38c0d1b5771bbae5bad4 Mon Sep 17 00:00:00 2001 From: laojianzi Date: Tue, 29 Dec 2020 14:23:29 +0800 Subject: [PATCH] ci: add github action workflows --- .github/workflows/gin.yml | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/gin.yml diff --git a/.github/workflows/gin.yml b/.github/workflows/gin.yml new file mode 100644 index 00000000..411943ff --- /dev/null +++ b/.github/workflows/gin.yml @@ -0,0 +1,63 @@ +name: Run Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + go: [1.12, 1.13, 1.14, 1.15] + 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 + if: success() && matrix.go == 1.15 && matrix.os == 'ubuntu-latest' && matrix.test-tags == 'nomsgpack' + run: bash <(curl -s https://codecov.io/bash) + 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/${{ secrets.GITTER_ROOM_ID }} + - 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/${{ secrets.GITTER_ROOM_ID }}