Skip to content

Commit d48f7af

Browse files
committed
Refactor script
1 parent 1e5f33f commit d48f7af

1 file changed

Lines changed: 34 additions & 25 deletions

File tree

.github/actions/tool-tests/action.yml

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,44 @@ inputs:
1010
runs:
1111
using: "composite"
1212
steps:
13-
- name: Run tool tests
14-
shell: ${{ inputs.shell }}
13+
- name: Run tool tests on Windows
14+
if: inputs.shell == 'pwsh'
15+
shell: pwsh
1516
run: |
16-
if [ "${{ inputs.shell }}" = "pwsh" ]; then
17-
# Windows native execution
18-
Get-ChildItem -Path "plugins/tools" -Directory | ForEach-Object {
19-
$toolDir = $_.FullName
20-
$testDir = Join-Path $toolDir "test"
21-
if (Test-Path $testDir) {
22-
Write-Host "Running tests for $testDir..."
23-
& ./integration-tests/run.ps1 $testDir
24-
if ($LASTEXITCODE -ne 0) {
25-
Add-Content -Path "failed_tests.txt" -Value $testDir
26-
}
17+
Get-ChildItem -Path "plugins/tools" -Directory | ForEach-Object {
18+
$toolDir = $_.FullName
19+
$testDir = Join-Path $toolDir "test"
20+
if (Test-Path $testDir) {
21+
Write-Host "Running tests for $testDir..."
22+
& ./integration-tests/run.ps1 $testDir
23+
if ($LASTEXITCODE -ne 0) {
24+
Add-Content -Path "failed_tests.txt" -Value $testDir
2725
}
2826
}
29-
else
30-
# Unix/WSL execution
31-
chmod +x integration-tests/run.sh
32-
echo "" > failed_tests.txt
33-
for tool_dir in plugins/tools/*/test; do
34-
if [ -d "$tool_dir" ]; then
35-
echo "Running tests for $tool_dir..."
36-
if ! ./integration-tests/run.sh "$tool_dir"; then
37-
echo "$tool_dir" >> failed_tests.txt
38-
fi
27+
}
28+
29+
# Check if any tests failed
30+
if (Test-Path "failed_tests.txt" -PathType Leaf) {
31+
Write-Host "The following tests failed:"
32+
Get-Content "failed_tests.txt"
33+
exit 1
34+
}
35+
36+
- name: Run tool tests on Unix
37+
if: inputs.shell == 'bash'
38+
shell: bash
39+
run: |
40+
chmod +x integration-tests/run.sh
41+
echo "" > failed_tests.txt
42+
43+
for tool_dir in plugins/tools/*/test; do
44+
if [ -d "$tool_dir" ]; then
45+
echo "Running tests for $tool_dir..."
46+
if ! ./integration-tests/run.sh "$tool_dir"; then
47+
echo "$tool_dir" >> failed_tests.txt
3948
fi
40-
done
41-
fi
49+
fi
50+
done
4251
4352
# Check if any tests failed
4453
if [ -s failed_tests.txt ]; then

0 commit comments

Comments
 (0)