Skip to content

Commit

Permalink
feat: refactor to nx
Browse files Browse the repository at this point in the history
  • Loading branch information
orig committed Sep 9, 2023
1 parent 27d1b77 commit 4b10748
Show file tree
Hide file tree
Showing 152 changed files with 18,936 additions and 36,400 deletions.
8 changes: 3 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# https://editorconfig.org
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
max_line_length = off
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules

vite.config.ts
9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
}
39 changes: 0 additions & 39 deletions .github/workflows/build.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI
on:
push:
branches:
- master
pull_request:

jobs:
main:
name: Continuous Integration (CI)
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'master'

- run: npm ci

- run: npx nx format:check
- run: npx nx affected -t lint --parallel=3
- run: npx nx affected -t test --parallel=3
- run: npx nx affected -t build --parallel=3
73 changes: 0 additions & 73 deletions .github/workflows/codeql.yml

This file was deleted.

95 changes: 19 additions & 76 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,33 @@ on:
branches:
- master
workflow_dispatch:
workflow_run:
workflows: [CI]
types:
- completed

env:
REGISTRY: ghcr.io
IMAGE_NAME_BACKEND: ${{ github.repository }}/backend
IMAGE_NAME_FRONTEND: ${{ github.repository }}/frontend
NX_AFFECTED: true
NX_AFFECTED_BASE: origin/master

jobs:
backend-deployment:
name: Build and publish backend image
affected-deployment:
name: Build and publish affected images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

permissions: 'write-all'
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the Container registry
uses: docker/login-action@v1
uses: actions/checkout@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Install npm dependencies
run: npm ci

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v1
- uses: nrwl/nx-set-shas@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}
main-branch-name: 'master'

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./apps/backend
file: ./apps/backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

frontend-deployment:
name: Build and publish frontend image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install dependencies
run: npm ci

- name: Log in to the Container registry
uses: docker/login-action@v1
Expand All @@ -81,23 +40,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./apps/frontend
file: ./apps/frontend/Dockerfile.prod
platforms: linux/amd64,linux/arm64
push: true
build-args: |
API_DOMAIN=${{ secrets.API_DOMAIN }}
DOMAIN=${{ secrets.DOMAIN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build & Push Affected Images to Registry
id: deploy-images-to-registry
run: |
npx nx affected -t "push-image-to-registry" --repository=${{ github.repository }} --github-sha="$GITHUB_SHA"
39 changes: 0 additions & 39 deletions .github/workflows/lint.yml

This file was deleted.

Loading

0 comments on commit 4b10748

Please sign in to comment.