From 8cabf6ad6aa7fbc779533e51a9e954394f20a857 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Fri, 16 Aug 2024 13:47:36 -0700 Subject: [PATCH] chore(ci): adding in braze and client api --- .github/actions/containerize/action.yml | 5 +++ .github/workflows/account-data-deleter.yml | 6 ---- .github/workflows/annotations-api.yml | 2 +- .github/workflows/braze.yml | 23 +++++++++++++ .github/workflows/client-api.yml | 34 +++++++++++++++++++ .github/workflows/list-api.yml | 4 --- .../workflows/reuse-build-and-push-image.yml | 18 +++++++--- .github/workflows/status-checks.yml | 9 ++++- 8 files changed, 85 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/braze.yml create mode 100644 .github/workflows/client-api.yml diff --git a/.github/actions/containerize/action.yml b/.github/actions/containerize/action.yml index 381be5d4d..d3f00424d 100644 --- a/.github/actions/containerize/action.yml +++ b/.github/actions/containerize/action.yml @@ -10,6 +10,10 @@ inputs: app-path: description: 'The path of where the application is located in the monorepo ie servers/' required: true + context: + description: 'The path of where to build from' + required: true + default: '.' app-port: description: 'The port the application runs on ie 4006' required: true @@ -67,6 +71,7 @@ runs: with: push: ${{inputs.push}} tags: ${{inputs.docker-repo-name}}:${{ github.sha }} + context: ${{ inputs.context }} build-args: | GIT_SHA=${{ github.sha }} SCOPE=${{inputs.scope}} diff --git a/.github/workflows/account-data-deleter.yml b/.github/workflows/account-data-deleter.yml index b854156c1..afec087a9 100644 --- a/.github/workflows/account-data-deleter.yml +++ b/.github/workflows/account-data-deleter.yml @@ -1,6 +1,5 @@ name: Account Data Deleter on: - # Only run the tests for this service when any of the following file paths change pull_request: paths: - 'infrastructure/account-data-deleter/**' @@ -18,17 +17,13 @@ on: - dev jobs: - # Let's test the service against some real life and mocked docker services. test-integrations: - # Only run this job on a pull request event if: github.event_name == 'pull_request' - # Use our re-usable test integrations workflow which will use our docker compose file uses: ./.github/workflows/reuse-test-integrations.yml with: scope: account-data-deleter secrets: inherit - # It's infrastructure time, run the infrastructure update commands infrastructure: uses: ./.github/workflows/reuse-infrastructure.yml with: @@ -36,7 +31,6 @@ jobs: stack-output-path: infrastructure/account-data-deleter/cdktf.out/stacks/account-data-deleter secrets: inherit - # Let's try building and conidtionally pushing our docker image to the necessary account. api: uses: ./.github/workflows/reuse-build-and-push-image.yml needs: [infrastructure] diff --git a/.github/workflows/annotations-api.yml b/.github/workflows/annotations-api.yml index 00c8111f4..102903cf7 100644 --- a/.github/workflows/annotations-api.yml +++ b/.github/workflows/annotations-api.yml @@ -28,7 +28,7 @@ jobs: uses: ./.github/workflows/reuse-apollo-federation.yml with: federated-graph-name: pocket-client-api - graph-name: list + graph-name: annotations-api schema-file-path: servers/annotations-api/dist/schema-generated.graphql prod-graph-url: https://annotations-api.readitlater.com dev-graph-url: https://annotations-api.getpocket.dev diff --git a/.github/workflows/braze.yml b/.github/workflows/braze.yml new file mode 100644 index 000000000..97a52194c --- /dev/null +++ b/.github/workflows/braze.yml @@ -0,0 +1,23 @@ +name: Braze +on: + pull_request: + paths: + - 'infrastructure/braze/**' + - 'packages/**' + - 'pnpm-lock.yaml' + - '.github/actions/**' + - '.github/workflows/braze.yml' + - '.github/workflows/reuse-*.yml' + push: + branches: + - main + - dev + +jobs: + + infrastructure: + uses: ./.github/workflows/reuse-infrastructure.yml + with: + scope: braze-cdk + stack-output-path: infrastructure/braze/cdktf.out/stacks/braze + secrets: inherit diff --git a/.github/workflows/client-api.yml b/.github/workflows/client-api.yml new file mode 100644 index 000000000..6f397443f --- /dev/null +++ b/.github/workflows/client-api.yml @@ -0,0 +1,34 @@ +name: Client API +on: + pull_request: + paths: + - 'infrastructure/client-api/**' + - 'packages/**' + - 'servers/client-api/**' + - 'pnpm-lock.yaml' + - '.github/actions/**' + - '.github/workflows/client-api.yml' + - '.github/workflows/reuse-*.yml' + push: + branches: + - main + - dev + +jobs: + + infrastructure: + uses: ./.github/workflows/reuse-infrastructure.yml + with: + scope: client-api-cdk + stack-output-path: infrastructure/client-api/cdktf.out/stacks/client-api + secrets: inherit + + api: + uses: ./.github/workflows/reuse-build-and-push-image.yml + needs: [infrastructure] + with: + docker-repo-name-pattern: clientapi-{0}-app + context: servers/client-api + app-path: servers/client-api + terraform-output: ${{needs.infrastructure.outputs.terraform-output}} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/list-api.yml b/.github/workflows/list-api.yml index 3300988a2..fcaad8727 100644 --- a/.github/workflows/list-api.yml +++ b/.github/workflows/list-api.yml @@ -1,6 +1,5 @@ name: List API on: - # Only run the tests for this service when any of the following file paths change pull_request: paths: - 'infrastructure/list-api/**' @@ -16,10 +15,8 @@ on: - dev jobs: - # Let's test the service against some real life and mocked docker services. test-integrations: if: github.event_name == 'pull_request' - # Use our re-usable test integrations workflow which will use our docker compose file uses: ./.github/workflows/reuse-test-integrations.yml with: scope: list-api @@ -37,7 +34,6 @@ jobs: secrets: apollo-key: ${{ secrets.APOLLO_CLIENT_API_KEY }} - # It's infrastructure time, run the infrastructure update commands infrastructure: uses: ./.github/workflows/reuse-infrastructure.yml with: diff --git a/.github/workflows/reuse-build-and-push-image.yml b/.github/workflows/reuse-build-and-push-image.yml index 113db4f54..0c400873c 100644 --- a/.github/workflows/reuse-build-and-push-image.yml +++ b/.github/workflows/reuse-build-and-push-image.yml @@ -4,7 +4,8 @@ on: inputs: scope: description: 'Turbo Repo scope to run the build for' - required: true + required: false + default: '' type: string docker-repo-name-pattern: description: 'Docker name of the repo, usually: servicename-{0}-app. {0} is replaced with dev or prod' @@ -18,13 +19,20 @@ on: description: 'AWS Development Account Id' type: string default: 996905175585.dkr.ecr.us-east-1.amazonaws.com + context: + description: 'The path of where the application should be built from' + required: false + default: '.' + type: string app-path: description: 'The path of where the application is located in the monorepo ie servers/' - required: true + required: false + default: '' type: string app-port: description: 'The port the application runs on ie 4006' - required: true + required: false + default: 80 type: number sentry-org: description: 'The org name used in sentry. Used to upload source maps' @@ -33,7 +41,8 @@ on: default: pocket sentry-project: description: 'The project name used in sentry. Used to upload source maps' - required: true + required: false + default: '' type: string terraform-output: description: 'The terraform output which is used to get the ECS_Service and Task Defintion arns for codedeploy' @@ -60,6 +69,7 @@ jobs: docker-repo-name: "${{inputs.development-aws-registry }}/${{ format(inputs.docker-repo-name-pattern, 'dev') }}" app-path: ${{inputs.app-path}} app-port: ${{inputs.app-port}} + context: ${{inputs.context}} sentry-project: ${{inputs.sentry-project}} sentry-org: ${{inputs.sentry-org}} sentry-token: ${{secrets.SENTRY_BEARER}} diff --git a/.github/workflows/status-checks.yml b/.github/workflows/status-checks.yml index 7b064c58e..a5839ef0f 100644 --- a/.github/workflows/status-checks.yml +++ b/.github/workflows/status-checks.yml @@ -6,7 +6,14 @@ name: Status Checks on: workflow_run: - workflows: [ Pull Request, User API, List API, Account Delete Monitor, Annotations API ] + workflows: + - Pull Request + - User API + - List API + - Account Delete Monitor + - Annotations API + - Braze + - Client API types: [ completed ] jobs: