-
Notifications
You must be signed in to change notification settings - Fork 9
103 lines (98 loc) · 3.18 KB
/
Copy pathinstaller.yml
File metadata and controls
103 lines (98 loc) · 3.18 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
name: installer
on:
push:
branches: [main, installer]
paths:
- 'installer/**'
- 'tests/bats/**'
- 'tests/pester/**'
- '.github/workflows/installer.yml'
pull_request:
paths:
- 'installer/**'
- 'tests/bats/**'
- 'tests/pester/**'
- '.github/workflows/installer.yml'
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run shellcheck
run: |
shellcheck -x --severity=warning \
installer/agents.sh \
installer/main.sh \
installer/lib/*.sh \
installer/hosts/*.sh
agents-ps1-encoding:
# agents.ps1 is the entry point invoked via `irm | iex`. iex doesn't strip
# a leading BOM, and Windows PowerShell 5.1 chokes on non-ASCII chars in
# source unless they're behind a BOM. The combination means agents.ps1
# specifically must stay ASCII-only and BOM-free.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify agents.ps1 encoding
run: |
python3 - <<'PY'
import sys
raw = open('installer/agents.ps1', 'rb').read()
if raw[:3] == b'\xef\xbb\xbf':
sys.exit('agents.ps1 starts with a UTF-8 BOM — irm | iex cannot parse this on Windows.')
try:
raw.decode('ascii')
except UnicodeDecodeError as e:
sys.exit(f'agents.ps1 contains non-ASCII bytes around offset {e.start}; replace with ASCII (— -> --, → -> ->, … -> ...).')
PY
bats:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install bats
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt-get update && sudo apt-get install -y bats
else
brew install bats-core
fi
- name: Run bats tests
env:
NO_COLOR: "1"
run: bats tests/bats/
pester:
strategy:
fail-fast: false
matrix:
# `pwsh` exercises PowerShell 7+ on every OS (Linux/macOS/Windows).
# `powershell` exercises Windows PowerShell 5.1 — that's the default
# shell on a stock Windows box, and the one users get when they hit
# the Start menu and type "PowerShell". We need both to pass.
include:
- os: ubuntu-latest
shell: pwsh
- os: macos-latest
shell: pwsh
- os: windows-latest
shell: pwsh
- os: windows-latest
shell: powershell
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Pester
shell: ${{ matrix.shell }}
run: |
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser -AllowClobber
Get-Module -ListAvailable Pester | Select-Object -First 1 Name, Version
- name: Run Pester tests
shell: ${{ matrix.shell }}
env:
NO_COLOR: "1"
run: |
$result = Invoke-Pester -Path tests/pester/ -Output Detailed -PassThru
if ($result.FailedCount -gt 0) { exit 1 }