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

Add GitHub Action for linting, testing, and building TypeScript project #128

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smog-root
Copy link

@smog-root smog-root commented Oct 21, 2024

Closes #126

CI_LINT.yaml :

Working PROOF :
It show's what are the errors in files ⬇

Screenshot (32)

This PR introduces a comprehensive Continuous Integration (CI) workflow using GitHub Actions to automate the following tasks for the TypeScript project:

  • Linting: Ensures that the code follows the defined style and best practices.
  • Testing: Runs the project’s test suite to validate code functionality.
  • Building: Compiles the TypeScript code to ensure there are no type errors and generates the final JavaScript output.

Details of Workflow:

Trigger Conditions:

The workflow will automatically trigger on:

  • Push events to the main branch.
  • Pull requests targeting the main branch.

Jobs:

Linting (ESLint):

  • Lints all TypeScript files (.ts and .tsx) in the project using ESLint.
  • This ensures that all code adheres to the project's coding standards and best practices.

Building (TypeScript Compiler):

  • Compiles the TypeScript code using the TypeScript compiler (tsc) to check for any type errors and ensure that the project builds successfully.
  • The compiled output is stored in the dist directory (as specified in tsconfig.json).

Testing (Jest):

  • Runs the test suite using Jest to validate that the code behaves as expected.
  • Ensures that no new changes break existing functionality.

Steps Performed in the Workflow:

  • Checkout the code from the repository using actions/checkout@v3.
  • Set up Node.js using actions/setup-node@v3 with the specified Node.js version (16.x).
  • Install dependencies via npm install.
  • Run ESLint to check for linting issues using npm run lint.
  • Compile TypeScript code using npm run build.
  • Run Jest tests using npm test.

pr-checker.yaml :

Usage:

  1. When a pull request is created or edited, the workflow automatically triggers.

  2. The workflow checks for:

  • A non-empty PR description.
  • A valid issue reference format (Fixes , Close, Closes, Closed , Fix , Fixed , Resolve , Resolves #Issue_number).
  1. If either check fails, the PR will be marked as failing, and the author will receive clear error messages in the PR comments.
  2. If all checks pass, a confirmation message will indicate that the PR is valid.

Note: Kindly add all the labels added to the issue, to this PR!

@ratnesh-maurya

@smog-root
Copy link
Author

smog-root commented Oct 21, 2024

Upgrade it to level3. It deserves it! @ratnesh-maurya

@ratnesh-maurya
Copy link
Member

Will review Tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement PR Issue Checker Workflow
2 participants