Skip to content

Commit

Permalink
Add GitHub Action based CI tests (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleejordan authored Mar 1, 2024
1 parent 47bc3b7 commit 0391ffb
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
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: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
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: out/**/*.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
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if ($env:TF_BUILD) {
Write-Host "##$vstsCommandString"
}

. $PSScriptRoot/dobuild.ps1
. $PSScriptRoot/doBuild.ps1

if ($Clean -and (Test-Path $OutDirectory))
{
Expand Down
1 change: 1 addition & 0 deletions buildtools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT License.

$ConfigurationFileName = 'package.config.json'
# TODO: Update to PSResourceGet.
Import-Module -Name PowerShellGet -MinimumVersion 3.0.18

function Get-BuildConfiguration {
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 -Force
Install-Module -Name Pester -RequiredVersion 4.10.1 -Scope CurrentUser -Force

0 comments on commit 0391ffb

Please sign in to comment.