-
-
Notifications
You must be signed in to change notification settings - Fork 24
122 lines (108 loc) · 3.77 KB
/
validate-module.yml
File metadata and controls
122 lines (108 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Validate module
on:
push:
paths:
- 'VcRedist/**'
- 'tests/**'
branches-ignore:
- main
pull_request:
branches:
- main
paths:
- 'VcRedist/**'
workflow_dispatch:
jobs:
run-pester:
name: Test with Pester
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2025, windows-11-arm]
steps:
- uses: actions/checkout@v6
# Run Pester tests
- name: Run Pester tests
shell: powershell
working-directory: "${{ github.workspace }}"
env:
TENANT_ID: ${{ secrets.TENANT_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
.\tests\Install-Pester.ps1
Import-Module -Name "Pester" -Force -ErrorAction "Stop"
Import-Module -Name "$env:GITHUB_WORKSPACE\VcRedist" -Force
$Config = New-PesterConfiguration
$Config.Run.Path = "$env:GITHUB_WORKSPACE\tests"
$Config.Run.PassThru = $True
$Config.CodeCoverage.Enabled = $True
$Config.CodeCoverage.Path = "$env:GITHUB_WORKSPACE\VcRedist"
$Config.CodeCoverage.OutputFormat = "JaCoCo"
$Config.CodeCoverage.OutputPath = "$env:GITHUB_WORKSPACE\CodeCoverage-${{ matrix.os }}.xml"
$Config.TestResult.Enabled = $True
$Config.TestResult.OutputFormat = "NUnitXml"
$Config.TestResult.OutputPath = "$env:GITHUB_WORKSPACE\tests\TestResults-${{ matrix.os }}.xml"
$Config.Output.Verbosity = "Detailed"
Invoke-Pester -Configuration $Config
- name: Upload artifacts
id: upload-artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: 'pester-test-results-${{ matrix.os }}'
path: |
${{ github.workspace }}\tests\TestResults-${{ matrix.os }}.xml
# Publish Pester test results
- name: Publish Pester test results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: "${{ github.workspace }}//tests//TestResults-${{ matrix.os }}.xml"
# - name: Upload to Codecov
# id: codecov
# if: always()
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./CodeCoverage-${{ matrix.os }}.xml
# verbose: true
update-module-version:
name: Update module version
needs: [run-pester]
runs-on: 'windows-latest'
steps:
- uses: actions/checkout@v6
- name: Install and cache PowerShell modules
id: psmodulecache
uses: potatoqualitee/psmodulecache@v6.2.1
with:
modules-to-cache: BuildHelpers
shell: pwsh
- name: Update module version
shell: pwsh
working-directory: "${{ github.workspace }}"
run: |
Import-Module -Name BuildHelpers
Step-ModuleVersion -Path .\VcRedist\VcRedist.psd1 -By Build
# Import GPG key so that we can sign the commit
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v7
with:
gpg_private_key: ${{ secrets.GPGKEY }}
passphrase: ${{ secrets.GPGPASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_config_global: true
git_tag_gpgsign: true
git_push_gpgsign: false
git_committer_name: ${{ secrets.COMMIT_NAME }}
git_committer_email: ${{ secrets.COMMIT_EMAIL }}
- name: Commit changes
id: commit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Update module version"
commit_user_name: ${{ secrets.COMMIT_NAME }}
commit_user_email: ${{ secrets.COMMIT_EMAIL }}