diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..fce947b --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,64 @@ +name: CI +on: + push: + branches: [ $default-branch ] + pull_request: + workflow_dispatch: + workflow_call: +permissions: + checks: write + pull-requests: write +jobs: + test: + name: Run Tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v4 + - name: Install and cache PSDepend + id: psdepend + uses: potatoqualitee/psmodulecache@v6.0 + with: + modules-to-cache: PSDepend:0.3.8 + - name: Determine modules to cache + shell: pwsh + id: modules-to-cache + run: | + $dependancies = Get-Dependency + $f = $dependancies | ?{ $_.DependencyType -eq 'PSGalleryModule' } | %{ "{0}:{1}" -F $_.DependencyName, $_.Version} + Write-Output "::set-output name=ModulesToCache::$($f -join ', ')" + - name: Install and cache PowerShell modules + id: psmodulecache + uses: potatoqualitee/psmodulecache@v6.0 + with: + modules-to-cache: ${{ steps.modules-to-cache.outputs.ModulesToCache }} + shell: pwsh + - name: Test + shell: pwsh + run: ./build.ps1 -Task Test -Bootstrap + - name: Upload Unit Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: Unit Test Results (OS ${{ matrix.os }}) + path: ./tests/out/testResults.xml + publish-test-results: + name: "Publish Unit Tests Results" + needs: test + runs-on: ubuntu-latest + # the test job might be skipped, we don't need to run this job then + if: success() || failure() + + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: artifacts/**/*.xml