-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (84 loc) · 2.56 KB
/
ModuleCI.yml
File metadata and controls
86 lines (84 loc) · 2.56 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
# This is a shared workflow for continuously testing PowerShell modules.
name: CI
on:
workflow_call:
permissions:
checks: write
pull-requests: write
contents: read
issues: write
jobs:
lint:
name: Run Linters
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v6
with:
strict: false
suggestions: true
incremental_files_only: true
- uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-review
level: warning
- shell: pwsh
name: Apply PSScriptAnalyzer Fixes
run: Invoke-ScriptAnalyzer . -Fix
- name: PSScriptAnalyzer Fixes
uses: reviewdog/[email protected]
with:
tool_name: 'PSScriptAnalyzer'
test:
name: Run Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- name: Install and cache PSDepend
id: psdepend
uses: potatoqualitee/[email protected]
with:
modules-to-cache: PSDepend:0.3.8
- name: Determine modules to cache
shell: pwsh
id: modules-to-cache
run: |
$dependancies = Get-Dependency
$f = $dependancies | ?{ $_.DependencyType -eq 'PSGalleryModule' } | %{ "{0}:{1}" -F $_.DependencyName, $_.Version}
Write-Output "::set-output name=ModulesToCache::$($f -join ', ')"
- name: Install and cache PowerShell modules
id: psmodulecache
uses: potatoqualitee/[email protected]
with:
modules-to-cache: ${{ steps.modules-to-cache.outputs.ModulesToCache }}
shell: pwsh
- name: Test
shell: pwsh
run: ./build.ps1 -Task Test
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (OS ${{ matrix.os }})
path: ./tests/out/testResults.xml
publish-test-results:
name: "Publish Unit Tests Results"
needs: test
runs-on: ubuntu-latest
# the test job might be skipped, we don't need to run this job then
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: artifacts/**/*.xml