-
Notifications
You must be signed in to change notification settings - Fork 33
64 lines (56 loc) · 2.13 KB
/
pr-test-windows.yml
File metadata and controls
64 lines (56 loc) · 2.13 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
name: Windows Tests
on:
push:
paths:
- "providers/os/**"
- ".github/workflows/pr-test-windows.yml"
pull_request:
paths:
- "providers/os/**"
- ".github/workflows/pr-test-windows.yml"
permissions:
contents: read
jobs:
windows-test:
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Import environment variables from file
shell: bash
run: cat ".github/env" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: ">=${{ env.golang-version }}"
cache: false
- name: Find packages with Windows-specific tests
id: find-packages
shell: pwsh
run: |
# Find all _windows_test.go files and extract unique package directories
$packages = Get-ChildItem -Path providers/os -Recurse -Filter "*_windows_test.go" |
ForEach-Object { "./$($_.DirectoryName -replace '\\','/')/..." } |
Sort-Object -Unique
if ($packages.Count -eq 0) {
Write-Output "No Windows-specific test packages found"
echo "has_tests=false" >> $env:GITHUB_OUTPUT
} else {
$pkgList = $packages -join " "
Write-Output "Found Windows test packages: $pkgList"
echo "has_tests=true" >> $env:GITHUB_OUTPUT
echo "packages=$pkgList" >> $env:GITHUB_OUTPUT
}
- name: Run Windows-specific tests
if: steps.find-packages.outputs.has_tests == 'true'
shell: pwsh
run: |
$packages = "${{ steps.find-packages.outputs.packages }}" -split " "
go test -v @packages 2>&1 | Tee-Object -FilePath windows-test-output.txt
- name: Upload test output
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: steps.find-packages.outputs.has_tests == 'true' && (success() || failure())
with:
name: windows-test-output
path: windows-test-output.txt