Skip to content

Commit

Permalink
chore(dev): remove unnecessary files
Browse files Browse the repository at this point in the history
  • Loading branch information
nunocaseiro committed Nov 18, 2022
1 parent 549180d commit b7aa1c5
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 227 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/deploy_backend-dev.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/deploy_backend.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/deploy_backend_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy

on:
push:
branches:
- main
- dev

jobs:
build_backend:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'dev' && 'dev' || 'prod' }}

steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: split.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- run: |
docker build ./backend -f ./backend/docker/prod/Dockerfile -t split.azurecr.io/backend${{ github.ref_name == 'dev' && '-dev' || '' }}:latest
docker push split.azurecr.io/backend${{ github.ref_name == 'dev' && '-dev' || '' }}:latest
- uses: azure/webapps-deploy@v2
with:
app-name: ${{ github.ref_name == 'dev' && 'split-be-dev' || 'split-be' }}
publish-profile: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }}
images: ${{ github.ref_name == 'dev' && 'split.azurecr.io/backend-dev:latest' || 'split.azurecr.io/backend:latest' }}

build_frontend:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'dev' && 'dev' || 'prod' }}

steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: split.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build ./frontend -f ./frontend/docker/prod/Dockerfile --build-arg NEXT_PUBLIC_BACKEND_URL=${{secrets.NEXT_PUBLIC_BACKEND_URL}} --build-arg NEXT_PUBLIC_NEXTAUTH_URL=${{secrets.NEXT_PUBLIC_NEXTAUTH_URL}} --build-arg NEXT_PUBLIC_EXPIRATION_TIME=${{secrets.NEXT_PUBLIC_EXPIRATION_TIME}} --build-arg NEXT_PUBLIC_ENABLE_AZURE=${{secrets.NEXT_PUBLIC_ENABLE_AZURE}} -t split.azurecr.io/frontend${{ github.ref_name == 'dev' && '-dev' || '' }}:latest
docker push split.azurecr.io/frontend${{ github.ref_name == 'dev' && '-dev' || '' }}:latest
- uses: azure/webapps-deploy@v2
with:
app-name: ${{ github.ref_name == 'dev' && 'split-fe-dev' || 'split-fe' }}
publish-profile: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }}
images: ${{ github.ref_name == 'dev' && 'split.azurecr.io/frontend-dev:latest' || 'split.azurecr.io/frontend:latest' }}
28 changes: 0 additions & 28 deletions .github/workflows/deploy_frontend-dev.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/deploy_frontend.yml

This file was deleted.

19 changes: 5 additions & 14 deletions .github/workflows/tests_backend_frontend.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
# This is a basic workflow to help you get started with Actions
name: Test

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
branches:
- main
- dev

workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build_test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: "npm"
- name: Cache multiple paths
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BACKEND_PORT=3200

# NODE ENV
NODE_ENV=dev
NODE_ENV=local

# -> Daatabase <- #
# db user
Expand Down
35 changes: 0 additions & 35 deletions backend/docker/dev/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "NODE_ENV=dev nest start --watch",
"start:dev": "NODE_ENV=local nest start --watch",
"start:staging": "NODE_ENV=staging nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "NODE_ENV=prod nest start --watch",
Expand Down
6 changes: 3 additions & 3 deletions backend/src/infrastructure/config/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ const NODE_ENV = process.env.NODE_ENV;
envFilePath: !NODE_ENV || NODE_ENV === 'dev' ? '.env' : `.env.${NODE_ENV}`,
load: [configuration],
validationSchema: Joi.object({
NODE_ENV: Joi.string().valid('dev', 'prod', 'test', 'staging').default('dev'),
NODE_ENV: Joi.string().valid('dev', 'prod', 'test', 'staging', 'local').default('local'),
DB_HOST: Joi.string().required(),
DB_USER: Joi.string().required(),
DB_PASSWORD: Joi.string().required(),
DB_NAME: Joi.string().required(),
DB_PORT: Joi.any().when('NODE_ENV', {
is: 'dev',
is: 'local',
then: Joi.required(),
otherwise: Joi.optional()
}),
DB_REPLICA_SET: Joi.any().when('NODE_ENV', {
is: 'dev',
is: 'local',
then: Joi.required(),
otherwise: Joi.optional()
}),
Expand Down
2 changes: 1 addition & 1 deletion backend/src/infrastructure/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const configuration = (): Configuration => {
},
database: {
uri:
NODE_ENV === 'dev'
NODE_ENV === 'local'
? `mongodb://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}?authSource=admin&replicaSet=${process.env.DB_REPLICA_SET}&readPreference=primary&directConnection=true`
: `mongodb://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@${process.env.DB_USER}@`
},
Expand Down
File renamed without changes.
60 changes: 0 additions & 60 deletions frontend/docker/dev/Dockerfile

This file was deleted.

0 comments on commit b7aa1c5

Please sign in to comment.