go: 2025 links #64
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: | |
- master | |
- test | |
jobs: | |
ci: | |
name: ci | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
outputs: | |
image-tag: "${{ steps.login-ecr.outputs.registry }}/rko-router:${{ github.sha }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2' | |
bundler-cache: true | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: "us-west-2" | |
role-skip-session-tagging: true | |
role-to-assume: "arn:aws:iam::005216166247:role/GhaRkoRouterDeploy" | |
mask-aws-account-id: 'false' # only string works | |
- id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: 'Build Docker image' | |
uses: 'docker/build-push-action@v3' | |
with: | |
context: '.' | |
load: true | |
tags: "rko-router-test:latest,${{ steps.login-ecr.outputs.registry }}/rko-router:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/rko-router:latest" | |
- name: 'Start container for test' | |
run: | | |
set -x | |
docker kill rko-router-dut || : | |
docker container wait rko-router-dut || : | |
while docker inspect rko-router-dut >/dev/null; do sleep 1; done | |
docker run --rm --name rko-router-dut --publish 127.0.0.1::8080 --detach rko-router-test:latest | |
export TARGET_HOST="http://$(docker port rko-router-dut 8080)" | |
for i in {1..10}; do | |
if curl -Ssf "${TARGET_HOST}/healthz"; then break; fi | |
sleep 1 | |
done | |
curl -f -D- "${TARGET_HOST}/healthz" | |
- name: 'Run test suite' | |
run: | | |
set -x | |
export TARGET_HOST="http://$(docker port rko-router-dut 8080)" | |
bundle exec rspec -fd || ( docker logs rko-router-dut; false ) | |
- name: 'Push Docker image' | |
uses: 'docker/build-push-action@v5' | |
with: | |
context: '.' | |
push: true | |
tags: "${{ steps.login-ecr.outputs.registry }}/rko-router:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/rko-router:latest" | |
deploy: | |
name: deploy | |
environment: | |
name: apprunner-prod | |
url: https://rko-router.rubykaigi.org | |
concurrency: | |
group: apprunner-prod | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: | |
- ci | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: "us-west-2" | |
role-skip-session-tagging: true | |
role-to-assume: "arn:aws:iam::005216166247:role/GhaRkoRouterDeploy" | |
mask-aws-account-id: 'false' # only string works | |
- uses: awslabs/[email protected] | |
with: | |
region: "us-west-2" | |
service: "rko-router" | |
image: "${{needs.ci.outputs.image-tag}}" | |
access-role-arn: "arn:aws:iam::005216166247:role/AppraRkoRouter" | |
wait-for-service-stability: true | |
cpu: '0.25' # vCPU | |
memory: '0.5' # GB | |
port: "8080" | |