Merge pull request #87 from sue445/dependabot/go_modules/github.com/s… #163
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
env: | |
GO111MODULE: "on" | |
TEST_ARGS: -coverprofile coverage.out -covermode atomic | |
jobs: | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
golang: | |
- "1.17" | |
- "1.18" | |
- "1.19" | |
- "1.20" | |
- "1.21" | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.golang }} | |
id: go | |
- name: Run test | |
run: | | |
set -xe | |
make test | |
make testrace | |
- name: Convert coverage to lcov | |
uses: jandelgado/gcov2lcov-action@v1 | |
with: | |
infile: coverage.out | |
outfile: coverage.lcov | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov | |
- name: Slack Notification (not success) | |
uses: lazy-actions/slatify@master | |
if: "! success()" | |
continue-on-error: true | |
with: | |
job_name: ${{ format('*build* ({0})', matrix.golang) }} | |
type: ${{ job.status }} | |
icon_emoji: ":octocat:" | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Run lint | |
run: | | |
set -xe | |
go install golang.org/x/lint/golint@latest | |
make fmtci | |
make vet | |
make lint | |
- name: Slack Notification (not success) | |
uses: lazy-actions/slatify@master | |
if: "! success()" | |
continue-on-error: true | |
with: | |
job_name: "*lint*" | |
type: ${{ job.status }} | |
icon_emoji: ":octocat:" | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
notify: | |
needs: | |
- test | |
- lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack Notification (success) | |
uses: lazy-actions/slatify@master | |
if: always() | |
continue-on-error: true | |
with: | |
job_name: '*build*' | |
type: ${{ job.status }} | |
icon_emoji: ":octocat:" | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
token: ${{ secrets.GITHUB_TOKEN }} |