From fd0b9fce1413622e1b585dba027ee1481f1530b8 Mon Sep 17 00:00:00 2001 From: Lukas Mertens Date: Mon, 15 Apr 2024 14:09:57 +0200 Subject: [PATCH] ci(vitest): added ci run Closes #144 Signed-off-by: Lukas Mertens commit-id:0e59297c --- .github/workflows/unit-tests.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 00000000..ad04a076 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest + +name: Execute Vitest Unit Tests + +on: + pull_request: + branches: + - main + - spr/main/* + push: + branches: + - main + tags: + - '*' + workflow_dispatch: {} + +jobs: + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Install dependencies + run: pnpm install + - name: Run Vitest + run: pnpm test:coverage + - name: 'Report Coverage' + if: always() + uses: davelosert/vitest-coverage-report-action@v2