Switch from pre-commit.ci to autofix.ci + dprint, update shared configs #887
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions | |
name: Lint and build | |
on: | |
workflow_dispatch: # Allows manual builds | |
inputs: | |
excludeBuildNumber: | |
description: "Exclude build number" | |
required: true | |
default: false | |
type: boolean | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/lint-and-build.yml" | |
- "src/**" | |
- "scripts/**" | |
- "*.toml" | |
- "uv.lock" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/lint-and-build.yml" | |
- "src/**" | |
- "scripts/**" | |
- "*.toml" | |
- "uv.lock" | |
env: | |
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} | |
GITHUB_EXCLUDE_BUILD_NUMBER: ${{ inputs.excludeBuildNumber }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
Pyright: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
# Pyright is version and platform sensible | |
matrix: | |
os: [windows-latest, ubuntu-22.04] | |
python-version: ["3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up uv for Python ${{ matrix.python-version }} | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
python-version: ${{ matrix.python-version }} | |
- run: scripts/install.ps1 | |
shell: pwsh | |
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH | |
- name: Analysing the code with Pyright | |
uses: jakebailey/pyright-action@v2 | |
with: | |
version: PATH | |
working-directory: src/ | |
python-version: ${{ matrix.python-version }} | |
Build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
# Only the Python version we plan on shipping matters. | |
matrix: | |
os: [windows-latest, ubuntu-22.04] | |
python-version: ["3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
# region https://github.com/pyinstaller/pyinstaller/issues/9012 | |
- name: Set up uv for Python ${{ matrix.python-version }} | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
python-version: ${{ !startsWith(matrix.os, 'ubuntu') && matrix.python-version || null }} | |
- name: Set up Python for PyInstaller tk issue | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# endregion | |
- run: scripts/install.ps1 | |
shell: pwsh | |
- run: scripts/build.ps1 | |
shell: pwsh | |
- name: Add empty profile | |
run: echo "" > dist/settings.toml | |
- name: Extract AutoSplit version | |
id: autosplit_version | |
working-directory: src | |
run: | | |
$Env:AUTOSPLIT_VERSION=uv run python -c "import utils; print(utils.AUTOSPLIT_VERSION)" | |
echo "AUTOSPLIT_VERSION=$Env:AUTOSPLIT_VERSION" >> $Env:GITHUB_OUTPUT | |
shell: pwsh | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: > | |
AutoSplit v${{ steps.autosplit_version.outputs.AUTOSPLIT_VERSION }} | |
for ${{ matrix.os }} (Python ${{ matrix.python-version }}) | |
path: | | |
dist/AutoSplit* | |
dist/settings.toml | |
if-no-files-found: error | |
- name: Upload Build logs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Build logs for ${{ matrix.os }} (Python ${{ matrix.python-version }}) | |
path: | | |
build/AutoSplit/*.toc | |
build/AutoSplit/*.txt | |
build/AutoSplit/*.html | |
if-no-files-found: error |