Skip to content

Set module sandbox mode to avoid calls to certain commands #26

Set module sandbox mode to avoid calls to certain commands

Set module sandbox mode to avoid calls to certain commands #26

# This is a workflow to test you PowerShell module with TestingHelper
# https://github.com/rulasg/DemoPsModule/blob/main/.github/workflows/test_with_TestingHelper.yml
name: Test with TestingHelper
# Controls when the workflow will run
on:
# Run as check on pull request
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
# To run test we only need to read the repository
contents: read
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Run test.ps1
shell: pwsh
run: |
$result = ./test.ps1 -ShowTestErrors
$result
# Allow Not Implemented and Skipped tests to pass
$passed = $result.Tests -eq $result.Pass + $result.NotImplemented + $result.Skipped
# $passed = $result.Tests -eq $result.Pass
if($passed)
{ "All test passed" | Write-Verbose -verbose ; exit 0 }
else
{ "Not all tests passed" | Write-Verbose -verbose ; exit 1 }