From 9c0e47b1719b7aba102342cafa470ccd77ea8ebb Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Sun, 23 Apr 2023 16:30:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20add=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 2 ++ 3 files changed, 53 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e51e981 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: [push, pull_request] + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'npm' + - run: npm ci + - name: Build + run: npm run build + - name: Test + run: npm test -- --tap | npx -y tap-xunit --dontUseCommentsAsTestNames > xunit.xml + - name: Test Report + uses: phoenix-actions/test-reporting@v12 + id: test-report + if: success() || failure() + with: + name: Test Report + path: xunit.xml + reporter: jest-junit + - name: Code Coverage Summary Report + uses: 5monkeys/cobertura-action@master + with: + path: coverage/cobertura-coverage.xml + minimum_coverage: 75 + - name: Set code coverage commit status 📫 + run: npx -y -p check-code-coverage set-gh-status + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Update Badge of Code Coverage + if: github.event_name == 'push' + run: npx -y -p check-code-coverage update-badge + - name: Commit files + if: github.event_name == 'push' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m "docs: ✏️ update coverage badge" -a || true + - name: Push changes + uses: ad-m/github-push-action@master + if: github.event_name == 'push' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/.gitignore b/.gitignore index 0b578e1..e8ba191 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist *.tgz .vscode coverage +xunit.xml diff --git a/README.md b/README.md index becc9cd..0280a3c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # safe-signer +![build](https://github.com/DTeam-Top/safe-signer/actions/workflows/ci.yml/badge.svg) +![check-code-coverage](https://img.shields.io/badge/code--coverage-98.22%25-brightgreen) [![npm](https://img.shields.io/npm/dt/@dteam/safe-signer)](https://www.npmjs.com/package/@dteam/safe-signer) [![npm (scoped)](https://img.shields.io/npm/v/@dteam/safe-signer)](https://www.npmjs.com/package/@dteam/safe-signer) From 530db14ac332d066d33ef7b9129d1fcf40c86a6d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 23 Apr 2023 08:36:44 +0000 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20update=20cover?= =?UTF-8?q?age=20badge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0280a3c..be18e40 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # safe-signer ![build](https://github.com/DTeam-Top/safe-signer/actions/workflows/ci.yml/badge.svg) -![check-code-coverage](https://img.shields.io/badge/code--coverage-98.22%25-brightgreen) +![check-code-coverage](https://img.shields.io/badge/code--coverage-80.13%25-green) [![npm](https://img.shields.io/npm/dt/@dteam/safe-signer)](https://www.npmjs.com/package/@dteam/safe-signer) [![npm (scoped)](https://img.shields.io/npm/v/@dteam/safe-signer)](https://www.npmjs.com/package/@dteam/safe-signer)