-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (128 loc) · 4.68 KB
/
validate.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
name: Validate Changes
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint-with-psscriptanalyzer:
name: Lint with PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Lint with PSScriptAnalyzer
uses: pwshrc/actions-invoke-lib-dependent-pwsh@v0.2.10
with:
run: ./build/lint.ps1 -CI -NoFail:([bool]"${{ secrets.MANDATE_LINT_SUCCESS != 'true' }}")
determine-version:
name: Determine Version with GitVersion
runs-on: ubuntu-latest
steps:
- name: Populate GitVersion variables
id: gitversion_vars
uses: pwshrc/actions-determine-version@v0.8.7
with:
mode: 'upload'
create-releasenotes:
name: Create Release Notes
needs: determine-version
runs-on: ubuntu-latest
steps:
- name: Create release notes
uses: pwshrc/actions-create-release-notes@v0.8.8
with:
mode: 'upload'
github_token: "${{ secrets.GITHUB_TOKEN }}"
build-release-package:
name: Build Release Package
needs: [create-releasenotes]
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Populate GitVersion
id: gitversion_vars
uses: pwshrc/actions-determine-version@v0.8.7
with:
mode: 'download'
- name: Populate release notes
id: get-releasenotes
uses: pwshrc/actions-create-release-notes@v0.8.8
with:
mode: 'download'
github_token: "${{ secrets.GITHUB_TOKEN }}"
- name: Build PSGallery package
uses: pwshrc/actions-invoke-lib-dependent-pwsh@v0.2.10
env:
PackageVersion: ${{ steps.gitversion_vars.outputs.NuGetVersionV2 }}
ModuleVersionMajor: ${{ steps.gitversion_vars.outputs.Major }}
ModuleVersionMinor: ${{ steps.gitversion_vars.outputs.Minor }}
ModuleVersionPatch: ${{ steps.gitversion_vars.outputs.Patch }}
PackageVersionPrereleaseTag: ${{ steps.gitversion_vars.outputs.PreReleaseTag }}
CommitSha: ${{ steps.gitversion_vars.outputs.Sha }}
ReleaseNotesFilepath: ${{ steps.get-releasenotes.outputs.filepath }}
with:
run: |
[string] $releaseNotes = (Get-Content -Raw -Path ./out/release-notes.md -Encoding UTF8).Trim()
[Version] $moduleVersion = [Version]::new($Env:ModuleVersionMajor, $Env:ModuleVersionMinor, $Env:ModuleVersionPatch)
./build/package.ps1 -PackageVersion $Env:PackageVersion -ModuleVersion $moduleVersion -PackageVersionPrereleaseTag $Env:PackageVersionPrereleaseTag -ReleaseNotes $releaseNotes -CommitSha $Env:CommitSha
- name: "Create artifact: PSGallery-package"
uses: actions/upload-artifact@v3
with:
name: PSGallery-package
path: ./out/*.nupkg
if-no-files-found: error
tests:
name: Test with Pester on ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental == 'true' }}
strategy:
fail-fast: ${{ github.ref == 'refs/heads/main' }}
matrix:
# See: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-20.04, windows-2019]
include:
- os: windows-latest
codecov_os: windows
- os: ubuntu-latest
codecov_os: linux
- os: macos-latest
codecov_os: macos
experimental: true
- os: ubuntu-20.04
codecov_os: linux
experimental: true
- os: windows-2019
codecov_os: windows
experimental: true
runs-on: ${{ matrix.os }}
needs: build-release-package
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: "Get artifact: PSGallery-package"
uses: actions/download-artifact@v3
with:
name: PSGallery-package
path: ./out/
- name: Test with Pester
uses: pwshrc/actions-invoke-lib-dependent-pwsh@v0.2.10
with:
run: ./build/test.ps1 -UsePackageExport -CI -OutputFilesPrefix "${{ matrix.os }}-" -NoFail:([bool]"${{ matrix.experimental }}")
- name: "Create artifact: tests-${{ matrix.os }}"
uses: actions/upload-artifact@v3
if: always()
with:
name: "tests-${{ matrix.os }}"
path: ./out/*.xml
if-no-files-found: error
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
if: github.ref == 'refs/heads/main'
with:
fail_ci_if_error: true
flags: ${{ matrix.codecov_os }},unittests
directory: ./out
files: "*coverage.xml"
os: ${{ matrix.codecov_os }}
env_vars: "OS"