Skip to content

Commit

Permalink
Add ci/cd pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ernitingarg committed Jan 8, 2024
1 parent 7b5d70c commit 2404e39
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ PORT=5000
PROJECT_NAME=demo
TABLE_NAME=sample_table

AWS_DEFAULT_ACCOUNT=975050344965
AWS_DEFAULT_REGION=ap-northeast-1

AWS_FARGATE_CONTAINER_CPU=512
AWS_FARGATE_CONTAINER_MEMORY=1024
19 changes: 19 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off"
}
}
61 changes: 61 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI pipeline

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

steps:
- name: Notify Trigger
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event on branch ${{ github.ref }}."

- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2

- name: Cache Dependencies
uses: actions/cache@v2
id: backend-npm-cache
with:
path: "node_modules"
key: client-npm-${{ hashFiles('package.json') }}

- name: Install Dependencies
run: npm install
if: steps.backend-npm-cache.outputs.cache-hit != 'true'

- name: Run Linter
run: npm run lint

- name: Run Typecheck
run: npm run typecheck

- name: Run build
run: npm run build

- name: Run Test
run: npm run test

- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Diff AWS CDK stack
run: npx cdk diff --ci --require-approval never

- name: Display Job Status
run: echo "🍏 This job's status is ${{ job.status }}."
2 changes: 1 addition & 1 deletion bin/aws-cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import env from "../backend/src/config";

const app = new cdk.App();
new FargateStack(app, "FargateStack", {
env: { account: env.AWS_DEFAULT_ACCOUNT, region: env.AWS_DEFAULT_REGION },
env: { account: env.AWS_ACCOUNT, region: env.AWS_REGION },
});

0 comments on commit 2404e39

Please sign in to comment.