Merge pull request #130 from sue445/dependabot/go_modules/github.com/… #292
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.19" | |
- "1.20" | |
- "1.21" | |
- "1.22" | |
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: Run integration test | |
run: | | |
echo $SERVICE_ACCOUNT_KEY > /tmp/service_account.json | |
# c.f. https://cloud.google.com/docs/authentication/production | |
export GOOGLE_APPLICATION_CREDENTIALS=/tmp/service_account.json | |
make test | |
rm -f /tmp/service_account.json | |
env: | |
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }} | |
INTEGRATION_TEST_PROJECT_ID: ${{ secrets.INTEGRATION_TEST_PROJECT_ID }} | |
INTEGRATION_TEST_WANT: ${{ secrets.INTEGRATION_TEST_WANT }} | |
continue-on-error: true # NOTE: secrets cannot be obtained with forked repository PR | |
- 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 | |
continue-on-error: true # NOTE: secrets cannot be obtained with forked repository PR | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
matrix: ${{ toJson(matrix) }} | |
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: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
notify: | |
needs: | |
- test | |
- lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack Notification (success) | |
uses: act10ns/slack@v2 | |
if: always() | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} |