Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tu-01-31): update continuous integration workflow #36

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ Specify if any documentation updates are required and provide details on what ne
[![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 doesn't generate any errors or warnings ⚠️
[![Code Formatter](https://github.com/kleostro/tu-tu/actions/workflows/format.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/format.yml)
- [x] My code passes all tests πŸ§ͺ
[![Test](https://github.com/kleostro/tu-tu/actions/workflows/test.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/test.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)

Expand Down
19 changes: 1 addition & 18 deletions .github/workflows/ci.yml β†’ .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Continuous Integration
name: Format

on:
pull_request:
Expand Down Expand Up @@ -26,20 +26,3 @@ jobs:

- 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 Jest tests
run: npm test
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test

on:
pull_request:
types: [opened]

jobs:
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 Jest tests
run: npm test

- name: Generate coverage report
run: npm run test:coverage
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ run_tsc () {
run_linter
run_tsc

printf "${BASIC_GREEN} βœ” All checks passed. Happy coding${ENDCOLOR}!\n"
printf "${BASIC_GREEN} βœ” All checks have passed. Happy coding!${ENDCOLOR}\n"
31 changes: 30 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
npx validate-branch-name
#!/bin/bash

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

run_branch_name_validation () {
echo -e "${BASIC_CYAN}Validating branch name${ENDCOLOR}"
npx validate-branch-name
if [[ $? -ne 0 ]]
then
exit 1
fi
}

run_tests () {
echo -e "${BASIC_CYAN}Running tests${ENDCOLOR}"
npm run test
if [[ $? -ne 0 ]]
then
echo -e "${BASIC_RED}Tests failed. Please fix the errors and try again.${ENDCOLOR}"
exit 1
fi
}

run_branch_name_validation
run_tests

printf "${BASIC_GREEN} βœ” All checks have passed. Happy coding!${ENDCOLOR}\n"
3 changes: 2 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { Config } from 'jest';

const config: Config = {
moduleDirectories: ['node_modules', '<rootDir>'],
transformIgnorePatterns: ['node_modules/(?!@angular|rxjs|@ngrx)'],
transformIgnorePatterns: ['node_modules/(?!@angular|rxjs|@ngrx)', '<rootDir>/dist'],
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
Expand All @@ -17,6 +17,7 @@ const config: Config = {
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
},
testPathIgnorePatterns: ['<rootDir>/dist/', 'dist'],
};

export default config;