Skip to content

Commit 3703f6b

Browse files
committed
better pipeline
1 parent 53bacf7 commit 3703f6b

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

.github/workflows/powershell.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# For more information on PSScriptAnalyzer in general, see
88
# https://github.com/PowerShell/PSScriptAnalyzer
99

10-
name: PSScriptAnalyzer
10+
name: Powershell CI
1111

1212
on:
1313
push:
@@ -27,7 +27,7 @@ jobs:
2727
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
2828
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
2929
name: PSScriptAnalyzer
30-
runs-on: ubuntu-latest
30+
runs-on: windows-latest
3131
steps:
3232
- uses: actions/checkout@v4
3333

@@ -47,3 +47,23 @@ jobs:
4747
uses: github/codeql-action/upload-sarif@v3
4848
with:
4949
sarif_file: results.sarif
50+
51+
# Run the tests
52+
- name: Install Pester
53+
shell: powershell
54+
run: |
55+
Install-Module -Name Pester -Force -Scope CurrentUser
56+
57+
- name: Run Pester Tests
58+
shell: powershell
59+
run: |
60+
$modules = Get-ChildItem -Directory -Path ./src
61+
foreach ($module in $modules) {
62+
$testPath = Join-Path $module.FullName 'Tests'
63+
if (Test-Path $testPath) {
64+
"Running tests for module: $($module.Name)..."
65+
Invoke-Pester -Path $testPath -Output Detailed
66+
} else {
67+
"No tests found for module: $($module.Name). Skipping."
68+
}
69+
}

.github/workflows/publish-to-psgallery.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: publish-to-psgallery
42

5-
# Controls when the workflow will run
63
on:
7-
# Triggers the workflow on push or pull request events but only for the "main" branch
8-
push:
9-
branches: [ "main" ]
4+
workflow_run:
5+
workflows: ["PowerShell CI"]
6+
types:
7+
- completed
108

119
# Allows you to run this workflow manually from the Actions tab
1210
workflow_dispatch:
1311

14-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1512
jobs:
16-
# This workflow contains a single job called "build"
17-
build:
18-
# The type of runner that the job will run on
13+
publish:
14+
if: >-
15+
${{
16+
github.event.workflow_run.conclusion == 'success' &&
17+
github.event.workflow_run.head_branch == 'main' &&
18+
github.event.workflow_run.event == 'push'
19+
}}
20+
1921
runs-on: ubuntu-latest
2022

21-
# Steps represent a sequence of tasks that will be executed as part of the job
2223
steps:
2324
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2425
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)