diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index aa8d3d5a..385355eb 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -1,14 +1,18 @@ +# This GitHub Actions workflow ensures that any pull request targeting the main or main-* +# branches meets certain criteria before it is merged. The workflow sets up the necessary infrastructure, +# configures the environment, and performs checks on the pull request title, body, labels +# and assignee to ensure that it adheres to predefined standards. If any of these checks fail, +# the workflow will exit with an error, preventing the pull request from proceeding. + name: GitHub -run-name: 🔬Pull request inspection on ${{ github.event.number }} +run-name: 🔬 Pull request inspection on ${{ github.event.number }} on: pull_request: - branches: - - main - - "release-*" + branches: [main, main-*] env: - environment: dev + environment: "qa" timezone: ${{ vars.TIMEZONE }} jobs: @@ -29,6 +33,7 @@ jobs: # 2. Pull request pullrequest: name: Pull request ⬇️ + needs: setup environment: name: ${{ needs.setup.outputs.environment }} runs-on: ubuntu-latest @@ -42,7 +47,7 @@ jobs: uses: actions/checkout@v4 - name: Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ vars.NODE_VERSION }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2c0bbb20..fdf486b0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,19 +1,62 @@ -# MDM-API Git Hub Actions -##################################### -# This GHA is responsible for initiating linting checks +# Workflow Name: Lint +# Trigger: Pull requests to the main branch that modify specific files (listed in paths). +# +# Environment: +# environment: set to dev +# timezone: retrieved from vars.TIMEZONE +# +# Setup Test Infrastructure: +# Name: Infrastructure setup +# Runs on: ubuntu-latest +# Outputs environment and timezone variables for use in subsequent jobs. +# Steps: +# Echoes the environment and timezone for verification. +# +# Lint: +# Name: Scanning +# Depends on: setup +# Runs on: ubuntu-latest +# Steps: +# Sets the timezone using the specified value. +# Checks out the repository code. +# Sets up the specified Node.js version. +# Installs dependencies using npm run ci:all. +# Runs linting using the command npm run lint:all. +# +# Key Points: +# The workflow focuses on linting, which checks code for potential errors, style issues, and adherence to best practices. +# It uses a sequential structure, with the linting job depending on the setup job. +# Environment variables are shared between jobs for consistency. +# The workflow leverages actions from the GitHub Marketplace for setting the timezone and installing Node.js. +# -name: Quality Assurance - Lint -run-name: Executing lint QA on ${{ github.repository }} 🚀 +name: Lint +run-name: 🎨 Lint checking on ${{ github.event.number }} on: pull_request: - branches: [main] + branches: + - main + - "release-*" + paths: - - "src/**" - - "test/**" + - "package*.json" + - "docker*.yml" + - ".github/workflows/**" + - "gef-ui/**" + - "portal/**" + - "portal-api/**" + - "trade-finance-manager-ui/**" + - "trade-finance-manager-api/**" + - "external-api/**" + - "dtfs-central-api/**" + - "azure-functions/**" + - "e2e-tests/**" + - "utils/mock-data-loader/**" + - "libs/**" env: - environment: "qa" + environment: dev timezone: ${{ vars.TIMEZONE }} jobs: @@ -39,7 +82,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Timezone - uses: szenius/set-timezone@v2.0 + uses: szenius/set-timezone@v1.2 with: timezoneLinux: ${{ needs.setup.outputs.timezone }} @@ -47,7 +90,7 @@ jobs: uses: actions/checkout@v4 - name: Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v3 with: node-version: ${{ vars.NODE_VERSION }} @@ -57,8 +100,33 @@ jobs: - name: Linting working-directory: ./ - run: npm run lint + run: + npm run lint:all - - name: Prettier + # 3. Lint + prettier: + name: Prettier 🎨 + environment: + name: ${{ needs.setup.outputs.environment }} + runs-on: ubuntu-latest + steps: + - name: Timezone + uses: szenius/set-timezone@v1.2 + with: + timezoneLinux: ${{ needs.setup.outputs.timezone }} + + - name: Repository + uses: actions/checkout@v4 + + - name: Node + uses: actions/setup-node@v3 + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Dependencies + working-directory: ./ + run: npm ci --legacy-peer-deps + + - name: Linting working-directory: ./ run: npm run prettier diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 736a326a..9e139a6a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -7,7 +7,7 @@ # name: PR -run-name: 🔎 pull request analysis on ${{ github.event.number }} +run-name: 🔎 Pull request analysis on ${{ github.event.number }} on: schedule: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e0ee7bb1..b51f1247 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,11 @@ # MDM Git Hub Actions ##################################### # This GHA is responsible for creating automated -# GitHub release based PR. Once the PR is merged -# Google release please will update the `CHANGELOG.md` -# `README.md` and `package.json` files. -# Followed by tagging the commit with the appropriate version -# number (as per SemVer) and create a GitHub release on the tag. +# GitHub release based PRs. Once the PR is merged, +# Google Release Please will update the `CHANGELOG.md`, +# `README.md` and `package.json` files, followed by +# tagging the commit with the appropriate version +# number (as per SemVer) and creating a GitHub tag for the release. name: Automated release run-name: Executing release on ${{ github.repository }} 🚀 @@ -45,9 +45,9 @@ jobs: - name: Repository uses: actions/checkout@v4 - - name: Dependency + - name: Dependencies working-directory: ./ - run: npm i -g release-please + run: npm ci - name: Create working-directory: ./ diff --git a/.prettierignore b/.prettierignore index 543553d4..14e22a95 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,19 @@ +# Root +node_modules/ dist/ -.cache/ +build/ +public/ +generated_reports/ +coverage/ +package*.json +.cache + +# Sub-directories +**/node_modules/ +**/dist/ +**/build/ +**/public/ +**/**/**/generated_reports/ **/coverage/ -**/node_modules/** -/node_modules -/package-lock.json \ No newline at end of file +**/package*.json +**/.cache diff --git a/package-lock.json b/package-lock.json index 1b7dddad..e3aa2187 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "express-basic-auth": "^1.2.1", "lodash": "^4.17.21", "mssql": "^10.0.2", - "nestjs-pino": "^4.0.0", + "nestjs-pino": "^4.1.0", "passport": "^0.7.0", "passport-headerapikey": "^1.2.2", "pino-http": "^9.0.0", @@ -52,7 +52,7 @@ "@types/compression": "^1.7.5", "@types/express": "^4.17.21", "@types/jest": "^29.5.12", - "@types/lodash": "^4.17.1", + "@types/lodash": "^4.17.4", "@types/node": "^20.12.12", "@types/supertest": "^6.0.2", "@typescript-eslint/eslint-plugin": "^7.9.0", @@ -1709,9 +1709,9 @@ "dev": true }, "node_modules/@cspell/dict-golang": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/@cspell/dict-golang/-/dict-golang-6.0.5.tgz", - "integrity": "sha512-w4mEqGz4/wV+BBljLxduFNkMrd3rstBNDXmoX5kD4UTzIb4Sy0QybWCtg2iVT+R0KWiRRA56QKOvBsgXiddksA==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/@cspell/dict-golang/-/dict-golang-6.0.6.tgz", + "integrity": "sha512-NHgTtd8l8h4EEnBVb/WXlIh/b5CfX3xkaqCXUjOHBx9ToIFk7NdPnXbevwsBHIxy2QDdr7mi0f9RWtGyW4xYWg==", "dev": true }, "node_modules/@cspell/dict-haskell": { @@ -1745,9 +1745,9 @@ "dev": true }, "node_modules/@cspell/dict-k8s": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@cspell/dict-k8s/-/dict-k8s-1.0.2.tgz", - "integrity": "sha512-tLT7gZpNPnGa+IIFvK9SP1LrSpPpJ94a/DulzAPOb1Q2UBFwdpFd82UWhio0RNShduvKG/WiMZf/wGl98pn+VQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@cspell/dict-k8s/-/dict-k8s-1.0.3.tgz", + "integrity": "sha512-dR58QCcsOYeOoPT+d3kUPrEQ9FQ62cohLHqPu4kiWvsrLszEUMopjGu3p5tVnq496M+RY5PLlbLLaW9ixHmFOQ==", "dev": true }, "node_modules/@cspell/dict-latex": { @@ -3412,9 +3412,9 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.1.tgz", - "integrity": "sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q==", + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha512-wYCP26ZLxaT3R39kiN2+HcJ4kTd3U1waI/cY7ivWYqFP6pW3ZNpvi6Wd6PHZx7T/t8z0vlkXMg3QYLa7DZ/IJQ==", "dev": true }, "node_modules/@types/methods": { @@ -6181,9 +6181,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.772", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.772.tgz", - "integrity": "sha512-jFfEbxR/abTTJA3ci+2ok1NTuOBBtB4jH+UT6PUmRN+DY3WSD4FFRsgoVQ+QNIJ0T7wrXwzsWCI2WKC46b++2A==", + "version": "1.4.773", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.773.tgz", + "integrity": "sha512-87eHF+h3PlCRwbxVEAw9KtK3v7lWfc/sUDr0W76955AdYTG4bV/k0zrl585Qnj/skRMH2qOSiE+kqMeOQ+LOpw==", "dev": true }, "node_modules/emittery": { @@ -11889,16 +11889,16 @@ "dev": true }, "node_modules/nestjs-pino": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/nestjs-pino/-/nestjs-pino-4.0.0.tgz", - "integrity": "sha512-XhCg/R+l3w0BFP6MHyR6lU/BHVEV0tV9z24G0vuA9FD3sv+TQNvnO9uVsF1l/oVspgGfQ9Qulmb2UbsfYlI0+g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/nestjs-pino/-/nestjs-pino-4.1.0.tgz", + "integrity": "sha512-I6zcddauD2TNMRbsraEIxNUvHcz0El5QRUYH5eY1+pBzj7R17U+Yoyypoc+akVdSLWJ1r0kDYAZPy2mlhXv6vw==", "hasInstallScript": true, "engines": { "node": ">= 14" }, "peerDependencies": { "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0", - "pino-http": "^6.4.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" + "pino-http": "^6.4.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0" } }, "node_modules/no-case": { diff --git a/package.json b/package.json index 4741d5c2..5ef3965f 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "express-basic-auth": "^1.2.1", "lodash": "^4.17.21", "mssql": "^10.0.2", - "nestjs-pino": "^4.0.0", + "nestjs-pino": "^4.1.0", "passport": "^0.7.0", "passport-headerapikey": "^1.2.2", "pino-http": "^9.0.0", @@ -73,7 +73,7 @@ "@types/compression": "^1.7.5", "@types/express": "^4.17.21", "@types/jest": "^29.5.12", - "@types/lodash": "^4.17.1", + "@types/lodash": "^4.17.4", "@types/node": "^20.12.12", "@types/supertest": "^6.0.2", "@typescript-eslint/eslint-plugin": "^7.9.0",