Skip to content

Commit

Permalink
Merge pull request #1 from Kleostro/chore/tu-01-01/update-ci-processes
Browse files Browse the repository at this point in the history
chore(tu-01-01): update ci processes
  • Loading branch information
stardustmeg authored Aug 13, 2024
2 parents 02bb6d6 + a867f2b commit 8ab00d6
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 18 deletions.
47 changes: 47 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
documentation:
- changed-files:
- any-glob-to-any-file: '**/*.md'

chore:
- any:
- changed-files:
- any-glob-to-all-files: '*'
- head-branch:
- '^chore'

feature:
- head-branch:
- '^feat'

fix:
- head-branch:
- '^fix'
- '^hotfix'

refactor:
- head-branch:
- '^refactor'

test:
- any:
- head-branch:
- '^test'
- changed-files:
- any-glob-to-any-file: '**/*.spec.ts'

revert:
- head-branch:
- '^revert'

styles:
- changed-files:
- any-glob-to-any-file: '**/*.scss'

sprint1:
- head-branch: 'tu-01'

sprint2:
- head-branch: 'tu-02'

sprint3:
- head-branch: 'tu-03'
54 changes: 54 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## PR Title ✨

📍 conforms with the following format:

- [ ] prefix (following the [convention](https://www.conventionalcommits.org/en/v1.0.0-beta.2/): `feat`, `fix`, `hotfix`, `chore`, `refactor`, `revert`, `docs`, `style`, `test`)
- [ ] sprint and issue number (e.g. `tu-01-02`, where `01` - is the sprint number and `02` - is the issue number)
- [ ] short description

👀 Example: `feat(tu-01-02): description`

## PR Description 🧙‍♂️

_Add a comprehensive description of the changes in the PR_ 🤔

#### Affected Scope 💡

Provide affected modules or areas

#### Styles 🎨

Provide any style changes details

#### Testing Strategy 🧼

Describe the testing strategy for the changes

#### Screenshots/Demo 📸

If necessary provide screenshots or a demo link to visually demonstrate the changes

#### Documentation Updates 📖

Specify if any documentation updates are required and provide details on what needs to be updated

#### Provide any other relevant information 🦉

## Auto-Review 🤖

- [x] The reviewers have been requested 📝
[![Request Review on PR Open](https://github.com/kleostro/tu-tu/actions/workflows/request_review.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/request_review.yml)
- [x] The labels have been added 🎨
[![Pull Request Labeler](https://github.com/kleostro/tu-tu/actions/workflows/labeler.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/labeler.yml)
- [x] My code doesn't generate any errors or warnings ⛓️
[![Continuous Integration](https://github.com/kleostro/tu-tu/actions/workflows/ci.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/ci.yml)
- [x] My code builds successfully ⚙️
[![Netlify Status](https://api.netlify.com/api/v1/badges/9704b9db-b410-40b1-8d2b-2eeed828626e/deploy-status)](https://app.netlify.com/sites/mad-wizards-tu-tu/deploys)

## Self-Check 🌟

- [ ] I wrote the correct title for the PR 🗝️
- [ ] I wrote a comprehensive description for the PR 📜
- [ ] I have performed a self-review of my own code ✅
- [ ] I have commented my code where needed 📝
- [ ] I am happy with my PR and ready to merge ❤️‍🔥
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Continuous Integration

on:
pull_request:
branches:
- develop
- sprint-1
- sprint-2
- sprint-3

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Format code with Prettier
run: npm run ci:format

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Run Karma tests
run: npm test
18 changes: 18 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Pull Request Labeler'
on:
pull_request_target:

jobs:
labeler:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Label Pull Request
uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/request_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Request Review on PR Open

on:
pull_request:
types: [opened]

jobs:
automate-review:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Get PR Author
id: pr_author
run: echo "::set-output name=author::${{ github.event.pull_request.user.login }}"

- name: Request Review
if: steps.pr_author.outputs.author == 'stardustmeg'
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers
mediaType: '{"previews":["luke-cage"]}'
token: ${{ secrets.GITHUB_TOKEN }}
reviewers: '["Kleostro", "ki8vi", "katyastan"]'

- name: Request Review
if: steps.pr_author.outputs.author == 'Kleostro'
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers
mediaType: '{"previews":["luke-cage"]}'
token: ${{ secrets.GITHUB_TOKEN }}
reviewers: '["stardustmeg", "ki8vi", "katyastan"]'

- name: Request Review
if: steps.pr_author.outputs.author == 'ki8vi'
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers
mediaType: '{"previews":["luke-cage"]}'
token: ${{ secrets.GITHUB_TOKEN }}
reviewers: '["stardustmeg", "Kleostro", "katyastan"]'

- name: Request Review
if: steps.pr_author.outputs.author == 'katyastan'
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers
mediaType: '{"previews":["luke-cage"]}'
token: ${{ secrets.GITHUB_TOKEN }}
reviewers: '["stardustmeg", "Kleostro", "ki8vi"]'
33 changes: 32 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
npx lint-staged
#!/bin/bash

BASIC_RED="\e[0;31m"
BASIC_GREEN="\e[0;32m"
BASIC_BLUE="\e[0;34m"
BASIC_CYAN="\e[0;36m"
ENDCOLOR="\e[0m"

run_linter () {
echo -e "${BASIC_CYAN}Checking for linting errors in the src directory${ENDCOLOR}"
npx lint-staged
if [[ $? -ne 0 ]]
then
echo -e "${BASIC_RED}Linting failed. Please fix the errors and try again.${ENDCOLOR}"
exit 1
fi
}

run_tsc () {
echo -e "${BASIC_BLUE}Checking for TypeScript errors${ENDCOLOR}"
npx tsc
if [[ $? -ne 0 ]]
then
echo -e "${BASIC_RED}TypeScript compilation failed. Please fix the errors and try again.${ENDCOLOR}"
exit 1
fi
}

run_linter
run_tsc

printf "${BASIC_GREEN} ✔ All checks passed. Happy coding${ENDCOLOR}!\n"
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx validate-branch-name
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*": ["prettier --write --ignore-unknown"],
"*.{cjs,js,mjs,jsx,ts,tsx}": ["eslint --max-warnings 0"],
"*.{js,mjs,jsx,ts,tsx}": ["eslint --max-warnings 0"],
"*.scss": "npx stylelint --fix"
}
9 changes: 9 additions & 0 deletions .validate-branch-namerc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
pattern: /^(feat|fix|hotfix|chore|refactor|revert|docs|style|test|)\/tu-0[1-3]-\d{2}\/[a-zA-Z0-9-]+$/,
errorMsg: 'Please use correct branch name',
};

// Branch Name Examples:

// "feat/tu-01-01/add-login-form" // where 01 is the sprint number and 01 is the issue number
// "fix/tu-02-03/fix-router" // where 02 is the sprint number and 03 is the issue number
34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,26 @@
"@angular/ssr": "^18.0.6",
"@ngrx/effects": "^18.0.1",
"@ngrx/router-store": "^18.0.1",
"@ngrx/store": "^18.0.1",
"@ngrx/store": "^18.0.2",
"@ngrx/store-devtools": "^18.0.1",
"eslint-plugin-unused-imports": "^4.1.3",
"express": "^4.18.2",
"modern-normalize": "^3.0.0",
"primeng": "^17.18.8",
"rxjs": "~7.8.0",
"rxjs": "^7.8.1",
"tslib": "^2.3.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.0.6",
"@angular-eslint/eslint-plugin": "^18.0.1",
"@angular-eslint/eslint-plugin-template": "^18.0.1",
"@angular-eslint/schematics": "^18.0.1",
"@angular-eslint/template-parser": "^18.0.1",
"@angular/cli": "^18.0.6",
"@angular/compiler-cli": "^18.0.0",
"@commitlint/cli": "^19.3.0",
"@angular-devkit/build-angular": "^18.1.4",
"@angular-eslint/eslint-plugin": "^18.3.0",
"@angular-eslint/eslint-plugin-template": "^18.3.0",
"@angular-eslint/schematics": "^18.3.0",
"@angular-eslint/template-parser": "^18.3.0",
"@angular/cli": "^18.1.4",
"@angular/compiler-cli": "^18.1.4",
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@ngrx/eslint-plugin": "^18.0.1",
"@ngrx/eslint-plugin": "^18.0.2",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/express": "^4.17.17",
"@types/inquirer": "^9.0.7",
Expand All @@ -62,22 +63,23 @@
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"husky": "^9.0.11",
"husky": "^9.1.4",
"inquirer": "^8.2.6",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"lint-staged": "^15.2.7",
"lint-staged": "^15.2.9",
"normalize-scss": "^8.0.0",
"prettier": "^3.3.2",
"stylelint": "^16.6.1",
"prettier": "^3.3.3",
"stylelint": "^16.8.1",
"stylelint-config-clean-order": "^6.0.0",
"stylelint-config-standard": "^36.0.1",
"stylelint-config-standard-scss": "^13.1.0",
"stylelint-order": "^6.0.4",
"typescript": "~5.4.2"
"typescript": "^5.5.4",
"validate-branch-name": "^1.3.1"
}
}

0 comments on commit 8ab00d6

Please sign in to comment.