-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(infra): adding in infrastruicture and docs
- Loading branch information
Showing
10 changed files
with
172 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 'Execute CDKTF' | ||
description: 'Builds and either plans or applies a CDKTF environment' | ||
inputs: | ||
scope: | ||
description: 'Turbo Repo scope to run the build for' | ||
required: true | ||
stack-output-path: | ||
description: 'The path where CDKTF outputs the terraform json' | ||
required: true | ||
environment: | ||
description: 'The node environment to build for' | ||
required: true | ||
default: 'development' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
# TODO: These need to request AWS credentials to run terraform | ||
# Since this is a composite step, it may be easier to request these in the calling workflow | ||
- name: Install tfenv | ||
shell: bash | ||
run: | | ||
git clone https://github.com/tfutils/tfenv.git ~/.tfenv | ||
echo "export PATH=$HOME/.tfenv/bin:$PATH" >> $GITHUB_ENV | ||
- name: Install pnpm & node | ||
uses: ./.github/actions/install-pnpm-and-node | ||
with: | ||
scope: ${{ inputs['scope'] }} | ||
|
||
- name: Build CDKTF | ||
shell: bash | ||
run: | | ||
export NODE_ENV=${{ inputs['environment'] }} | ||
pnpm run synth --filter==${{ inputs['scope'] }} | ||
- name: Plan CDKTF | ||
shell: bash | ||
run: | | ||
cd ${{ inputs['stack-output-path'] }} | ||
tfenv install | ||
tfenv use | ||
terraform init |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Workflows | ||
|
||
This repository consists of the following workflows: | ||
|
||
* `pull-request.yml` - Ran on every single Pull Request and performs basic checks of the whole repo like Linting and Unit Tests | ||
* `status-checks.yml` - Triggered on completion of other workflows and is used as the singluar Github Required Status check, since Github does not support Requiring Workflows that are skipped based on path filtering. Note: IF you add a new workflow it must be added to this array to be part of the Github Checks | ||
* `<service-name>.yml` - A workflow represnting a singluar service in the monorepo. | ||
|
||
There are also the following re-usable workflows: | ||
|
||
* `build-and-push-image.yml` - Used to either build & push a docker image to production/development or to just build on pull request | ||
* `test-integrations.yml` - Used to run tests of a service against the `docker-compose.yml` environment. | ||
|
||
And then there are composite Github Actions: | ||
|
||
* `containerize` - Used to build a microservice into a docker image from our monorepo | ||
* `install-pnpm-and-node` - Used to install PNPM and Node, and dependencies based on our `.nvmrc` and pnpm version in `package.json` | ||
|
||
All of the re-usable workflows and actions can be used by other repositories in the Pocket organization. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: 'Re-usable Docker Build Flow' | ||
on: | ||
workflow_call: | ||
inputs: | ||
scope: | ||
description: 'Turbo Repo scope to run the build for' | ||
required: true | ||
type: string | ||
stack-output-path: | ||
description: 'The path where CDKTF outputs the terraform json' | ||
required: true | ||
type: string | ||
|
||
|
||
jobs: | ||
|
||
# TODO: These need to request AWS credentials to run terraform | ||
pull-request: | ||
# Only run this job on a pull request event | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Execute CDKTF | ||
uses: ./.github/actions/cdktf | ||
with: | ||
stack-output-path: ${{inputs['stack-output-path']}} | ||
scope: ${{inputs['scope']}} | ||
environment: production | ||
|
||
|
||
development: | ||
if: github.ref == 'refs/heads/dev' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Execute CDKTF | ||
uses: ./.github/actions/cdktf | ||
with: | ||
stack-output-path: ${{inputs['stack-output-path']}} | ||
scope: ${{inputs['scope']}} | ||
environment: development | ||
|
||
|
||
|
||
production: | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Execute CDKTF | ||
uses: ./.github/actions/cdktf | ||
with: | ||
stack-output-path: ${{inputs['stack-output-path']}} | ||
scope: ${{inputs['scope']}} | ||
environment: production |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
## Note that since this workflow uses Workflow Run changes will only be reflected once it is on the default branch | ||
|
||
# Because we use conditional path filtering on all our workflows, but want to Require status checks to pass on Github, | ||
# we use a special status check job that we can require and will do the checking for us. | ||
# We also use this because re-usable workflows can not be targeted for Github Required Status Checks as of 8/15/2024 | ||
name: Status Checks | ||
on: | ||
workflow_run: | ||
workflows: [ Pull Request, User API, List API ] | ||
types: [ completed ] | ||
|
||
jobs: | ||
xyz: | ||
status-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ahmadnassri/action-workflow-run-wait@v1 | ||
- uses: ahmadnassri/action-workflow-run-wait@v1 | ||
|
||
# Note: If the workflow_run trigger does not work out, this can be used instead with a pull_request event to trigger a long polling job. | ||
# status-check: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Wait for workflows | ||
# id: wait | ||
# uses: smartcontractkit/chainlink-github-actions/utils/wait-for-workflows@main | ||
# with: | ||
# max-timeout: "900" | ||
# polling-interval: "15" | ||
# exclude-workflow-names: "" | ||
# exclude-workflow-ids: "" | ||
# github-token: ${{ secrets.GITHUB_TOKEN }} |
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
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