-
Notifications
You must be signed in to change notification settings - Fork 6
157 lines (130 loc) · 4.65 KB
/
publish.yml
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Publish to PowerShell Gallery
on:
push:
tags:
- v*
paths-ignore:
- '**.md'
- '.all-contributorsrc'
jobs:
build:
runs-on: windows-latest
steps:
- name: HACK - Install Latest PowerShell (so we get v7.3+ that uses .net 7)
shell: pwsh
run: |
dotnet tool install --global PowerShell
$content = Get-Content -Path $env:GITHUB_PATH
$HOME + "/.dotnet/tools`r`n" + $content | Set-Content -Path $env:GITHUB_PATH -Encoding utf8
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
- name: Build F7History v${{ steps.gitversion.outputs.FullSemVer }}
id: build
shell: pwsh
run: |
Install-module -Name ModuleBuilder -Force -SkipPublisherCheck -Scope CurrentUser
./build.ps1 -Version ${{ steps.gitversion.outputs.FullSemVer }}
- name: Upload Build Output
uses: actions/upload-artifact@v3
with:
name: Modules
path: ${{github.workspace}}/Output
- name: Upload Tests
uses: actions/upload-artifact@v3
with:
name: PesterTests
path: ${{github.workspace}}/Tests
- name: Upload PSScriptAnalyzerSettings.psd1
uses: actions/upload-artifact@v3
with:
name: ScriptAnalyzer
path: ${{github.workspace}}/PSScriptAnalyzerSettings.psd1
lint:
needs: build
name: Run PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Download Build Output
uses: actions/download-artifact@v3
- name: Invoke-ScriptAnalyzer
uses: devblackops/github-action-psscriptanalyzer@master
with:
rootPath: Modules/F7History
repoToken: ${{ secrets.GITHUB_TOKEN }}
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: HACK - Install Latest PowerShell (so we get v7.3+ that uses .net 7)
shell: pwsh
run: |
dotnet tool install --global PowerShell
$content = Get-Content -Path $env:GITHUB_PATH
$HOME + "/.dotnet/tools`r`n" + $content | Set-Content -Path $env:GITHUB_PATH -Encoding utf8
- name: Download Build Output
uses: actions/download-artifact@v3
# see https://github.com/Jaykul/RequiredModules/issues/6
- name: Manually Install Modules F7History is dependent on
shell: pwsh
run: |
Install-Module -Name Microsoft.PowerShell.ConsoleGuiTools -Force -SkipPublisherCheck -Scope CurrentUser
Install-Module -Name PSReadLine -Force -SkipPublisherCheck -Scope CurrentUser
- name: Run Pester Tests
shell: pwsh
run: |
Import-Module Microsoft.PowerShell.ConsoleGuiTools -Verbose -Force
Import-Module ${{github.workspace}}/Modules/F7History -Verbose
$MyOptions = @{
Run = @{ # Run configuration.
PassThru = $true # Return result object after finishing the test run.
}
}
$config = New-PesterConfiguration -Hashtable $MyOptions
$config.Output.Verbosity = "Detailed"
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.OutputPath = "./coverage.xml"
Invoke-Pester -Configuration $config
- name: Publish Test Results
uses: zyborg/dotnet-tests-report@v1
with:
test_results_path: results.xml
- name: Upload Results
uses: actions/upload-artifact@v3
with:
name: Pester Results
path: ${{github.workspace}}/*.xml
publish:
needs:
- build
- test
runs-on: ubuntu-latest
steps:
- name: Download Build Output
uses: actions/download-artifact@v3
# - name: Display structure of downloaded files
# run: ls -R
# see https://github.com/Jaykul/RequiredModules/issues/6
- name: Manually Install Modules F7History is dependent on
shell: pwsh
run: |
Install-Module -Name Microsoft.PowerShell.ConsoleGuiTools -Force -SkipPublisherCheck -Scope CurrentUser
Install-Module -Name PSReadLine -Force -SkipPublisherCheck -Scope CurrentUser
- name: Publish Module to PowerShell Gallery
shell: pwsh
run: |
Publish-Module -Path ${{github.workspace}}/Modules/F7History -NuGetApiKey ${{ secrets.F7HISTORY_GALLERY_KEY }}