Skip to content

Commit

Permalink
Add GitHub Action based CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleejordan committed Feb 27, 2024
1 parent 47bc3b7 commit 7a637be
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI Tests

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
merge_group:
types: [ checks_requested ]

jobs:
ci:
name: pester
strategy:
matrix:
os: [ windows-latest, macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- run: ./tools/installPSResources.ps1
shell: pwsh
- run: ./build.ps1 -Build && Invoke-ModuleTests -Type Functional
shell: pwsh
- uses: actions/upload-artifact@v4
if: always()
with:
name: SecretManagement-package-${{ matrix.os }}
path: "**/*.nupkg"
- uses: actions/upload-artifact@v4
if: always()
with:
name: SecretManagement-tests-${{ matrix.os }}
path: test/result.pester.xml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ maml/
**/obj/**
packages.config
packages/
SecretManagement.sln
Tools/NuGet/
test/result.pester.xml
updatablehelp/
xhtml/
**/settings.json
Expand Down
13 changes: 13 additions & 0 deletions tools/installPSResources.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

$ErrorActionPreference = 'Stop'

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | Out-Null
if ($PSVersionTable.PSVersion.Major -lt 6) {
throw "The build script requires PowerShell 7!"
}

# TODO: Switch to Install-PSResource when CI uses PowerShell 7.4
Install-Module -Name PowerShellGet -AllowPrerelease -Scope CurrentUser
Install-Module -Name Pester -MinimumVersion 4.10.1 -MaximumVersion 5.0.0 -Scope CurrentUser

0 comments on commit 7a637be

Please sign in to comment.