Skip to content

paste i think

paste i think #1156

Workflow file for this run

name: Testing
on:
push:
branches:
- "**"
paths:
- "**/*.py"
- "pyproject.toml"
- "uv.lock"
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: true
matrix:
python-version: ['3.13', '3.14']
runner:
- {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.runner.os }}
name: Test on (${{ matrix.runner.name }}, Python ${{ matrix.python-version }})
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- name: Install dependencies
shell: pwsh
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.runner.name }}-py${{ matrix.python-version }}.txt" -Value "${{ matrix.runner.name }} (Python ${{ matrix.python-version }}, $retryCount retries)"
}
- name: Upload retry artifact
if: success()
uses: actions/upload-artifact@v7
with:
name: retry-info-${{ matrix.runner.name }}-py${{ matrix.python-version }}
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.runner.name }} (Python ${{ matrix.python-version }})!
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