diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d4fbe59 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..9c8a64b --- /dev/null +++ b/.github/workflows/pr.yml @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 82c0ac3..0680ed7 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/package.json b/package.json index d618465..742e43e 100644 --- a/package.json +++ b/package.json @@ -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",