From f778d6041df577c88361fbdd0c1cb6ba46dfc75f Mon Sep 17 00:00:00 2001 From: briancaffey Date: Wed, 6 Mar 2024 17:18:04 -0500 Subject: [PATCH 1/2] feat(ci): update versions for ci (#40) * feat(ci): update python and action versions in unit tests ci workflow * fix(lint): fix linting with black --- .github/workflows/backend_linting_and_unit_tests.yml | 6 +++--- backend/apps/core/db.py | 2 +- backend/apps/core/management/commands/create_database.py | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/backend_linting_and_unit_tests.yml b/.github/workflows/backend_linting_and_unit_tests.yml index 2d642b8..da00b32 100644 --- a/.github/workflows/backend_linting_and_unit_tests.yml +++ b/.github/workflows/backend_linting_and_unit_tests.yml @@ -30,15 +30,15 @@ jobs: strategy: matrix: - python-version: [3.9.13] + python-version: [3.11.8] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Poetry run: pipx install poetry - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "poetry" diff --git a/backend/apps/core/db.py b/backend/apps/core/db.py index 6b85cac..1063ebb 100644 --- a/backend/apps/core/db.py +++ b/backend/apps/core/db.py @@ -17,7 +17,7 @@ def create_database(database_name=None): dbname="postgres", user="postgres", host=os.environ.get("POSTGRES_SERVICE_HOST", "localhost"), - password=from_secret() # os.environ.get("POSTGRES_PASSWORD", "postgres") + password=from_secret(), # os.environ.get("POSTGRES_PASSWORD", "postgres") ) # https://www.psycopg.org/docs/connection.html#connection.set_isolation_level diff --git a/backend/apps/core/management/commands/create_database.py b/backend/apps/core/management/commands/create_database.py index a69bae8..fbfb87b 100644 --- a/backend/apps/core/management/commands/create_database.py +++ b/backend/apps/core/management/commands/create_database.py @@ -10,14 +10,13 @@ class Command(BaseCommand): - def add_arguments(self, parser): parser.add_argument( - '--database_name', - action='store', - dest='database_name', + "--database_name", + action="store", + dest="database_name", default=None, - help='Optional database name argument', + help="Optional database name argument", ) def handle(self, *args, **options): From 62fc255f2f035de94343269f6f38efae5cc7846c Mon Sep 17 00:00:00 2001 From: briancaffey Date: Wed, 6 Mar 2024 19:36:53 -0500 Subject: [PATCH 2/2] feat(gha): update github actions --- .../workflows/backend_linting_and_unit_tests.yml | 2 +- .github/workflows/backend_update.yml | 4 ++-- .github/workflows/ecr_backend.yml | 10 ++++++---- .github/workflows/ecr_frontend.yml | 5 +++-- .github/workflows/k6_load_test.yml | 16 ++++++---------- .github/workflows/publish-documentation.yml | 9 +++++---- .../{ => wip}/ad_hoc_app_create_update_cdk.yml | 0 .../ad_hoc_app_create_update_pulumi.yml | 0 .../ad_hoc_app_create_update_terraform.yml | 0 .../{ => wip}/ad_hoc_app_destroy_cdk.yml | 0 .../{ => wip}/ad_hoc_app_destroy_terraform.yml | 0 .../{ => wip}/ad_hoc_base_create_update_cdk.yml | 0 .../ad_hoc_base_create_update_pulumi.yml | 0 .../ad_hoc_base_create_update_terraform.yml | 0 .../{ => wip}/ad_hoc_base_destroy_cdk.yml | 0 .../{ => wip}/ad_hoc_base_destroy_pulumi.yml | 0 .../{ => wip}/ad_hoc_base_destroy_terraform.yml | 0 .../{ => wip}/ad_hoc_update_backend.yml | 0 .../{ => wip}/ad_hoc_update_frontend.yml | 0 .../prod_app_create_update_terraform.yml | 0 .../{ => wip}/prod_app_destroy_terraform.yml | 0 .../prod_base_create_update_terraform.yml | 0 .../{ => wip}/prod_base_destroy_terraform.yml | 0 .../workflows/{ => wip}/prod_update_frontend.yml | 0 .github/workflows/{ => wip}/test.yml | 0 25 files changed, 23 insertions(+), 23 deletions(-) rename .github/workflows/{ => wip}/ad_hoc_app_create_update_cdk.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_app_create_update_pulumi.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_app_create_update_terraform.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_app_destroy_cdk.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_app_destroy_terraform.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_base_create_update_cdk.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_base_create_update_pulumi.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_base_create_update_terraform.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_base_destroy_cdk.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_base_destroy_pulumi.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_base_destroy_terraform.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_update_backend.yml (100%) rename .github/workflows/{ => wip}/ad_hoc_update_frontend.yml (100%) rename .github/workflows/{ => wip}/prod_app_create_update_terraform.yml (100%) rename .github/workflows/{ => wip}/prod_app_destroy_terraform.yml (100%) rename .github/workflows/{ => wip}/prod_base_create_update_terraform.yml (100%) rename .github/workflows/{ => wip}/prod_base_destroy_terraform.yml (100%) rename .github/workflows/{ => wip}/prod_update_frontend.yml (100%) rename .github/workflows/{ => wip}/test.yml (100%) diff --git a/.github/workflows/backend_linting_and_unit_tests.yml b/.github/workflows/backend_linting_and_unit_tests.yml index da00b32..311f681 100644 --- a/.github/workflows/backend_linting_and_unit_tests.yml +++ b/.github/workflows/backend_linting_and_unit_tests.yml @@ -1,4 +1,4 @@ -name: Backend / Unit Tests +name: '[CI] unit tests' on: push: diff --git a/.github/workflows/backend_update.yml b/.github/workflows/backend_update.yml index ac03651..c016ef8 100644 --- a/.github/workflows/backend_update.yml +++ b/.github/workflows/backend_update.yml @@ -1,5 +1,5 @@ -name: '[CD] Backend update' -run-name: '[CD] Backend update ${{ inputs.VERSION }} on ${{ inputs.APP_ENV }}' # TODO: add parameters to name +name: '[CD] backend update' +run-name: '[CD] backend update ${{ inputs.VERSION }} on ${{ inputs.APP_ENV }}' on: workflow_dispatch: diff --git a/.github/workflows/ecr_backend.yml b/.github/workflows/ecr_backend.yml index 783df13..65f338b 100644 --- a/.github/workflows/ecr_backend.yml +++ b/.github/workflows/ecr_backend.yml @@ -1,4 +1,5 @@ -name: ECR | Backend - Build Image & Push to ECR +name: '[ECR] build and push' +run-name: '[ECR] build and push ${{ github.ref_name }}' on: push: @@ -12,12 +13,12 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -25,12 +26,13 @@ jobs: - name: Login to Amazon ECR id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + uses: aws-actions/amazon-ecr-login@v2 - name: "Build & Push Backend Docker Image" env: GIT_TAG: ${{ github.ref_name }} AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + DOCKER_BUILDKIT: '1' run: | TAG="${GIT_TAG##*/}" diff --git a/.github/workflows/ecr_frontend.yml b/.github/workflows/ecr_frontend.yml index 81b8fff..02e0a6d 100644 --- a/.github/workflows/ecr_frontend.yml +++ b/.github/workflows/ecr_frontend.yml @@ -1,4 +1,5 @@ -name: ECR | Frontend - Build Image & Push to ECR +name: '[ECR] build frontend image' +run-name: '[ECR] build frontend image ${{ github.ref_name }}' on: push: @@ -25,7 +26,7 @@ jobs: - name: Login to Amazon ECR id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + uses: aws-actions/amazon-ecr-login@v2 - name: "Build & Push Frontend Docker Image" env: diff --git a/.github/workflows/k6_load_test.yml b/.github/workflows/k6_load_test.yml index 0bd4849..baa393d 100644 --- a/.github/workflows/k6_load_test.yml +++ b/.github/workflows/k6_load_test.yml @@ -1,15 +1,11 @@ # github action to create or update an ad hoc environment -name: k6 load test +name: '[k6] load test' +run-name: '[k6] load tests for ${{ inputs.url }}' on: workflow_dispatch: inputs: - - # The Terraform workspace for the shared resources Terraform configuration - # that the ad hoc environment will use. - # This input typically will not be used since all ad hoc environments should use one set of shared resources - # This may be changed if major changes to the shared resources configuration are made to avoid disrupting existing ad hoc environments - url: + URL: description: 'URL to use for load test' required: true type: string @@ -21,11 +17,11 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Run local k6 test - uses: grafana/k6-action@v0.2.0 + uses: grafana/k6-action@v0.3.1 env: - BASE_URL: ${{ github.event.inputs.url }} + BASE_URL: ${{ inputs.URL }} with: filename: k6/script.js diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index ecb43a1..3c1d924 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -1,5 +1,6 @@ # GitHub Action for deploying documentation site to GitHub Pages -name: github pages +name: '[DOCS] github pages' +run-name: '[DOCS] github pages' on: workflow_dispatch: @@ -12,15 +13,15 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: "14" - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} diff --git a/.github/workflows/ad_hoc_app_create_update_cdk.yml b/.github/workflows/wip/ad_hoc_app_create_update_cdk.yml similarity index 100% rename from .github/workflows/ad_hoc_app_create_update_cdk.yml rename to .github/workflows/wip/ad_hoc_app_create_update_cdk.yml diff --git a/.github/workflows/ad_hoc_app_create_update_pulumi.yml b/.github/workflows/wip/ad_hoc_app_create_update_pulumi.yml similarity index 100% rename from .github/workflows/ad_hoc_app_create_update_pulumi.yml rename to .github/workflows/wip/ad_hoc_app_create_update_pulumi.yml diff --git a/.github/workflows/ad_hoc_app_create_update_terraform.yml b/.github/workflows/wip/ad_hoc_app_create_update_terraform.yml similarity index 100% rename from .github/workflows/ad_hoc_app_create_update_terraform.yml rename to .github/workflows/wip/ad_hoc_app_create_update_terraform.yml diff --git a/.github/workflows/ad_hoc_app_destroy_cdk.yml b/.github/workflows/wip/ad_hoc_app_destroy_cdk.yml similarity index 100% rename from .github/workflows/ad_hoc_app_destroy_cdk.yml rename to .github/workflows/wip/ad_hoc_app_destroy_cdk.yml diff --git a/.github/workflows/ad_hoc_app_destroy_terraform.yml b/.github/workflows/wip/ad_hoc_app_destroy_terraform.yml similarity index 100% rename from .github/workflows/ad_hoc_app_destroy_terraform.yml rename to .github/workflows/wip/ad_hoc_app_destroy_terraform.yml diff --git a/.github/workflows/ad_hoc_base_create_update_cdk.yml b/.github/workflows/wip/ad_hoc_base_create_update_cdk.yml similarity index 100% rename from .github/workflows/ad_hoc_base_create_update_cdk.yml rename to .github/workflows/wip/ad_hoc_base_create_update_cdk.yml diff --git a/.github/workflows/ad_hoc_base_create_update_pulumi.yml b/.github/workflows/wip/ad_hoc_base_create_update_pulumi.yml similarity index 100% rename from .github/workflows/ad_hoc_base_create_update_pulumi.yml rename to .github/workflows/wip/ad_hoc_base_create_update_pulumi.yml diff --git a/.github/workflows/ad_hoc_base_create_update_terraform.yml b/.github/workflows/wip/ad_hoc_base_create_update_terraform.yml similarity index 100% rename from .github/workflows/ad_hoc_base_create_update_terraform.yml rename to .github/workflows/wip/ad_hoc_base_create_update_terraform.yml diff --git a/.github/workflows/ad_hoc_base_destroy_cdk.yml b/.github/workflows/wip/ad_hoc_base_destroy_cdk.yml similarity index 100% rename from .github/workflows/ad_hoc_base_destroy_cdk.yml rename to .github/workflows/wip/ad_hoc_base_destroy_cdk.yml diff --git a/.github/workflows/ad_hoc_base_destroy_pulumi.yml b/.github/workflows/wip/ad_hoc_base_destroy_pulumi.yml similarity index 100% rename from .github/workflows/ad_hoc_base_destroy_pulumi.yml rename to .github/workflows/wip/ad_hoc_base_destroy_pulumi.yml diff --git a/.github/workflows/ad_hoc_base_destroy_terraform.yml b/.github/workflows/wip/ad_hoc_base_destroy_terraform.yml similarity index 100% rename from .github/workflows/ad_hoc_base_destroy_terraform.yml rename to .github/workflows/wip/ad_hoc_base_destroy_terraform.yml diff --git a/.github/workflows/ad_hoc_update_backend.yml b/.github/workflows/wip/ad_hoc_update_backend.yml similarity index 100% rename from .github/workflows/ad_hoc_update_backend.yml rename to .github/workflows/wip/ad_hoc_update_backend.yml diff --git a/.github/workflows/ad_hoc_update_frontend.yml b/.github/workflows/wip/ad_hoc_update_frontend.yml similarity index 100% rename from .github/workflows/ad_hoc_update_frontend.yml rename to .github/workflows/wip/ad_hoc_update_frontend.yml diff --git a/.github/workflows/prod_app_create_update_terraform.yml b/.github/workflows/wip/prod_app_create_update_terraform.yml similarity index 100% rename from .github/workflows/prod_app_create_update_terraform.yml rename to .github/workflows/wip/prod_app_create_update_terraform.yml diff --git a/.github/workflows/prod_app_destroy_terraform.yml b/.github/workflows/wip/prod_app_destroy_terraform.yml similarity index 100% rename from .github/workflows/prod_app_destroy_terraform.yml rename to .github/workflows/wip/prod_app_destroy_terraform.yml diff --git a/.github/workflows/prod_base_create_update_terraform.yml b/.github/workflows/wip/prod_base_create_update_terraform.yml similarity index 100% rename from .github/workflows/prod_base_create_update_terraform.yml rename to .github/workflows/wip/prod_base_create_update_terraform.yml diff --git a/.github/workflows/prod_base_destroy_terraform.yml b/.github/workflows/wip/prod_base_destroy_terraform.yml similarity index 100% rename from .github/workflows/prod_base_destroy_terraform.yml rename to .github/workflows/wip/prod_base_destroy_terraform.yml diff --git a/.github/workflows/prod_update_frontend.yml b/.github/workflows/wip/prod_update_frontend.yml similarity index 100% rename from .github/workflows/prod_update_frontend.yml rename to .github/workflows/wip/prod_update_frontend.yml diff --git a/.github/workflows/test.yml b/.github/workflows/wip/test.yml similarity index 100% rename from .github/workflows/test.yml rename to .github/workflows/wip/test.yml