diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml new file mode 100644 index 0000000..bf977e5 --- /dev/null +++ b/.github/workflows/node-ci.yml @@ -0,0 +1,30 @@ +name: Node CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x] + + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/install-action@v2 + with: + version: latest + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: pnpm run install, build + run: | + pnpm run init + env: + CI: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..2b3b4e4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test CI + +on: [push, pull_request] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install pnpm + uses: pnpm/install-action@v2 + with: + version: latest + - name: Setup Node.js "16.x" + uses: actions/setup-node@v2 + with: + node-version: '16.x' + - name: Install dependencies + run: pnpm install + - name: Run Tests + run: pnpm test + - name: Uploading reports + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info + flags: unittests + verbose: true diff --git a/package.json b/package.json index bb1103d..2596635 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,11 @@ "private": true, "description": "A high quality and reliable React Hooks library.", "scripts": { + "init": "pnpm install && pnpm run build", "clean-dist": "rimraf 'packages/*/{lib,es,node_modules,dist}'", "clean": "pnpm run clean-dist && rimraf node_modules", "build": "pnpm -r --filter=./packages/* run build", - "test": "jest", + "test": "jest --coverage", "test:strict": "cross-env REACT_MODE=strict jest", "coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls" },