From 797d61d6ccfda87a65487546d332949243c70891 Mon Sep 17 00:00:00 2001 From: Caleb Van Lue Date: Sat, 31 May 2025 09:39:40 -0400 Subject: [PATCH 1/2] add unit test action --- .github/workflows/unit-tests.yml | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 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 0000000..2f22b73 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,66 @@ +name: Unit Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit-tests: + runs-on: self-hosted + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: | + Write-Host "Installing dependencies..." + npm ci + shell: powershell + + - name: Run unit tests + run: | + Write-Host "Running unit tests..." + npm run test + shell: powershell + env: + LOG_LEVEL: silent + NODE_ENV: test + + - name: Run test coverage + run: | + Write-Host "Running test coverage..." + npm run test:cov + shell: powershell + env: + LOG_LEVEL: silent + NODE_ENV: test + + - name: Upload coverage reports + uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage-report + path: coverage/ + retention-days: 7 + + - name: Display test results + if: always() + run: | + Write-Host "Test execution completed" + if (Test-Path "coverage/lcov-report/index.html") { + Write-Host "Coverage report generated successfully" + } else { + Write-Host "Coverage report not found" + } + shell: powershell From 0a0f12146585a6f2756893b291db9a4966bd2696 Mon Sep 17 00:00:00 2001 From: Caleb Van Lue Date: Sat, 31 May 2025 09:43:44 -0400 Subject: [PATCH 2/2] upgrade node version --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2f22b73..ba54586 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' cache: 'npm' - name: Install dependencies