Feat/intergrate common #728
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check the test before merge | |
on: | |
# When Release Pull Request is merged | |
pull_request: | |
types: [opened, synchronize, ready_for_review] | |
branches: | |
- main | |
- staging | |
push: | |
branches: | |
- main | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
test: | |
strategy: | |
matrix: | |
node: ["18.18.0"] | |
os: ["ubuntu-latest"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: | | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
./node_modules/ | |
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: | | |
npm install -g yarn | |
yarn | |
- name: Run nx reset workspace | |
run: | | |
yarn nx reset | |
- name: Run test | |
run: | | |
yarn test | |
- name: Produce the coverage report | |
uses: insightsengineering/coverage-action@v2 | |
with: | |
# Path to the Cobertura XML report. | |
path: ./coverage/cobertura-coverage.xml | |
# Minimum total coverage, if you want to the | |
# workflow to enforce it as a standard. | |
# This has no effect if the `fail` arg is set to `false`. | |
# threshold: 90 | |
# Fail the workflow if the minimum code coverage | |
# reuqirements are not satisfied. | |
fail: false | |
# Publish the rendered output as a PR comment | |
publish: true | |
# Create a coverage diff report. | |
diff: true | |
# Branch to diff against. | |
# Compare the current coverage to the coverage | |
# determined on this branch. | |
diff-branch: main | |
# This is where the coverage reports for the | |
# `diff-branch` are stored. | |
# Branch is created if it doesn't already exist'. | |
# diff-storage: _xml_coverage_reports | |
coverage-summary-title: "Code Coverage Summary" | |
new-uncovered-statements-failure: true | |
# new-uncovered-statements-failure: true |