Skip to content

Merge pull request #294 from sue445/dependabot/go_modules/google.gola… #645

Merge pull request #294 from sue445/dependabot/go_modules/google.gola…

Merge pull request #294 from sue445/dependabot/go_modules/google.gola… #645

Workflow file for this run

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 }}
KMS_KEYRING_KEY_NAME: ${{ secrets.KMS_KEYRING_KEY_NAME }}
KMS_INTEGRATION_TEST_KEY: ${{ secrets.KMS_INTEGRATION_TEST_KEY }}
INTEGRATION_TEST_WANT: "integration_test_value"
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 }}