diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 539453e4..4cb0ab29 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -1,4 +1,4 @@ -name: Lint +name: Lint & Test on: ['pull_request'] @@ -41,3 +41,23 @@ jobs: run: npm clean-install - name: Lint code run: npm run lint + unittest: + name: Run unit tests + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x, 16.x, 18.x, 20.x] + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install dependencies + run: npm clean-install + - name: Run unit tests + run: npm run test-unit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d2910990..19d4a94c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,6 +44,26 @@ jobs: run: npm clean-install - name: Lint code run: npm run lint + unittest: + name: Run unit tests + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x, 16.x, 18.x, 20.x] + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install dependencies + run: npm clean-install + - name: Run unit tests + run: npm run test-unit release: name: Release if: ${{ github.actor != 'dependabot[bot]' }} @@ -51,6 +71,7 @@ jobs: needs: - commitlint - lintcode + - unittest permissions: contents: write # to be able to publish a GitHub release issues: write # to be able to comment on released issues