Skip to content

Commit

Permalink
ci: Add CI workflows for PRs & push
Browse files Browse the repository at this point in the history
  • Loading branch information
ram-amoncar committed May 9, 2024
1 parent 0584d72 commit 9503dc6
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Continuous Integration

on:
push:
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Installing dependencies
run: npm ci

- name: Running tests & Collecting coverage
run: npm run coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Pull Request Check
on:
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Installing dependencies
run: npm ci

- name: Running Tests
run: npm run test

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

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

- name: Installing dependencies
run: npm ci

- name: Checking code quality
run: npm run lint
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![npm](https://img.shields.io/npm/v/@full-pack/string-pack.svg)](https://www.npmjs.com/package/@full-pack/string-pack)

[![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/jestjs/jest) [![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/jestjs/jest) [![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![codecov](https://codecov.io/gh/full-pack/string-pack/graph/badge.svg?token=VAO8UI9TEP)](https://codecov.io/gh/full-pack/string-pack)

A lightweight and versatile String Utility Package for Node.js & Browser.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"build": "tsup",
"test": "jest --config ./jest.config.ts",
"test:watch": "jest --watch --config ./jest.config.ts",
"coverage": "jest --collectCoverage --config ./jest.config.ts",
"coverage": "jest --coverage --config ./jest.config.ts",
"format": "prettier -w .",
"format:check": "prettier -c .",
"lint": "eslint . --ext .ts",
Expand Down

0 comments on commit 9503dc6

Please sign in to comment.