chore: integtation test locally #244
Workflow file for this run
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: ci | |
on: | |
push: | |
branches: | |
- "feat/**" | |
- "refactor/**" | |
- "fix/**" | |
pull_request: | |
branches: | |
- "main" | |
workflow_call: | |
permissions: write-all | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goversion: [">=1.21.0"] | |
env: | |
AWS_ACCESS_KEY_ID: ABC1234567890 | |
AWS_SECRET_ACCESS_KEY: ABC1234567890 | |
AWS_DEFAULT_REGION: ap-northeast-1 | |
DYNAMODB_ENDPOINT: http://localhost:8000 | |
services: | |
dynamodb: | |
image: amazon/dynamodb-local:latest | |
ports: | |
- 8000:8000 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.goversion }} | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Setup mockgen | |
run: | | |
go install go.uber.org/mock/mockgen@latest | |
- name: Go Generate | |
run: | | |
go mod tidy | |
go generate ./... | |
git diff --exit-code | |
- name: Setup reviewdog | |
uses: reviewdog/action-setup@v1 | |
with: | |
reviewdog_version: latest | |
- name: Setup staticcheck | |
run: | | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
- name: staticcheck with reviewdog | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
staticcheck ./... | reviewdog -f=staticcheck -reporter=github-pr-check -level warning | |
- name: Unit Test | |
run: | | |
TARGET=$(go list ./... | grep -v "mock") | |
go test $TARGET -v -coverpkg=$TARGET -coverprofile=coverage.out | |
- name: Upload unit test coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
fail_ci_if_error: false | |
verbose: true | |
flags: unit | |
- name: Create Table | |
working-directory: ./integrationtest | |
run: | | |
aws dynamodb create-table --cli-input-json file://table-def.json --endpoint-url ${{ env.DYNAMODB_ENDPOINT }} | |
- name: Integration Test | |
working-directory: ./integrationtest | |
run: | | |
go mod tidy | |
go test -v -coverpkg=${{ format('github.com/{0}', github.repository) }} -coverprofile=coverage.out | |
- name: Upload integration test coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./integrationtest/coverage.out | |
fail_ci_if_error: false | |
verbose: true | |
flags: integration |