Repository navigation
109 lines (99 loc) · 3.7 KB
/
Copy pathtest.yml
File metadata and controls
109 lines (99 loc) · 3.7 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
name: Test
on:
push:
paths:
- "app/resources/**"
- "app/tools/**"
- "app/Cargo.toml"
- "build.cmd"
- "LICENSE"
- "playbook/**"
- "tools/**"
- "tests/**"
- "docs/catalog/**"
- ".github/workflows/**"
- ".github/ISSUE_TEMPLATE/bug_report.yml"
- ".github/linters/**"
- ".gitattributes"
pull_request:
paths:
- "app/resources/**"
- "app/tools/**"
- "app/Cargo.toml"
- "build.cmd"
- "LICENSE"
- "playbook/**"
- "tools/**"
- "tests/**"
- "docs/catalog/**"
- ".github/workflows/**"
- ".github/ISSUE_TEMPLATE/bug_report.yml"
- ".github/linters/**"
- ".gitattributes"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout code
# gh api repos/actions/checkout/commits/v7.0.0 --jq '.sha'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Windows PowerShell 5.1 parse gate
# The scripts that run on users' PCs use Windows PowerShell 5.1; this catches
# PowerShell-7-only syntax before release. Includes .psd1 so a broken tweak
# definition or module manifest cannot be released and fail (or get skipped) at runtime.
shell: powershell
run: |
$failed = $false
Get-ChildItem -Path 'playbook','app/resources' -Recurse -Include '*.ps1','*.psm1','*.psd1' | ForEach-Object {
$tokens = $null
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile($_.FullName, [ref]$tokens, [ref]$errors) | Out-Null
if ($errors) {
$failed = $true
foreach ($parseError in $errors) {
Write-Host "::error file=$($_.FullName),line=$($parseError.Extent.StartLineNumber)::$($parseError.Message)"
}
}
}
if ($failed) { exit 1 }
Write-Host "All Atlas and app resource scripts parse under Windows PowerShell 5.1."
- name: Install Pester
shell: pwsh
run: |
# Pinned for reproducible results
if (-not (Get-Module -ListAvailable Pester | Where-Object Version -eq '5.7.1')) {
Install-Module -Name Pester -RequiredVersion 5.7.1 -Force -Scope CurrentUser
}
- name: Test PowerShell 7 build tooling
shell: pwsh
run: |
Import-Module Pester -RequiredVersion 5.7.1
$config = New-PesterConfiguration
$config.Run.Path = @('tests\AtlasBuild.Tests.ps1', 'app\tools\tests')
$config.Run.Exit = $true
$config.Output.Verbosity = 'Normal'
Invoke-Pester -Configuration $config
- name: Install Pester (Windows PowerShell 5.1)
shell: powershell
run: |
# Pinned for reproducible results; -SkipPublisherCheck because the inbox
# Pester 3.4 signature differs from the gallery module's.
if (-not (Get-Module -ListAvailable Pester | Where-Object Version -eq '5.7.1')) {
Install-Module -Name Pester -RequiredVersion 5.7.1 -Force -Scope CurrentUser -SkipPublisherCheck
}
- name: Test the Windows PowerShell 5.1 scripts
shell: powershell
run: |
Import-Module Pester -RequiredVersion 5.7.1
$config = New-PesterConfiguration
$config.Run.Path = 'tests'
$config.Run.ExcludePath = (Resolve-Path 'tests\AtlasBuild.Tests.ps1').Path
$config.Run.Exit = $true
$config.Output.Verbosity = 'Normal'
Invoke-Pester -Configuration $config