submit tests #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Test Current Build on PowerShell Core | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
- '**.yml' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test-build: | |
runs-on: ubuntu-latest | |
environment: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and Test | |
# API key generated in PSGallery | |
env: | |
LM_ACCESS_ID: ${{ secrets.LM_ACCESS_ID }} | |
LM_ACCESS_KEY: ${{ secrets.LM_ACCESS_KEY }} | |
LM_PORTAL: ${{ secrets.LM_PORTAL }} | |
LM_BEARER_TOKEN: ${{ secrets.LM_BEARER_TOKEN }} | |
BUILD_VERSION: 9.9.9 | |
shell: pwsh | |
run: | | |
./Build.ps1 | |
$Data = @{ | |
AccessId="$env:LM_ACCESS_ID" | |
AccessKey="$env:LM_ACCESS_KEY" | |
AccountName="$env:LM_PORTAL" | |
BearerToken="$env:LM_BEARER_TOKEN" | |
Module="./Logic.Monitor.psd1" | |
PreferredCollectorId="8" | |
} | |
$Version = $PSVersionTable.PSVersion | |
Write-Host "Powershell version: $Version" | |
$Container = New-PesterContainer -Path ./Tests/ -Data $Data | |
$Result = Invoke-Pester -Container $Container -Output Detailed -PassThru | |
#Write OpsNote to test portal indicating test status | |
Connect-LMAccount -AccessId $env:LM_ACCESS_ID -AccessKey $env:LM_ACCESS_KEY -AccountName $env:LM_PORTAL -DisableConsoleLogging | |
$TimeNow = Get-Date -UFormat %m%d%Y-%H%M | |
$OpsNote = New-LMOpsNote -Note "Github test build submitted on $TimeNow - $($Result.Result)" -Tags @("GithubActions","TestPipeline-Core","PSVersion-$Version") | |