Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #160 from pt-hieu/dev
Browse files Browse the repository at this point in the history
V1.0.0: MVP Release
  • Loading branch information
pt-hieu authored Jan 23, 2022
2 parents 6fbe6e0 + 92f444f commit 06c6525
Show file tree
Hide file tree
Showing 323 changed files with 44,484 additions and 14 deletions.
50 changes: 50 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
assignees:
- 'pt-hieu'
reviewers:
- 'pt-hieu'
commit-message:
prefix: 'deps'
include: 'scope'

- package-ecosystem: 'npm'
directory: '/artemis'
schedule:
interval: 'daily'
assignees:
- 'pt-hieu'
reviewers:
- 'pt-hieu'
commit-message:
prefix: 'deps'
include: 'scope'

- package-ecosystem: 'npm'
directory: '/apollo'
schedule:
interval: 'daily'
assignees:
- 'pt-hieu'
reviewers:
- 'pt-hieu'
commit-message:
prefix: 'deps'
include: 'scope'

- package-ecosystem: 'docker'
directory: '/'
schedule:
interval: 'weekly'
day: 'saturday'
assignees:
- 'pt-hieu'
reviewers:
- 'pt-hieu'
commit-message:
prefix: 'deps'
include: 'scope'
6 changes: 6 additions & 0 deletions .github/slack-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pt-hieu: "U02HM042G07"
ahl2811: "U02JEAUJ797"
hieulm2k: "U02HUU8DQHL"
MinhHieu2312: "U02J1LK83H9"
nhlong20: "U02MGH42XPV"
phamviethoa: "U02JE8SFU8Z"
93 changes: 93 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
pull_request:
branches: [dev]
types: [labeled, synchronize, opened, reopened]

jobs:
Label_Checker:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.result.outputs.should_run }}
steps:
- name: Check label for Apollo
uses: docker://agilepathway/pull-request-label-checker:latest
id: apollo
with:
any_of: backend,both
repo_token: ${{ secrets.ACCESS_TOKEN }}
continue-on-error: true
- name: Check label for Artemis
uses: docker://agilepathway/pull-request-label-checker:latest
id: artemis
with:
any_of: frontend,both
repo_token: ${{ secrets.ACCESS_TOKEN }}
continue-on-error: true

- name: Output result
id: result
env:
apollo: ${{ toJson(steps.apollo.outcome) }}
artemis: ${{ toJson(steps.artemis.outcome) }}
run: |
if [ ${{ env.apollo }} == "success" ]; then
if [ ${{ env.artemis }} == "success" ]; then
echo "::set-output name=should_run::both"
else
echo "::set-output name=should_run::apollo"
fi
else
if [ ${{ env.artemis }} == "success" ]; then
echo "::set-output name=should_run::artemis"
else
echo "::set-output name=should_run::none"
fi
fi
Apollo:
needs: Label_Checker
if: ${{ needs.Label_Checker.outputs.should_run == 'apollo' || needs.Label_Checker.outputs.should_run == 'both' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./apollo
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Dependency
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install

- name: Run Unit Test
run: yarn test

- name: Run Lint
run: yarn lint

Artemis:
needs: Label_Checker
if: ${{ needs.Label_Checker.outputs.should_run == 'artemis' || needs.Label_Checker.outputs.should_run == 'both' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./artemis
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Dependency
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install

- name: Build
run: yarn build
92 changes: 92 additions & 0 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Deploy Prod
on:
push:
branches: [master]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
apollo:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./apollo
push: true
file: ./apollo/Dockerfile.prod
tags: ghcr.io/pt-hieu/lettutor-crm:apollo-prod
labels: ${{ steps.meta.outputs.labels }}

artemis:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./artemis
file: ./artemis/Dockerfile.prod
push: true
tags: ghcr.io/pt-hieu/lettutor-crm:artemis-prod
labels: ${{ steps.meta.outputs.labels }}

deploy:
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [apollo, artemis]
steps:
- uses: actions/checkout@v2
- name: deploy on ec2
env:
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE }}
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ubuntu@18.167.61.239 '
cd ~/lettutor-crm && ./start-prod.sh
'
90 changes: 90 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Deploy
on:
push:
branches: [dev]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
apollo:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./apollo
push: true
tags: ghcr.io/pt-hieu/lettutor-crm:apollo
labels: ${{ steps.meta.outputs.labels }}

artemis:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./artemis
push: true
tags: ghcr.io/pt-hieu/lettutor-crm:artemis
labels: ${{ steps.meta.outputs.labels }}

deploy:
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [apollo, artemis]
steps:
- uses: actions/checkout@v2
- name: deploy on ec2
env:
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE }}
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ubuntu@16.162.104.246 '
cd ~/lettutor-crm && ./start.sh
'
38 changes: 38 additions & 0 deletions .github/workflows/poseidon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Poseidon
on: [workflow_dispatch]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
poseidon:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./poseidon
push: true
tags: ghcr.io/pt-hieu/lettutor-crm:poseidon
labels: ${{ steps.meta.outputs.labels }}
Loading

0 comments on commit 06c6525

Please sign in to comment.