Skip to content

Commit

Permalink
submit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stevevillardi committed Apr 16, 2024
1 parent 2071f8a commit ff8a937
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 0 deletions.
156 changes: 156 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# This is a basic workflow to help you get started with Actions

name: Build PSGallery Release

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
release:
types: [ published ]

# 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:
publish_to_gallery:
runs-on: ubuntu-latest
environment: publish
outputs:
githubReleaseMessage: ${{steps.psgallery_publish.outputs.githubReleaseMessage}}
steps:
- uses: actions/checkout@v4
- name: Build and publish
id: psgallery_publish
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
BUILD_VERSION: ${{github.ref_name}}
shell: pwsh
run: |
./Build.ps1
Publish-Module -path ./ -NuGetApiKey $env:NUGET_API_KEY -SkipAutomaticTags -Verbose
$GithubReleaseMessage = @'
${{github.event.release.body}}
'@
$GithubReleaseMessage = $GithubReleaseMessage.Replace("`n","\n").Replace("`"","\`"").Replace("**","*").Replace(" - ",">").Replace("- ","• ").Replace("###","").Replace("##","").Replace("powershell","").Replace("`r","")
"githubReleaseMessage=$GithubReleaseMessage" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
push_to_slack:
needs: publish_to_gallery
runs-on: ubuntu-latest
environment: publish
steps:
- name: Send custom JSON data to Slack workflow
uses: slackapi/slack-github-action@v1.25.0
id: slack-post
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":party-lm-bug: Logic.Monitor PowerShell Module Release (${{github.event.release.tag_name}}) :party-lm-bug:"
}
},
{
"type": "context",
"elements": [
{
"text": "*${{github.event.release.published_at}}* | Logic.Monitor Update Announcements",
"type": "mrkdwn"
}
]
},
{
"type": "divider"
},
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":powershell-core: Release Notes :powershell-core:",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{needs.publish_to_gallery.outputs.githubReleaseMessage}}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Logic.Monitor* Release Notes"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Release Notes",
"emoji": true
},
"value": "click_me_123",
"url": "https://github.com/stevevillardi/Logic.Monitor/releases",
"action_id": "button-action"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Logic.Monitor.SE* Toolkit Release Notes:"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Release Notes",
"emoji": true
},
"value": "click_me_123",
"url": "https://github.com/stevevillardi/Logic.Monitor.SE/releases",
"action_id": "button-action"
}
},
{
"type": "divider"
},
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":rocket: How to get the latest version :rocket:",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "```Update-Module -Name Logic.Monitor -Force```"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": ":pushpin: Do you have a feature request or bug report? <https://github.com/stevevillardi/Logic.Monitor/issues|Submit a Github Issue>."
}
]
}
]
}
54 changes: 54 additions & 0 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a basic workflow to help you get started with Actions

name: Test Current Build on Windows Powershell 5.1

# 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: windows-latest
environment: test
steps:
- uses: actions/checkout@v4
- name: Build and Test 5.1
# 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: powershell
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-Win5.1","PSVersion-$Version")
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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")
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

Dev.Logic.Monitor.psd1
.github/.DS_Store
.DS_Store

0 comments on commit ff8a937

Please sign in to comment.