ci: move lint.yml to .gitea/workflows so Gitea Actions discovers it
Gitea Actions only scans .gitea/workflows/ and .github/workflows/. The file under gitea/workflows/ (no leading dot) was never picked up. Other files in gitea/workflows/ remain as templates copied into consumer repos.
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
# PSScriptAnalyzer lint — runs on every push/PR that touches PowerShell files.
|
||||
# Requires PSScriptAnalyzer installed on the runner host:
|
||||
# Install-Module PSScriptAnalyzer -Scope AllUsers -Force
|
||||
#
|
||||
# Failures block the PR. Fix warnings with:
|
||||
# Invoke-ScriptAnalyzer -Path scripts\ -Recurse -Fix
|
||||
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.ps1'
|
||||
- '**.psm1'
|
||||
- '**.py'
|
||||
- 'pyproject.toml'
|
||||
- '.gitea/workflows/lint.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.ps1'
|
||||
- '**.psm1'
|
||||
- '**.py'
|
||||
- 'pyproject.toml'
|
||||
- '.gitea/workflows/lint.yml'
|
||||
|
||||
jobs:
|
||||
pssa:
|
||||
runs-on: windows-build
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run PSScriptAnalyzer
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if (-not (Get-Module -ListAvailable PSScriptAnalyzer)) {
|
||||
Write-Host "Installing PSScriptAnalyzer..."
|
||||
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force -AllowClobber
|
||||
}
|
||||
|
||||
$paths = @('scripts', 'template', 'runner', 'Setup-Host.ps1')
|
||||
$results = $paths | ForEach-Object {
|
||||
if (Test-Path $_) {
|
||||
Invoke-ScriptAnalyzer -Path $_ -Recurse -Severity Error,Warning
|
||||
}
|
||||
}
|
||||
|
||||
if ($results) {
|
||||
$results | Format-Table -AutoSize
|
||||
Write-Error "PSScriptAnalyzer found $($results.Count) issue(s). Fix before merging."
|
||||
exit 1
|
||||
}
|
||||
else {
|
||||
Write-Host "PSScriptAnalyzer: no issues found."
|
||||
}
|
||||
|
||||
python:
|
||||
runs-on: windows-build
|
||||
timeout-minutes: 15
|
||||
|
||||
env:
|
||||
PYTHONIOENCODING: utf-8
|
||||
VENV_DIR: F:\CI\python\venv
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Setup venv + install package
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$py = (Get-Command python -ErrorAction Stop).Source
|
||||
if (-not (Test-Path "$env:VENV_DIR\Scripts\python.exe")) {
|
||||
Write-Host "Creating venv at $env:VENV_DIR"
|
||||
& $py -m venv $env:VENV_DIR
|
||||
if ($LASTEXITCODE -ne 0) { throw "venv creation failed" }
|
||||
}
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m pip install --upgrade pip
|
||||
if ($LASTEXITCODE -ne 0) { throw "pip upgrade failed" }
|
||||
& $venvPy -m pip install -e ".[dev]"
|
||||
if ($LASTEXITCODE -ne 0) { throw "pip install failed" }
|
||||
|
||||
- name: ruff
|
||||
shell: powershell
|
||||
run: |
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m ruff check src tests/python
|
||||
if ($LASTEXITCODE -ne 0) { throw "ruff failed" }
|
||||
|
||||
- name: mypy --strict
|
||||
shell: powershell
|
||||
run: |
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m mypy --strict src
|
||||
if ($LASTEXITCODE -ne 0) { throw "mypy failed" }
|
||||
|
||||
- name: pytest (coverage >= 70%)
|
||||
shell: powershell
|
||||
run: |
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m pytest tests/python --cov=ci_orchestrator --cov-fail-under=70
|
||||
if ($LASTEXITCODE -ne 0) { throw "pytest failed" }
|
||||
Reference in New Issue
Block a user