From 02d2002f4f77606506af0e3afa0ba1a96d25a716 Mon Sep 17 00:00:00 2001 From: chvarkov Date: Sat, 7 Sep 2024 12:05:40 +0000 Subject: [PATCH 1/4] tech: test workflow --- .github/workflows/test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..539c3f2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: Test +on: [push, pull_request, workflow_dispatch] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - name: Install + run: npm install + - name: Test and Coverage + run: npm run test:cov + + - name: Update Coverage Badge + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + uses: we-cli/coverage-badge-action@main From 54db8dcac8a22c0a24588ce0ebda7664297d04bd Mon Sep 17 00:00:00 2001 From: chvarkov Date: Sat, 7 Sep 2024 20:57:31 +0000 Subject: [PATCH 2/4] tech: jest coverageReporters="json-summary" --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index abe5ab1..38e2547 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "lint:fix": "eslint . --fix", "lint:check": "eslint . --max-warnings=0", "test": "jest --silent=false", - "test:cov": "jest --coverage", + "test:cov": "jest --coverage --coverageReporters=\"json-summary\"", "test:coveralls": "jest --runInBand --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", "publish-package": "cd dist && npm publish --access public" }, From f3f064300b7467a0bbc2e92b45acf98a1a01dcc3 Mon Sep 17 00:00:00 2001 From: chvarkov Date: Sat, 7 Sep 2024 21:06:29 +0000 Subject: [PATCH 3/4] fix: updated workflow --- .github/workflows/test.yml | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 539c3f2..a6420df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,16 +1,28 @@ name: Test -on: [push, pull_request, workflow_dispatch] + +on: + push: + branches: [ "master", "develop" ] + pull_request: + branches: [ "master", "develop" ] + jobs: - test: + build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - - name: Install - run: npm install - - name: Test and Coverage - run: npm run test:cov + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: yarn install --frozen-lockfile + - run: yarn build + - run: yarn test --coverage - name: Update Coverage Badge - if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) - uses: we-cli/coverage-badge-action@main + if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && matrix.node-version == '22.x'}} + uses: we-cli/coverage-badge-action@main \ No newline at end of file From 5af01984842df06082a67cc8b5c80f47662fcb2d Mon Sep 17 00:00:00 2001 From: chvarkov Date: Sat, 7 Sep 2024 21:12:42 +0000 Subject: [PATCH 4/4] fix: test workflow --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6420df..658744b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,9 +20,9 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: yarn install --frozen-lockfile - - run: yarn build - - run: yarn test --coverage + - run: npm ci + - run: npm run build + - run: npm run test:cov - name: Update Coverage Badge if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && matrix.node-version == '22.x'}} uses: we-cli/coverage-badge-action@main \ No newline at end of file