Skip to content

Commit 01f8caf

Browse files
committed
...
1 parent d627f97 commit 01f8caf

28 files changed

+1622
-102
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/ci.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: ADReadableAcl Workflow
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
pull_request:
8+
branches:
9+
- main
10+
11+
release:
12+
types:
13+
- published
14+
15+
env:
16+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
17+
POWERSHELL_TELEMETRY_OPTOUT: 1
18+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
19+
DOTNET_NOLOGO: true
20+
BUILD_CONFIGURATION: ${{ fromJSON('["Debug", "Release"]')[startsWith(github.ref, 'refs/tags/v')] }}
21+
22+
jobs:
23+
build:
24+
name: build
25+
runs-on: windows-latest
26+
steps:
27+
- name: Check out repository
28+
uses: actions/checkout@v4
29+
30+
- name: Build module - Debug
31+
shell: pwsh
32+
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Build
33+
if: ${{ env.BUILD_CONFIGURATION == 'Debug' }}
34+
35+
- name: Build module - Publish
36+
shell: pwsh
37+
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Build
38+
if: ${{ env.BUILD_CONFIGURATION == 'Release' }}
39+
40+
- name: Capture PowerShell Module
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: PSModule
44+
path: output/*.nupkg
45+
46+
test:
47+
name: test
48+
needs:
49+
- build
50+
runs-on: ${{ matrix.info.os }}
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
info:
55+
- name: PS-5.1
56+
psversion: '5.1'
57+
os: windows-latest
58+
- name: PS-7-Windows
59+
psversion: '7'
60+
os: windows-latest
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: Restore Built PowerShell Module
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: PSModule
69+
path: output
70+
71+
- name: Install Built PowerShell Module
72+
shell: pwsh
73+
run: |
74+
$manifestItem = Get-Item ([IO.Path]::Combine('module', '*.psd1'))
75+
$moduleName = $manifestItem.BaseName
76+
$manifest = Test-ModuleManifest -Path $manifestItem.FullName -ErrorAction SilentlyContinue -WarningAction Ignore
77+
78+
$destPath = [IO.Path]::Combine('output', $moduleName, $manifest.Version)
79+
if (-not (Test-Path -LiteralPath $destPath)) {
80+
New-Item -Path $destPath -ItemType Directory | Out-Null
81+
}
82+
83+
Get-ChildItem output/*.nupkg | Rename-Item -NewName { $_.Name -replace '.nupkg', '.zip' }
84+
85+
Expand-Archive -Path output/*.zip -DestinationPath $destPath -Force -ErrorAction Stop
86+
87+
- name: Run Tests - Windows PowerShell
88+
if: ${{ matrix.info.psversion == '5.1' }}
89+
shell: pwsh
90+
run: |
91+
powershell.exe -NoProfile -File ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Test
92+
exit $LASTEXITCODE
93+
94+
- name: Run Tests - PowerShell
95+
if: ${{ matrix.info.psversion != '5.1' }}
96+
shell: pwsh
97+
run: |
98+
pwsh -NoProfile -File ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Test
99+
exit $LASTEXITCODE
100+
101+
- name: Upload Test Results
102+
if: always()
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: Unit Test Results (${{ matrix.info.name }})
106+
path: ./output/TestResults/Pester.xml
107+
108+
- name: Upload Coverage Results
109+
if: always() && !startsWith(github.ref, 'refs/tags/v')
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: Coverage Results (${{ matrix.info.name }})
113+
path: ./output/TestResults/Coverage.xml
114+
115+
- name: Upload Coverage to codecov
116+
if: always() && !startsWith(github.ref, 'refs/tags/v')
117+
uses: codecov/codecov-action@v4
118+
with:
119+
files: ./output/TestResults/Coverage.xml
120+
flags: ${{ matrix.info.name }}
121+
122+
publish:
123+
name: publish
124+
if: startsWith(github.ref, 'refs/tags/v')
125+
needs:
126+
- build
127+
- test
128+
runs-on: windows-latest
129+
steps:
130+
- name: Restore Built PowerShell Module
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: PSModule
134+
path: ./
135+
136+
- name: Publish to Gallery
137+
if: github.event_name == 'release'
138+
shell: pwsh
139+
run: >-
140+
dotnet nuget push '*.nupkg'
141+
--api-key $env:PSGALLERY_TOKEN
142+
--source 'https://www.powershellgallery.com/api/v2/package'
143+
--no-symbols
144+
env:
145+
PSGALLERY_TOKEN: ${{ secrets.PSGALLERY_TOKEN }}

0 commit comments

Comments
 (0)