Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Better structure #115

Merged
merged 7 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
# More information at https://editorconfig.org

root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,ts,jsx,tsx,html,css,scss,json,yml,yaml,md}]
charset = utf-8

# 4 space indentation for TypeScript files
[*.ts]
indent_size = 4

# 2 space indentation for YAML files
[*.{yml,yaml}]
indent_size = 2
# 2 space indentation for JSON files
[*.json]
indent_size = 2

# 2 space indentation for Markdown files
[*.md]
indent_size = 2

# 2 space indentation for HTML files
[*.html]
indent_size = 2

# 2 space indentation for CSS and SCSS files
[*.{css,scss}]
indent_size = 2
9 changes: 6 additions & 3 deletions .env.exemple → .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Docker image tag
TAG=local

GATEWAY_PORT=8012

JWT_SECRET_KEY=defaultvalue

# The service name in docker-compose
DATABASE_HOST_PROD=db
DATABASE_HOST_DEV=db

DATABASE_HOST=db
DATABASE_PORT=5432
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=password
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/build-and-push-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Compile and push dev images

on:
push:
branches: ["develop"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/reusable-workflow.yml
with:
environment: "dev"
14 changes: 14 additions & 0 deletions .github/workflows/build-and-push-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Compile and push prod images

on:
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/reusable-workflow.yml
with:
environment: "prod"
34 changes: 34 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .github/workflows/build-and-push.yml
name: Build and push

on:
workflow_call:
inputs:
environment:
required: true
type: string

jobs:
build-and-push-images:
strategy:
matrix:
service: [frontend, backend]
runs-on: ubuntu-latest
steps:
- name: Check inputs
if: ${{ inputs.environment != 'dev' && inputs.environment != 'prod' }}
run: echo "Wrong environment. Expected 'dev' or 'prod', got '${{ inputs.environment }}'" && exit 1

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

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push backend image
run: |
docker build -t healthcheck-${{ matrix.service }}:${{ inputs.environment }} ${{ matrix.service }}
docker push healthcheck-${{ matrix.service }}:${{ inputs.environment }}
14 changes: 0 additions & 14 deletions .github/workflows/healtcheck-backend-tests.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/healthcheck-tests.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests

on:
pull_request:
branches:
- main
- develop
types:
- opened
- synchronize
- reopened

jobs:
backend_integration:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend/tests/integration
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run backend, APIgateway and database services in a dedicated container
run: docker compose -f docker-compose.yml up -d
- name: Install dependencies
run: npm i
- name: Run backend tests
run: npm run test

fontend_unit:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
run: npm i
- name: Run frontend tests
run: npm run test

e2e:
runs-on: ubuntu-latest
defaults:
run:
working-directory: e2e
if: false # Disable e2e tests, deprecated at the moment
timeout-minutes: 2
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Run backend, frontend, APIgateway and database services in a dedicated container
run: docker compose -f docker-compose.yml up -d
- name: Run e2e tests
run: docker compose exec playwright npx playwright test
44 changes: 0 additions & 44 deletions .github/workflows/staging-backend.dev.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/staging-backend.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/staging-frontend.dev.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/staging-frontend.yml

This file was deleted.

Loading
Loading