fixed. #35
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
# https://help.github.com/ja/actions/reference/workflow-syntax-for-github-actions | |
name: Check go-common | |
on: | |
push: | |
branches: | |
- "feature/**" | |
- "develop" | |
- "master" | |
paths: | |
- ".github/workflows/**" | |
- "pkg/**" | |
pull_request: | |
paths: | |
- ".github/workflows/**" | |
- "pkg/**" | |
jobs: | |
check: | |
env: | |
GO_VERSION: go1.19 | |
GOLANGCI_LINT_VERSION: v1.52.2 | |
runs-on: ubuntu-latest | |
steps: | |
- name: "code: check out code" | |
uses: actions/checkout@v2 | |
- name: "parameters: set parameters" | |
id: parameters | |
run: | | |
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') | |
echo "::set-output name=pr_number::${PR_NUMBER}" | |
- name: "go: test" | |
run: | | |
echo $SSH_PRIVATE_KEY >> ./id_rsa | |
chmod +x scripts/* | |
docker pull ghcr.io/y-miyazaki/go-test:latest | |
docker run --rm -v $PWD:/go/src/github.com/y-miyazaki/go-common -v $PWD/id_rsa:/root/.ssh/id_rsa -w /go/src/github.com/y-miyazaki/go-common --name golang-test ghcr.io/y-miyazaki/go-test:latest ./scripts/go_test.sh ${GO_VERSION} | |
rm ./id_rsa | |
- name: "go: upload coverage" | |
uses: actions/upload-artifact@master | |
with: | |
name: coverage | |
path: coverage | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | |
version: ${{ env.GOLANGCI_LINT_VERSION }} | |
- name: "go: golangci-lint for lint" | |
uses: reviewdog/action-golangci-lint@v2 | |
with: | |
golangci_lint_flags: "--config=.golangci.yaml --max-same-issues=0 --max-issues-per-linter=0" | |
level: error | |
fail_on_error: true | |
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }} | |
- name: "slack: notification for failed build." | |
if: failure() | |
uses: rtCamp/action-slack-notify@v2.0.2 | |
env: | |
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL_ID }} | |
SLACK_COLOR: "danger" | |
SLACK_ICON: "" | |
SLACK_TITLE: Failed check | |
SLACK_MESSAGE: | | |
This Github Actions workflow failed check. | |
- Pull Request | |
https://github.com/${{github.repository}}/pull/${{ steps.parameters.outputs.pr_number }} | |
SLACK_USERNAME: y-miyazaki | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |