Skip to content

Fix the test matrix #96

Fix the test matrix

Fix the test matrix #96

Workflow file for this run

name: CI
on:
push: {}
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: earthly +test
if: github.ref != 'refs/heads/main'
run: earthly --strict +test
- name: earthly +push
if: github.ref == 'refs/heads/main'
run: earthly --push --secret NUGET_API_KEY --secret PSGALLERY_API_KEY --strict +all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
- uses: actions/upload-artifact@v4
with:
name: ModuleBuilder
path: Modules/ModuleBuilder
- uses: actions/upload-artifact@v4
with:
name: TestResults
path: Modules/ModuleBuilder-TestResults
# These ones are just for the test matrix
- name: Upload Tests
uses: actions/upload-artifact@v4
with:
name: PesterTests
path: ${{github.workspace}}/Tests
- name: Upload build.requires.psd1
uses: actions/upload-artifact@v4
with:
name: build.requires.psd1
path: ${{github.workspace}}/build.requires.psd1
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: Download Build Output
uses: actions/download-artifact@v4
with:
name: ModuleBuilder
path: Modules/ModuleBuilder # /home/runner/work/ModuleBuilder/ModuleBuilder/Modules/ModuleBuilder
- name: Download Pester Tests
uses: actions/download-artifact@v4
with:
name: PesterTests
path: PesterTests
- name: Download build.requires.psd1
uses: actions/download-artifact@v4
with:
name: build.requires.psd1
- name: ⚡ Install PowerShell Modules
uses: JustinGrote/[email protected]
- name: Put Build output in PATH
shell: pwsh
run: | # PowerShell
Convert-Path Modules -OutVariable BuiltModules
Add-Content -Path $env:GITHUB_PATH -Value $BuiltModules -Encoding utf8
# Uninstall the "installed" copy of ModuleBuilder
Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'powershell/Modules/ModuleBuilder' | Remove-Item -Recurse -Force
- name: Put Build output in PATH
shell: pwsh
run: | # PowerShell
$Env:PATH -spit ([IO.Path]::PathSeparator) | Out-Host
- name: Invoke Pester Tests
id: pester
uses: zyborg/pester-tests-report@v1
with:
# include_paths: tests
# exclude_paths: tests/powershell1,tests/powershell2
# exclude_tags: skip_ci
report_name: module_tests
report_title: My Module Tests
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: dump test results
shell: pwsh
run: | # PowerShell
Write-Host 'Total Tests Executed...: ${{ steps.pester.outputs.total_count }}'
Write-Host 'Total Tests PASSED.....: ${{ steps.pester.outputs.passed_count }}'
Write-Host 'Total Tests FAILED.....: ${{ steps.pester.outputs.failed_count }}'