Skip to content

Commit

Permalink
fix(github): fixed github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi-markan committed May 17, 2024
1 parent 89a6e5e commit dc17ea5
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 51 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/github.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -29,6 +33,7 @@ jobs:
# 2. Pull request
pullrequest:
name: Pull request ⬇️
needs: setup
environment:
name: ${{ needs.setup.outputs.environment }}
runs-on: ubuntu-latest
Expand All @@ -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 }}

Expand Down
94 changes: 81 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -39,15 +82,15 @@ 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 }}

- name: Repository
uses: actions/checkout@v4

- name: Node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: ${{ vars.NODE_VERSION }}

Expand All @@ -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/[email protected]
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
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }} 🚀
Expand Down Expand Up @@ -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: ./
Expand Down
21 changes: 17 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -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
**/package*.json
**/.cache
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit dc17ea5

Please sign in to comment.