Merge pull request #619 from 88labs/dependabot/go_modules/aws/depende… #631
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 AWS | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "aws/**" | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
paths: | |
- "aws/**" | |
env: | |
testdir : ./aws | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [ 1.22.x ] | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Cache Go modules | |
id: cache-go | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download Go modules | |
working-directory: ${{ env.testdir }} | |
shell: bash | |
if: ${{ steps.cache-go.outputs.cache-hit != 'true' }} | |
run: go mod download | |
- name: Setup Docker | |
working-directory: ${{ env.testdir }} | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
# Create the directory for the volume of dynamodb in advance, otherwise permission error will occur. | |
# https://stackoverflow.com/questions/45850688/unable-to-open-local-dynamodb-database-file-after-power-outage | |
mkdir -p ./docker/dynamodb/data | |
sudo chmod 777 ./docker/dynamodb/data | |
docker compose up -d | |
- name: Test | |
working-directory: ${{ env.testdir }} | |
run: | | |
go install gotest.tools/gotestsum@latest | |
# shellcheck disable=SC2046 | |
gotestsum --rerun-fails=3 --packages="./..." --junitfile unit-tests.xml -- -p 4 -parallel 4 -v ./... -race -coverprofile="coverage.txt" -covermode=atomic -coverpkg=./... | |
- uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./unit-tests.xml,./coverage.txt |