Skip to content

Commit febb02f

Browse files
committed
ci: add Unix install script testing workkflow (#30)
1 parent c82bc06 commit febb02f

File tree

1 file changed

+56
-11
lines changed

1 file changed

+56
-11
lines changed

.github/workflows/test-install.yml

+56-11
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,49 @@ name: Test Installation Script
33
on:
44
push:
55
paths:
6-
- 'install.ps1'
7-
- '.github/workflows/test-install.yml'
6+
- "install.ps1"
7+
- "install.sh"
8+
- ".github/workflows/test-install.yml"
89
pull_request:
910
paths:
10-
- 'install.ps1'
11-
- '.github/workflows/test-install.yml'
11+
- "install.ps1"
12+
- "install.sh"
13+
- ".github/workflows/test-install.yml"
1214
release:
1315

1416
jobs:
15-
test-install:
17+
test-install-windows:
1618
runs-on: windows-latest
1719
strategy:
1820
fail-fast: false
19-
21+
2022
steps:
2123
- uses: actions/checkout@v3
2224

2325
- name: Run installation script
2426
run: |
2527
.\\install.ps1
2628
shell: powershell
27-
29+
2830
- name: Verify installation
2931
run: |
3032
# Check if envfetch directory exists
3133
$envfetchPath = "$env:APPDATA\envfetch"
3234
if (-not (Test-Path $envfetchPath)) {
3335
throw "envfetch directory not found"
3436
}
35-
37+
3638
# Check if executable exists
3739
if (-not (Test-Path "$envfetchPath\envfetch.exe")) {
3840
throw "envfetch.exe not found"
3941
}
40-
42+
4143
# Verify PATH
4244
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
4345
if ($userPath -notlike "*$envfetchPath*") {
4446
throw "envfetch not found in PATH"
4547
}
46-
48+
4749
# Try to run envfetch (this should at least not crash)
4850
$env:Path = [Environment]::GetEnvironmentVariable("Path", "User")
4951
$result = envfetch --version
@@ -55,4 +57,47 @@ jobs:
5557
- name: Cleanup
5658
run: |
5759
Remove-Item -Path "$env:APPDATA\envfetch" -Recurse -Force -ErrorAction SilentlyContinue
58-
shell: powershell
60+
shell: powershell
61+
62+
test-install-unix:
63+
runs-on: ${{ matrix.os }}
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
os: [ubuntu-latest, macos-latest]
68+
69+
steps:
70+
- uses: actions/checkout@v3
71+
72+
- name: Run installation script
73+
run: |
74+
chmod +x ./install.sh
75+
./install.sh
76+
shell: bash
77+
78+
- name: Verify installation
79+
run: |
80+
# Check if executable exists
81+
if [ ! -f "/usr/local/bin/envfetch" ]; then
82+
echo "envfetch not found in /usr/local/bin"
83+
exit 1
84+
fi
85+
86+
# Check if executable permissions are set
87+
if [ ! -x "/usr/local/bin/envfetch" ]; then
88+
echo "envfetch is not executable"
89+
exit 1
90+
fi
91+
92+
# Try to run envfetch
93+
result=$(envfetch --version)
94+
if [ $? -ne 0 ]; then
95+
echo "envfetch failed to run"
96+
exit 1
97+
fi
98+
shell: bash
99+
100+
- name: Cleanup
101+
run: |
102+
sudo rm -f /usr/local/bin/envfetch
103+
shell: bash

0 commit comments

Comments
 (0)