upgrade to v2 (#12) #111
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: build and test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '**' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Run tests | |
run: go test -race -count=1 -coverprofile=coverage.txt -covermode=atomic ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Build app | |
id: build_go_app | |
run: | | |
go build -v . | |
echo ::set-output name=exit_code::$? | |
- name: Notify Slack on success | |
if: steps.build_go_app.outputs.exit_code == 0 | |
id: slack_notification | |
uses: ravsamhq/notify-slack-action@v1 | |
with: | |
status: ${{ job.status }} | |
notification_title: 'Build succeeded' | |
message_format: 'Statoo build succeeded. <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>' | |
footer: 'repo: <{repo_url}|{repo}>' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |