Use GitHub App for auto patch tagging #122
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
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set.outputs.matrix }} | |
release-go-version: ${{ steps.set.outputs.release-go-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
- id: set | |
run: go run ./tools/setghaoutputs | tee -a "$GITHUB_OUTPUT" | |
test: | |
needs: setup | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{fromJson(needs.setup.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Start LocalStack | |
uses: LocalStack/[email protected] | |
with: | |
image-tag: 'latest' | |
install-awslocal: 'true' | |
- name: Run tests | |
run: go test -v ./... | |
env: | |
# localstack requires these environment variables | |
AWS_DEFAULT_REGION: ap-northeast-1 | |
# Credentials are important for localstack | |
# Without them, the tests will fail like: | |
# operation error S3: CreateBucket, get identity: get credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, failed to get API token, operation error ec2imds: getToken, http response error StatusCode: 400, request to EC2 IMDS failed | |
AWS_ACCESS_KEY_ID: test | |
AWS_SECRET_ACCESS_KEY: test | |
# These environment variables are required by main and main_test | |
# Without them, the tests will fail like: | |
# operation error S3: CreateBucket, exceeded maximum number of attempts, 3, https response error StatusCode: 500, RequestID: 346f5995-bbe8-41e2-be03-3a6ab0ad5edd, HostID: s9lzHYrFp76ZVxRcpX9+5cjAnEH2ROuNkd2BHfIa6UkFVdtjf5mKR3/eTPFvsiP/XV/VLi31234=, api error InternalError: exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT / | |
S3_BUCKET: mybucket | |
S3_KEY: mykey | |
# This one is for setupDynamoDBTable in main_test | |
DYNAMODB_TABLE: mytable | |
# This one is for setupSQSQueue in main_test | |
SQS_QUEUE_URL: https://sqs.ap-northeast-1.amazonaws.com/123456789012/myqueue | |
goreleaser: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ needs.setup.outputs.release-go-version }} | |
- name: Goreleaser image building test | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
args: release --snapshot | |
- name: Verify docker images working | |
run: docker run --rm ghcr.io/chatwork/aws-checker:canary-amd64 aws-checker version |