Add testing environment (#225) #480
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
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
name: aws-deploy | |
on: | |
pull_request: | |
branches: ['*'] | |
push: | |
branches: ['*'] | |
concurrency: ci-${{ github.ref }} | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Static Analysis | |
uses: pre-commit/[email protected] | |
- name: cdk synth | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'synth' | |
actions_comment: false | |
cdk_args: '--context env=dev --debug' | |
- name: Install dependencies | |
run: pip install -r requirements.txt -r requirements-dev.txt | |
- name: Run unit tests | |
run: python -m pytest tests/ -s -v | |
cdk-deploy-dev: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
needs: tests | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Authenticate to AWS using GitHub OIDC | |
- name: Assume AWS Role | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::631692904429:role/sagebase-github-oidc-sage-bionetworks-data-curator-infra | |
role-session-name: GitHubActions-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }} | |
role-duration-seconds: 1200 | |
- name: cdk deploy to org-sagebase-dnt-dev (631692904429) | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'deploy' | |
cdk_args: '--require-approval never --context env=dev --progress events --debug' | |
actions_comment: false | |
cdk-deploy-staging: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/staging' }} | |
needs: tests | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Authenticate to AWS using GitHub OIDC | |
- name: Assume AWS Role | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::878654265857:role/sagebase-github-oidc-sage-bionetworks-data-curator-infra | |
role-session-name: GitHubActions-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }} | |
role-duration-seconds: 1200 | |
- name: cdk deploy to org-sagebase-dca-prod (878654265857) | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'deploy' | |
cdk_args: '--require-approval never --context env=staging --progress events --debug' | |
actions_comment: false | |
cdk-deploy-testing: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/testing' }} | |
needs: tests | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Authenticate to AWS using GitHub OIDC | |
- name: Assume AWS Role | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::878654265857:role/sagebase-github-oidc-sage-bionetworks-data-curator-infra | |
role-session-name: GitHubActions-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }} | |
role-duration-seconds: 1200 | |
- name: cdk deploy to org-sagebase-dca-prod (878654265857) | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'deploy' | |
cdk_args: '--require-approval never --context env=testing --progress events --debug' | |
actions_comment: false | |
cdk-deploy-prod: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/prod' }} | |
needs: tests | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Authenticate to AWS using GitHub OIDC | |
- name: Assume AWS Role | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::878654265857:role/sagebase-github-oidc-sage-bionetworks-data-curator-infra | |
role-session-name: GitHubActions-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }} | |
role-duration-seconds: 1200 | |
- name: cdk deploy to org-sagebase-dca-prod (878654265857) | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'deploy' | |
cdk_args: '--require-approval never --context env=prod --progress events --debug' | |
actions_comment: false |