Skip to content

Commit

Permalink
feat: frontend stability refactor (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigyu authored Nov 20, 2024
1 parent c60b755 commit 4e5583a
Show file tree
Hide file tree
Showing 174 changed files with 9,581 additions and 9,699 deletions.
324 changes: 162 additions & 162 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,180 +1,180 @@
name: SonarCloud analysis

on:
pull_request:
push:
branches:
- main
pull_request:
push:
branches:
- main

jobs:
ci-auth:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Deep fetch is required for SonarCloud
fetch-depth: 0
ci-auth:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Deep fetch is required for SonarCloud
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.12
- uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Tests and coverage
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: ${{ vars.LOCAL_POSTGRES_PORT }}
POSTGRES_PORT_TESTCONTAINER: ${{ vars.LOCAL_POSTGRES_PORT_TESTCONTAINER }}
FC_API_TOKEN_TEST: ${{ secrets.FOREST_CLIENT_API_API_KEY_TEST }}
run: |
cd server/auth_function
pip install -r requirements.txt -r requirements-dev.txt
pip install pytest-cov
pytest --cov=. --cov-branch --cov-report=xml \
-v --md=report.md --emoji
- name: Tests and coverage
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: ${{ vars.LOCAL_POSTGRES_PORT }}
POSTGRES_PORT_TESTCONTAINER: ${{ vars.LOCAL_POSTGRES_PORT_TESTCONTAINER }}
FC_API_TOKEN_TEST: ${{ secrets.FOREST_CLIENT_API_API_KEY_TEST }}
run: |
cd server/auth_function
pip install -r requirements.txt -r requirements-dev.txt
pip install pytest-cov
pytest --cov=. --cov-branch --cov-report=xml \
-v --md=report.md --emoji
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_AUTH }}
with:
projectBaseDir: server/auth_function
args: >
-Dsonar.exclusions=**/test/**/*,config.py
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-forests-access-management_auth
-Dsonar.python.coverage.reportPaths=*coverage*.xml
-Dsonar.python.version=3.12
-Dsonar.sources=.
-Dsonar.tests=test
- name: SonarCloud Scan
uses: SonarSource/[email protected]
ci-backend:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_AUTH }}
with:
projectBaseDir: server/auth_function
args: >
-Dsonar.exclusions=**/test/**/*,config.py
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-forests-access-management_auth
-Dsonar.python.coverage.reportPaths=*coverage*.xml
-Dsonar.python.version=3.12
-Dsonar.sources=.
-Dsonar.tests=test
environment: dev
organization: bcgov
USE_POSTGRES: false
steps:
- uses: actions/checkout@v4
with:
# Deep fetch is required for SonarCloud
fetch-depth: 0

ci-backend:
runs-on: ubuntu-latest
env:
environment: dev
organization: bcgov
USE_POSTGRES: false
steps:
- uses: actions/checkout@v4
with:
# Deep fetch is required for SonarCloud
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.12

- uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Tests and coverage
env:
FC_API_TOKEN_TEST: ${{ secrets.FOREST_CLIENT_API_API_KEY_TEST }}
IDIM_PROXY_API_KEY: ${{ secrets.IDIM_PROXY_API_API_KEY }}
GC_NOTIFY_EMAIL_API_KEY: "${{ secrets.GC_NOTIFY_EMAIL_API_KEY }}"
TEST_IDIR_USER_GUID: "${{ secrets.TEST_IDIR_USER_GUID }}"
POSTGRES_USER: ${{ vars.LOCAL_BACKEND_POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ vars.LOCAL_POSTGRES_PASSWORD }}
POSTGRES_HOST: ${{ vars.LOCAL_POSTGRES_HOST }}
POSTGRES_DB: ${{ vars.LOCAL_POSTGRES_DB }}
POSTGRES_PORT: ${{ vars.LOCAL_POSTGRES_PORT }}
POSTGRES_PORT_TESTCONTAINER: ${{ vars.LOCAL_POSTGRES_PORT_TESTCONTAINER }}
COGNITO_REGION: ${{ vars.LOCAL_COGNITO_REGION }}
COGNITO_USER_POOL_ID: ${{ vars.LOCAL_COGNITO_USER_POOL_ID }}
COGNITO_CLIENT_ID: ${{ vars.LOCAL_COGNITO_CLIENT_ID }}
COGNITO_USER_POOL_DOMAIN: ${{ vars.LOCAL_COGNITO_USER_POOL_DOMAIN }}
ENABLE_BCSC_JWKS_ENDPOINT: ${{ vars.LOCAL_ENABLE_BCSC_JWKS_ENDPOINT }}
run: |
cd server/backend
pip install -r requirements.txt -r requirements-dev.txt
pip install pytest-cov
pytest --cov=. --cov-branch --cov-report=xml \
-v --md=report.md --emoji
- name: Tests and coverage
env:
FC_API_TOKEN_TEST: ${{ secrets.FOREST_CLIENT_API_API_KEY_TEST }}
IDIM_PROXY_API_KEY: ${{ secrets.IDIM_PROXY_API_API_KEY }}
GC_NOTIFY_EMAIL_API_KEY: "${{ secrets.GC_NOTIFY_EMAIL_API_KEY }}"
TEST_IDIR_USER_GUID: "${{ secrets.TEST_IDIR_USER_GUID }}"
POSTGRES_USER: ${{ vars.LOCAL_BACKEND_POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ vars.LOCAL_POSTGRES_PASSWORD }}
POSTGRES_HOST: ${{ vars.LOCAL_POSTGRES_HOST }}
POSTGRES_DB: ${{ vars.LOCAL_POSTGRES_DB }}
POSTGRES_PORT: ${{ vars.LOCAL_POSTGRES_PORT }}
POSTGRES_PORT_TESTCONTAINER: ${{ vars.LOCAL_POSTGRES_PORT_TESTCONTAINER }}
COGNITO_REGION: ${{ vars.LOCAL_COGNITO_REGION }}
COGNITO_USER_POOL_ID: ${{ vars.LOCAL_COGNITO_USER_POOL_ID }}
COGNITO_CLIENT_ID: ${{ vars.LOCAL_COGNITO_CLIENT_ID }}
COGNITO_USER_POOL_DOMAIN: ${{ vars.LOCAL_COGNITO_USER_POOL_DOMAIN }}
ENABLE_BCSC_JWKS_ENDPOINT: ${{ vars.LOCAL_ENABLE_BCSC_JWKS_ENDPOINT }}
run: |
cd server/backend
pip install -r requirements.txt -r requirements-dev.txt
pip install pytest-cov
pytest --cov=. --cov-branch --cov-report=xml \
-v --md=report.md --emoji
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
with:
projectBaseDir: server/backend
args: >
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-forests-access-management_backend
-Dsonar.python.coverage.reportPaths=*coverage*.xml
-Dsonar.python.version=3.12
-Dsonar.sources=api
-Dsonar.tests=testspg
- name: SonarCloud Scan
uses: SonarSource/[email protected]
ci-admin-management:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
with:
projectBaseDir: server/backend
args: >
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-forests-access-management_backend
-Dsonar.python.coverage.reportPaths=*coverage*.xml
-Dsonar.python.version=3.12
-Dsonar.sources=api
-Dsonar.tests=testspg
environment: dev
organization: bcgov
steps:
- uses: actions/checkout@v4
with:
# Deep fetch is required for SonarCloud
fetch-depth: 0

ci-admin-management:
runs-on: ubuntu-latest
env:
environment: dev
organization: bcgov
steps:
- uses: actions/checkout@v4
with:
# Deep fetch is required for SonarCloud
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.12

- uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Tests and coverage
env:
FC_API_TOKEN_TEST: ${{ secrets.FOREST_CLIENT_API_API_KEY_TEST }}
IDIM_PROXY_API_KEY: ${{ secrets.IDIM_PROXY_API_API_KEY }}
GC_NOTIFY_EMAIL_API_KEY: "${{ secrets.GC_NOTIFY_EMAIL_API_KEY }}"
POSTGRES_USER: ${{ vars.LOCAL_ADMAN_POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ vars.LOCAL_POSTGRES_PASSWORD }}
POSTGRES_HOST: ${{ vars.LOCAL_POSTGRES_HOST }}
POSTGRES_DB: ${{ vars.LOCAL_POSTGRES_DB }}
POSTGRES_PORT: ${{ vars.LOCAL_POSTGRES_PORT }}
POSTGRES_PORT_TESTCONTAINER: ${{ vars.LOCAL_POSTGRES_PORT_TESTCONTAINER }}
COGNITO_REGION: ${{ vars.LOCAL_COGNITO_REGION }}
COGNITO_USER_POOL_ID: ${{ vars.LOCAL_COGNITO_USER_POOL_ID }}
COGNITO_CLIENT_ID: ${{ vars.LOCAL_COGNITO_CLIENT_ID }}
COGNITO_USER_POOL_DOMAIN: ${{ vars.LOCAL_COGNITO_USER_POOL_DOMAIN }}
run: |
cd server/admin_management
pip install -r requirements.txt -r requirements-dev.txt
pip install pytest-cov
pytest --cov=. --cov-branch --cov-report=xml \
-v --md=report.md --emoji
- name: Tests and coverage
env:
FC_API_TOKEN_TEST: ${{ secrets.FOREST_CLIENT_API_API_KEY_TEST }}
IDIM_PROXY_API_KEY: ${{ secrets.IDIM_PROXY_API_API_KEY }}
GC_NOTIFY_EMAIL_API_KEY: "${{ secrets.GC_NOTIFY_EMAIL_API_KEY }}"
POSTGRES_USER: ${{ vars.LOCAL_ADMAN_POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ vars.LOCAL_POSTGRES_PASSWORD }}
POSTGRES_HOST: ${{ vars.LOCAL_POSTGRES_HOST }}
POSTGRES_DB: ${{ vars.LOCAL_POSTGRES_DB }}
POSTGRES_PORT: ${{ vars.LOCAL_POSTGRES_PORT }}
POSTGRES_PORT_TESTCONTAINER: ${{ vars.LOCAL_POSTGRES_PORT_TESTCONTAINER }}
COGNITO_REGION: ${{ vars.LOCAL_COGNITO_REGION }}
COGNITO_USER_POOL_ID: ${{ vars.LOCAL_COGNITO_USER_POOL_ID }}
COGNITO_CLIENT_ID: ${{ vars.LOCAL_COGNITO_CLIENT_ID }}
COGNITO_USER_POOL_DOMAIN: ${{ vars.LOCAL_COGNITO_USER_POOL_DOMAIN }}
run: |
cd server/admin_management
pip install -r requirements.txt -r requirements-dev.txt
pip install pytest-cov
pytest --cov=. --cov-branch --cov-report=xml \
-v --md=report.md --emoji
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_ADMIN }}
with:
projectBaseDir: server/admin_management
args: >
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-forests-access-management_admin
-Dsonar.python.coverage.reportPaths=*coverage*.xml
-Dsonar.python.version=3.12
-Dsonar.sources=api
-Dsonar.tests=tests
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_ADMIN }}
with:
projectBaseDir: server/admin_management
args: >
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=nr-forests-access-management_admin
-Dsonar.python.coverage.reportPaths=*coverage*.xml
-Dsonar.python.version=3.12
-Dsonar.sources=api
-Dsonar.tests=tests
ci-frontend:
runs-on: ubuntu-latest
steps:
- uses: bcgov-nr/[email protected]
with:
commands: |
npm run install-frontend
npm run build
npm run test-coverage
dir: frontend
node_version: "18"
sonar_args: >
-Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.project.monorepo.enabled=true
-Dsonar.projectKey=nr-forests-access-management_frontend
-Dsonar.sources=src
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar_token: ${{ secrets.SONAR_TOKEN_FRONTEND }}
triggers: ("frontend" "terraform-frontend/")
ci-frontend:
runs-on: ubuntu-latest
steps:
- uses: bcgov-nr/[email protected]
with:
commands: |
npm run install-frontend
npm run build
npm run test-coverage
dir: frontend
node_version: "18"
sonar_args: >
-Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.project.monorepo.enabled=true
-Dsonar.projectKey=nr-forests-access-management_frontend
-Dsonar.sources=src
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar_token: ${{ secrets.SONAR_TOKEN_FRONTEND }}
triggers: ("frontend" "terraform-frontend/")
20 changes: 13 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"editor.rulers": [
80,
120
],
"editor.rulers": [80, 120],
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.detectIndentation": true,
Expand All @@ -13,13 +10,22 @@
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.flake8Args": ["--append-config=${workspaceFolder}/server/backend/.flake8"],
"python.linting.flake8Args": [
"--append-config=${workspaceFolder}/server/backend/.flake8"
],
"python.testing.cwd": "./server/backend",

"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"],
"python.languageServer": "Pylance",
"files.trimTrailingWhitespace": true,
"files.eol": "\n",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.tabWidth": 4,
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}


Loading

0 comments on commit 4e5583a

Please sign in to comment.