Use make to render PlantUML #1110
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: Build core | |
on: [ push, pull_request, workflow_dispatch ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
checks: write | |
pull-requests: write | |
steps: | |
# Setup | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: 'yarn' | |
# Build and test TypeScript | |
- run: yarn --immutable --immutable-cache | |
- run: yarn build | |
- run: yarn lint:check | |
- run: yarn test:ci | |
# Report test results | |
- name: Report test results | |
uses: dorny/test-reporter@v1 | |
if: > | |
(success() || failure()) && | |
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) | |
with: | |
name: Mocha tests | |
path: test-results.json | |
reporter: mocha-json | |
# Codecov report | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
# Success notification | |
- name: Send Slack success notification | |
if: success() && github.event_name != 'pull_request' | |
env: | |
SLACK_TITLE: Build succeeded! | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
uses: rtCamp/action-slack-notify@v2 | |
# Failure notification | |
- name: Send Slack failure notification | |
if: failure() && github.event_name != 'pull_request' | |
env: | |
SLACK_TITLE: Build failed! | |
SLACK_COLOR: danger | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
uses: rtCamp/action-slack-notify@v2 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/develop' && github.event_name != 'pull_request' | |
permissions: | |
actions: write | |
id-token: write | |
contents: read | |
env: | |
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | |
steps: | |
- uses: actions/checkout@v4 | |
# Build and push container image to ECR | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_BUILD_INVOCATION_ROLE }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login to ECR | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build and push core container image to ECR | |
uses: docker/build-push-action@v5 | |
with: | |
labels: | | |
org.opencontainers.image.revision=${{ github.sha }} | |
push: true | |
tags: | | |
${{ env.ECR_REGISTRY }}/ar-io-core:develop | |
${{ env.ECR_REGISTRY }}/ar-io-core:${{ github.sha }} | |
- name: Build and push envoy container image to ECR | |
uses: docker/build-push-action@v5 | |
with: | |
labels: | | |
org.opencontainers.image.revision=${{ github.sha }} | |
context: envoy/ | |
push: true | |
tags: | | |
${{ env.ECR_REGISTRY }}/ar-io-envoy:develop | |
${{ env.ECR_REGISTRY }}/ar-io-envoy:${{ github.sha }} | |
# Start CodePipeline to test and deploy images | |
- name: Start CodePipeline | |
run: | | |
aws codepipeline start-pipeline-execution \ | |
--name ${{ secrets.AWS_CODEPIPELINE_NAME }} | |
images: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/develop' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push container image to GitHub Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
labels: | | |
org.opencontainers.image.revision=${{ github.sha }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
ghcr.io/ar-io/ar-io-core:latest | |
ghcr.io/ar-io/ar-io-core:${{ github.sha }} | |