Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
feat: ✨ fourmilier devops (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: Eddy Chen <[email protected]>
  • Loading branch information
ap0nia and ecxyzzy authored Oct 16, 2023
1 parent 7d9ab02 commit 60df59f
Show file tree
Hide file tree
Showing 167 changed files with 2,319 additions and 4,007 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.json", "./apps/docs/tsconfig.json", "./apps/docs/cdk/tsconfig.json"],
project: ["./tsconfig.json", "./apps/docs/tsconfig.json"],
sourceType: "module",
},
plugins: ["import", "@typescript-eslint"],
Expand Down Expand Up @@ -38,7 +38,7 @@ const config = {
},
],
},
ignorePatterns: ["*.config.*", "*.cjs"],
ignorePatterns: ["docusaurus.config.js", "*.cjs"],
env: {
es2020: true,
node: true,
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/check-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,5 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build AntStack
run: pnpm build --filter="ant-stack"

- name: Run TypeScript type checking
run: pnpm ci:tsc
47 changes: 7 additions & 40 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,11 @@ jobs:
# Ensure NODE_ENV != production so pnpm will install devDependencies!!!
run: NODE_ENV=development pnpm install --frozen-lockfile

- name: Build AntStack
run: pnpm build --filter="ant-stack"

- name: Link AntStack
run: pnpm link ant-stack

- name: Build API assets
run: pnpm build --filter="api-*"

- name: Wait for API CloudFormation stack to idle
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-prod
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}
- name: Build API
run: pnpm build --filter="@apps/api"

- name: Deploy API CloudFormation stack
run: pnpm run deploy --filter="ant-stack"
run: pnpm --filter="@apps/api" cdk-app deploy

deploy-documentation:
name: Deploy documentation CloudFormation stack and production environment
Expand All @@ -89,18 +76,11 @@ jobs:
# Ensure NODE_ENV != production so pnpm will install devDependencies!!!
run: NODE_ENV=development pnpm install --frozen-lockfile

- name: Build documentation CDK
run: pnpm build --filter="docs-cdk"

- name: Wait for documentation CloudFormation stack to idle
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-docs-prod
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}
- name: Build documentation
run: pnpm build --filter="@apps/docs"

- name: Deploy documentation CloudFormation stack
run: pnpm run deploy --filter="docs-cdk"
run: pnpm --filter="@tools/cdk" docs deploy

deploy-services:
name: Deploy services CloudFormation stack and production environment
Expand All @@ -121,21 +101,8 @@ jobs:
# Ensure NODE_ENV != production so pnpm will install devDependencies!!!
run: NODE_ENV=development pnpm install --frozen-lockfile

- name: Build AntStack
run: pnpm build --filter="ant-stack"

- name: Link AntStack
run: pnpm link ant-stack

- name: Build services
run: pnpm build --filter="@services/*"

- name: Wait for services CloudFormation stack to idle
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-services-prod
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}

- name: Deploy stack
run: pnpm run deploy --filter="@services/*"
run: pnpm --filter="@tools/cdk" services deploy
32 changes: 6 additions & 26 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,11 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build AntStack
run: pnpm build --filter="ant-stack"

- name: Link AntStack
run: pnpm link ant-stack

- name: Build API assets
run: pnpm build --filter="api-*"

- name: Wait for API CloudFormation stack to stabilize
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-staging-${{ github.event.pull_request.number }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}
- name: Build API
run: pnpm build --filter="@apps/api"

- name: Deploy API CloudFormation stack
run: pnpm run deploy --filter="ant-stack"
run: pnpm --filter="@apps/api" cdk-app deploy

deploy-documentation:
name: Deploy documentation CloudFormation stack and staging environment for pull request
Expand All @@ -92,15 +79,8 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build documentation CDK
run: pnpm build --filter="docs-cdk"

- name: Wait for documentation CloudFormation stack to idle
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-docs-staging-${{ github.event.pull_request.number }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}
- name: Build documentation
run: pnpm build --filter="@apps/docs"

- name: Deploy documentation CloudFormation stack
run: pnpm run deploy --filter="docs-cdk"
run: pnpm --filter="@tools/cdk" docs deploy
33 changes: 6 additions & 27 deletions .github/workflows/destroy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,11 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build AntStack
run: pnpm build --filter="ant-stack"

- name: Link AntStack
run: pnpm link ant-stack

# Do not remove this step, as the API assets are required for `cdk destroy` to work properly.
- name: Build API assets
run: pnpm build --filter="api-*"

- name: Wait for API CloudFormation stack to idle
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-staging-${{ github.event.pull_request.number }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}
- name: Build API
run: pnpm build --filter="@apps/api"

- name: Destroy API CloudFormation stack
run: pnpm destroy --filter="ant-stack"
run: pnpm --filter="@apps/api" cdk-app destroy

- name: Set API staging environment to inactive
uses: strumwolf/delete-deployment-environment@195215d2c5602aee6fb4b9cf0853970decca9e7a # v2.3.0
Expand All @@ -92,18 +78,11 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build documentation CDK
run: pnpm build --filter="docs-cdk"

- name: Wait for documentation CloudFormation stack to idle
uses: ./.github/actions/wait-for-cloudformation-stack-idle
with:
stack_name: peterportal-api-next-docs-staging-${{ github.event.pull_request.number }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRETS_ACCESS_KEY }}
- name: Build documentation
run: pnpm build --filter="@apps/docs"

- name: Destroy documentation CloudFormation stack
run: pnpm destroy --filter="docs-cdk"
run: pnpm --filter="@tools/cdk" docs destroy

- name: Set documentation staging environment as inactive
uses: strumwolf/delete-deployment-environment@195215d2c5602aee6fb4b9cf0853970decca9e7a # v2.3.0
Expand Down
3 changes: 0 additions & 3 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
enable-pre-post-scripts = true
shamefully-hoist = true
engine-strict = true
link-workspace-packages = true
91 changes: 0 additions & 91 deletions ant.config.ts

This file was deleted.

6 changes: 6 additions & 0 deletions apps/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules

# Keep environment variables out of version control
.env

.bronya
Loading

0 comments on commit 60df59f

Please sign in to comment.