-
Notifications
You must be signed in to change notification settings - Fork 28
156 lines (141 loc) · 4.59 KB
/
Copy pathtest.yml
File metadata and controls
156 lines (141 loc) · 4.59 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Testing
on:
push:
branches:
- "**"
paths:
- "**/*.py"
- "pyproject.toml"
- "uv.lock"
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: true
matrix:
include:
- os: windows-latest
name: windows-x64
- os: windows-11-arm
name: windows-arm
- os: ubuntu-latest
name: linux-x64
- os: ubuntu-24.04-arm
name: linux-arm64
- os: macos-latest
name: macos-arm64
- os: macos-15
name: macos-x64
runs-on: ${{ matrix.os }}
name: Test on (${{ matrix.name }})
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
with:
activate-environment: true
- name: Install dependencies
run: uv sync
- name: Run test with retry
id: test
shell: pwsh
run: |
$maxRetries = 5
$retryCount = 0
$success = $false
while ($retryCount -lt $maxRetries) {
Write-Host "Attempt $($retryCount + 1) of $maxRetries"
try {
uv run poe test -n 8
if ($LASTEXITCODE -ne 0) {
throw "Tests failed with exit code $LASTEXITCODE"
}
Write-Host "Tests passed!"
$success = $true
break
}
catch {
Write-Warning "Tests failed, retrying..."
$retryCount++
}
}
if (-not $success) {
Write-Error "Tests failed $maxRetries times in a row"
exit 1
}
"retry_count=$retryCount" >> $env:GITHUB_OUTPUT
- name: Upload retry info
if: success()
shell: pwsh
run: |
$retryCount = "${{ steps.test.outputs.retry_count }}"
if ([int]$retryCount -gt 0) {
New-Item -ItemType Directory -Force -Path retry-info | Out-Null
Set-Content -Path "retry-info/${{ matrix.name }}.txt" -Value "${{ matrix.name }} ($retryCount retries)"
}
- name: Upload retry artifact
if: success()
uses: actions/upload-artifact@v7
with:
name: retry-info-${{ matrix.name }}
path: retry-info/
if-no-files-found: ignore
retention-days: 1
- name: Alert if fail
if: failure()
uses: sarisia/actions-status-discord@v1.16.0
with:
webhook: ${{ secrets.LOG_HOOK }}
title: rovr tests failed on ${{ matrix.name }}!
status: failure
description: |
<:wazowski:1308074746772062248> Check the workflow [details](https://github.com/NSPC911/rovr/actions/runs/${{ github.run_id }}) for more info.
-# branch `${{ github.ref_name }}` (due to `${{ github.event_name }}`)
avatar_url: "https://avatars.githubusercontent.com/u/176916861?v=4"
username: "NSPBot911"
nodetail: true
notimestamp: true
noprefix: true
notify-test-completion:
needs: test
runs-on: ubuntu-slim
name: Notify Test Completion
steps:
- name: Download retry artifacts
uses: actions/download-artifact@v4
with:
pattern: retry-info-*
path: retry-info
merge-multiple: true
- name: Build retry description
id: retries
shell: pwsh
run: |
$files = Get-ChildItem -Path retry-info -Filter "*.txt" -ErrorAction SilentlyContinue | Sort-Object Name
if (-not $files) {
"description=" >> $env:GITHUB_OUTPUT
} else {
$lines = $files | ForEach-Object { "- " + (Get-Content $_.FullName) }
"description<<EOF" >> $env:GITHUB_OUTPUT
"Matrices that needed retries:" >> $env:GITHUB_OUTPUT
$lines >> $env:GITHUB_OUTPUT
"EOF" >> $env:GITHUB_OUTPUT
}
- name: Notify Discord - Tests Complete
uses: sarisia/actions-status-discord@v1.16.0
with:
webhook: ${{ secrets.LOG_HOOK }}
title: <:joe_ye:1308074319934525545> All tests passed!
status: success
description: |
${{ steps.retries.outputs.description }}
-# branch `${{ github.ref_name }}` (due to `${{ github.event_name }}`)
avatar_url: "https://avatars.githubusercontent.com/u/176916861?v=4"
username: "NSPBot911"
nodetail: true
notimestamp: true
noprefix: true