Merge pull request #654 from 88labs/dependabot/go_modules/aws/depende… #711
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.23.x ] | |
os: [ ubuntu-22.04 ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
services: | |
minio: | |
image: mosuka/minio:latest | |
ports: | |
- 29000:9000 | |
env: | |
MINIO_ROOT_USER: DUMMYACCESSKEYEXAMPLE | |
MINIO_ROOT_PASSWORD: DUMMYSECRETKEYEXAMPLE | |
AWS_DEFAULT_REGION: ap-northeast-1 | |
AWS_EC2_METADATA_DISABLED: true | |
elasticmq: | |
image: softwaremill/elasticmq:latest | |
ports: | |
- 29324:29324 | |
env: | |
JAVA_OPTS: "-Dconfig.override_with_env_vars=true" | |
CONFIG_FORCE_node-address_port: 29324 | |
CONFIG_FORCE_rest-sqs_bind-port: 29324 | |
CONFIG_FORCE_queues_test-queue_fifo: false | |
CONFIG_FORCE_queues_test-2-queue_fifo: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: | | |
${{ env.testdir }}/go.sum | |
- id: install-minio-cli | |
uses: yakubique/setup-minio-cli@d9826c1ad14228495203415557139d4cf491bed9 # v1.0.0 | |
- name: Setup gotestsum | |
uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0 | |
with: | |
gotestsum_version: 1.12.0 | |
- name: Download Go modules | |
working-directory: ${{ env.testdir }} | |
shell: bash | |
run: go mod download | |
# - name: Run DynamoDB | |
# working-directory: ${{ env.testdir }} | |
# run: docker compose up -d dynamodb dynamodbcreatetable | |
# - name: Migrate DynamoDB | |
# timeout-minutes: 1 | |
# working-directory: ${{ env.testdir }} | |
# env: | |
# AWS_ACCESS_KEY_ID: DUMMYACCESSKEYEXAMPLE | |
# AWS_SECRET_ACCESS_KEY: DUMMYSECRETKEYEXAMPLE | |
# AWS_DEFAULT_REGION: ap-northeast-1 | |
# shell: bash | |
# run: | | |
# until (aws dynamodb list-tables --endpoint-url http://127.0.0.1:28002 --output text) do echo '...waiting...' && sleep 1; done; | |
# aws dynamodb create-table --cli-input-json file:///${{ github.workspace }}/aws/docker/dynamodb/table_test.json --endpoint-url http://127.0.0.1:28002 | |
# until (aws dynamodb describe-table --table-name test --endpoint-url http://127.0.0.1:28002 --output text) do echo '...waiting...' && sleep 1; done; | |
- name: Migrate Minio | |
timeout-minutes: 1 | |
working-directory: ${{ env.testdir }} | |
shell: bash | |
run: | | |
mc alias set s3 http://127.0.0.1:29000 DUMMYACCESSKEYEXAMPLE DUMMYSECRETKEYEXAMPLE | |
mc --quiet mb s3/test | |
mc --quiet anonymous set upload s3/test | |
mc --quiet anonymous set download s3/test | |
mc --quiet policy set-json /policies/policy_test.json s3/test | |
- name: Test | |
working-directory: ${{ env.testdir }} | |
run: | | |
# shellcheck disable=SC2046 | |
# FIXME: awsdynamo test doesn't work with ci. | |
gotestsum --format testname --junitfile unit-tests.xml -- -p 4 -race -coverprofile="coverage.txt" -covermode=atomic -coverpkg=./... $(go list ./... | grep -v awsdynamo) | |
- uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./unit-tests.xml,./coverage.txt |