Update to pnpm v10 #87
Workflow file for this run
This file contains hidden or 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: Unit Test | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Self Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup NodeJs20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| - name: Install PNPM | |
| run: npm install -g pnpm@10 | |
| timeout-minutes: 5 | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| timeout-minutes: 5 | |
| - name: Run Unit Tests | |
| run: | | |
| $pattern = '(?<=\/[v][0-9]\/).*' | |
| $changes = git diff --name-only origin/main... ./plugins | |
| $pluginsToTest = $changes -replace $pattern | Sort-Object -Unique | |
| $pluginsToTest = $pluginsToTest | Where-Object { Test-Path -PathType Leaf (Join-Path "." $_ "metadata.json") } # Don't try to test deleted plugins | |
| if ( $null -eq $pluginsToTest ) { | |
| Write-Output "Nothing to Test as no changes were found in plugins folder..." | |
| exit 0 | |
| } | |
| elseif ( $pluginsToTest.Count -eq 1 ) { | |
| Write-Output "Testing only one Plugin" | |
| pnpm run test --ci --path="./$pluginsToTest" | |
| } | |
| else { | |
| Write-Output "Testing $($pluginsToTest.Count) Plugins..." | |
| foreach ( $plugin in $pluginsToTest ) { | |
| Write-Output "Testing $plugin" | |
| pnpm run test --ci --path="./$plugin" | |
| Write-Output "Tested $plugin" | |
| } | |
| } | |
| shell: pwsh | |
| timeout-minutes: 10 | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| packages/@squaredup/unit-test/test_output/*.xml | |
| packages/@squaredup/unit-test/test_output/html/*.html |