Skip to content

Commit

Permalink
Merge branch 'lint-platform' of https://github.com/DhairyaMajmudar/ke…
Browse files Browse the repository at this point in the history
…yshade into lint-platform
  • Loading branch information
DhairyaMajmudar committed Jul 27, 2024
2 parents 86280bb + bc55f6f commit 4c165ad
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 116 deletions.
128 changes: 64 additions & 64 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,78 +17,78 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_KEY }}
aws-region: ap-south-1
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v2

- name: Build Docker image
id: build
env:
ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
ECR_REPOSITORY: ${{ vars.ECR_API_REPOSITORY }}
run: |
# Build a docker container and push it to ECR
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/api/Dockerfile .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT
# - name: Build Docker image
# id: build
# env:
# ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
# ECR_REPOSITORY: ${{ vars.ECR_API_REPOSITORY }}
# run: |
# # Build a docker container and push it to ECR
# aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/api/Dockerfile .
# echo "Pushing image to ECR..."
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
# echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT

setup-database:
needs: build
name: Setup Database
runs-on: ubuntu-latest
environment: alpha
# setup-database:
# needs: build
# name: Setup Database
# runs-on: ubuntu-latest
# environment: alpha

steps:
- name: Checkout
uses: actions/checkout@v4
# steps:
# - name: Checkout
# uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# - name: Install Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.2.0
run_install: false
# - name: Install pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 9.2.0
# run_install: false

- name: Deploy migrations
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: pnpm db:deploy-migrations
# - name: Deploy migrations
# env:
# DATABASE_URL: ${{ secrets.DATABASE_URL }}
# run: pnpm db:deploy-migrations

deploy:
needs: [build, setup-database]
runs-on: ubuntu-latest
environment: alpha
name: Deploy API docker image for release
# deploy:
# needs: [build, setup-database]
# runs-on: ubuntu-latest
# environment: alpha
# name: Deploy API docker image for release

steps:
- name: Checkout
uses: actions/checkout@v4
# steps:
# - name: Checkout
# uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_KEY }}
aws-region: ap-south-1
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

- name: Force re-deploy task in service
id: force-redeploy
env:
ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
ECS_SERVICE: ${{ vars.ECS_API_SERVICE }}
run: |
aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
# - name: Force re-deploy task in service
# id: force-redeploy
# env:
# ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
# ECS_SERVICE: ${{ vars.ECS_API_SERVICE }}
# run: |
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
86 changes: 43 additions & 43 deletions .github/workflows/deploy-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,52 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_KEY }}
aws-region: ap-south-1
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v2

- name: Build Docker image
id: build
env:
ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
ECR_REPOSITORY: ${{ vars.ECR_PLATFORM_REPOSITORY }}
run: |
# Build a docker container and push it to ECR
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/platform/Dockerfile .
echo "Pushing image to ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT
# - name: Build Docker image
# id: build
# env:
# ECR_REGISTRY: ${{ vars.ECR_REGISTRY }}
# ECR_REPOSITORY: ${{ vars.ECR_PLATFORM_REPOSITORY }}
# run: |
# # Build a docker container and push it to ECR
# aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/platform/Dockerfile .
# echo "Pushing image to ECR..."
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6}
# echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT

deploy:
needs: build
runs-on: ubuntu-latest
environment: alpha
name: Deploy Platform docker image for release
# deploy:
# needs: build
# runs-on: ubuntu-latest
# environment: alpha
# name: Deploy Platform docker image for release

steps:
- name: Checkout
uses: actions/checkout@v4
# steps:
# - name: Checkout
# uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_KEY }}
aws-region: ap-south-1
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.SECRET_KEY }}
# aws-region: ap-south-1

- name: Force re-deploy task in service
id: force-redeploy
env:
ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
ECS_SERVICE: ${{ vars.ECS_PLATFORM_SERVICE }}
run: |
aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
# - name: Force re-deploy task in service
# id: force-redeploy
# env:
# ECS_CLUSTER: ${{ vars.ECS_CLUSTER }}
# ECS_SERVICE: ${{ vars.ECS_PLATFORM_SERVICE }}
# run: |
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
61 changes: 61 additions & 0 deletions .github/workflows/validate-cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Validate Cli

on:
push:
branches:
- '!develop'
- '!main'
paths:
[
'apps/cli/**',
'.github/workflows/validate-cli.yml',
'.github/workflows/deploy-cli.yml'
]
pull_request:
paths:
[
'apps/cli/**',
'.github/workflows/deploy-cli.yml',
'.github/workflows/validate-cli.yml'
]

jobs:
validate:
runs-on: ubuntu-latest
name: Validate Cli

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.2.0
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install packages
run: |
pnpm i
- name: Lint
run: |
pnpm run lint:cli
61 changes: 61 additions & 0 deletions .github/workflows/validate-platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Validate Platform

on:
push:
branches:
- '!develop'
- '!main'
paths:
[
'apps/platform/**',
'.github/workflows/validate-platform.yml',
'.github/workflows/deploy-platform.yml'
]
pull_request:
paths:
[
'apps/platform/**',
'.github/workflows/deploy-platform.yml',
'.github/workflows/validate-platform.yml'
]

jobs:
validate:
runs-on: ubuntu-latest
name: Validate Platform

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.2.0
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install packages
run: |
pnpm i
- name: Lint
run: |
pnpm run lint:platform
4 changes: 2 additions & 2 deletions apps/api/src/project/controller/project.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ProjectController {
return await this.service.forkProject(user, projectId, forkMetadata)
}

@Put(':projectId/sync-fork')
@Put(':projectId/fork')
@RequiredApiKeyAuthorities(Authority.READ_PROJECT, Authority.UPDATE_PROJECT)
async syncFork(
@CurrentUser() user: User,
Expand All @@ -78,7 +78,7 @@ export class ProjectController {
return await this.service.syncFork(user, projectId, hardSync)
}

@Put(':projectId/unlink-fork')
@Delete(':projectId/fork')
@RequiredApiKeyAuthorities(Authority.UPDATE_PROJECT)
async unlinkFork(
@CurrentUser() user: User,
Expand Down
Loading

0 comments on commit 4c165ad

Please sign in to comment.