Update issue templates #241
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
on: | |
push: | |
branches: | |
- 'master' | |
- 'develop' | |
name: push_master_develop | |
jobs: | |
staticcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19.x | |
- name: checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
args: --timeout=5m | |
- name: install deps | |
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest | |
- name: gofmt | |
run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi | |
- name: generated files should not be modified | |
run: | | |
go generate ./... | |
git update-index --assume-unchanged go.mod | |
git update-index --assume-unchanged go.sum | |
if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after runing go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi | |
test: | |
strategy: | |
matrix: | |
go-version: [1.19.x] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
needs: | |
- staticcheck | |
steps: | |
- name: install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: install deps | |
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest | |
- name: Test | |
run: | | |
go test -v -timeout=30m ./... | |
- name: Test (race) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
go test -v -timeout=50m -race -short ./... | |
slack-workflow-status-failed: | |
if: failure() | |
name: post workflow status to slack | |
needs: | |
- staticcheck | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify slack -- workflow failed | |
id: slack | |
uses: slackapi/slack-github-action@v1.19.0 | |
with: | |
payload: | | |
{ | |
"actor": "${{ github.actor }}", | |
"repo": "${{ github.repository }}", | |
"status": "FAIL", | |
"title": "push to ${{ github.event.push.base_ref }}", | |
"pr": "" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
slack-workflow-status-success: | |
if: success() | |
name: post workflow status to slack | |
needs: | |
- staticcheck | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify slack -- workflow succeeded | |
id: slack | |
uses: slackapi/slack-github-action@v1.19.0 | |
with: | |
payload: | | |
{ | |
"actor": "${{ github.actor }}", | |
"repo": "${{ github.repository }}", | |
"status": "SUCCESS", | |
"title": "push to ${{ github.event.push.base_ref }}", | |
"pr": "" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_SUCCESS }} |