Skip to content

Add more development channels #1123

Add more development channels

Add more development channels #1123

# 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 }}
UV_NO_SYNC: true # Avoid accidentally pulling in dependency-groups with uv run
APPIMAGE_EXTRACT_AND_RUN: true # Avoid needing libfuse2
# https://github.com/opencv/opencv-python#source-distributions
# Allows building OpenCV on Windows ARM64
# https://github.com/opencv/opencv-python/issues/1092#issuecomment-2862538656
CMAKE_ARGS: "-DBUILD_opencv_dnn=OFF -DENABLE_NEON=OFF"
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:
# arm runner slower as long as opencv doesn't provide arm64 wheels
os: [windows-latest, ubuntu-latest]
python-version: ["3.14"]
steps:
- uses: actions/checkout@v6
- name: Set up uv for Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with Pyright
uses: jakebailey/pyright-action@v3
with:
version: PATH
working-directory: src/
python-version: ${{ matrix.python-version }}
PySentry:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uvx pysentry-rs --sources=pypa,pypi,osv --forbid-unmaintained
Build:
runs-on: ${{ matrix.os }}
outputs:
AUTOSPLIT_VERSION: ${{ steps.artifact_vars.outputs.AUTOSPLIT_VERSION }}
strategy:
fail-fast: false
# Only the Python version we plan on shipping matters.
matrix:
os: [windows-latest, windows-11-arm, ubuntu-22.04, ubuntu-22.04-arm]
python-version: ["3.14"]
wine-compat: [""]
include:
- os: windows-latest
python-version: "3.14"
wine-compat: "-WineCompat"
steps:
- uses: actions/checkout@v6
# https://github.com/astral-sh/uv/issues/12906#issuecomment-3587439179
- name: Set UV_PYTHON for ARM runners
if: ${{ endsWith(matrix.os, 'arm') }}
run: echo "UV_PYTHON=arm64" >> "$GITHUB_ENV"
# region https://github.com/pyinstaller/pyinstaller/issues/9204
- name: Set up Python for PyInstaller tk issue on Linux
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: actions/setup-python@v6
with:
allow-prereleases: true
python-version: ${{ matrix.python-version }}
- name: Set up uv for Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ !startsWith(matrix.os, 'ubuntu') && matrix.python-version || null }}
# endregion
- run: scripts/install.ps1 ${{ matrix.wine-compat }}
shell: pwsh
- run: "scripts/build.ps1 ${{ matrix.wine-compat }}"
shell: pwsh
- name: Add empty profile
run: echo "" > dist/settings.toml
- name: Extract AutoSplit version
id: artifact_vars
working-directory: src
run: | # This also serves as a sanity check for imports
$Env:AUTOSPLIT_VERSION=uv run python -c "import utils; print(utils.AUTOSPLIT_VERSION)"
echo "AUTOSPLIT_VERSION=$Env:AUTOSPLIT_VERSION" >> $Env:GITHUB_OUTPUT
echo "OS=$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)" >> $Env:GITHUB_OUTPUT
shell: pwsh
- name: Upload Build Artifact
uses: actions/upload-artifact@v6
with:
name: >
AutoSplit v${{ steps.artifact_vars.outputs.AUTOSPLIT_VERSION }} for ${{
steps.artifact_vars.outputs.OS }}${{ matrix.wine-compat }} (Python ${{
matrix.python-version }})
path: |
dist/AutoSplit*
dist/settings.toml
if-no-files-found: error
- name: Upload Build logs
uses: actions/upload-artifact@v6
with:
name: >
Build logs for ${{ steps.artifact_vars.outputs.OS }}${{ matrix.wine-compat }} (Python
${{ matrix.python-version }})
path: |
build/AutoSplit/*.toc
build/AutoSplit/*.txt
build/AutoSplit/*.html
if-no-files-found: error
Release-Template:
needs: Build
runs-on: ubuntu-latest
steps:
- name: Annotate release template URL
shell: pwsh
run: |
$version = "v${{ needs.Build.outputs.AUTOSPLIT_VERSION }}"
$body = [uri]::EscapeDataString(((@'
# Which Asset should I download?
- Python: This is the Python version bundled with AutoSplit. Try the newer version, it should be functionally identical, with a marginal performance boost. If you have any issue with it, please [report it here](https://github.com/Toufool/AutoSplit/issues) or on the Discord server and use an older Python version in the mean time.
- `arm64` vs `x64`: [Check your Processor Platform Architecture](https://www.checkadevice.com/tests/system/) (note that `x86_64` and `x64` means the same). If you're still unsure, `x64` will work either way. `arm64` should be more efficient.
- WineCompat: This is for running the Windows executable under Wine on Linux
'@).Trim() -replace "`n", ''))
# ^ Removing newline from template because GitHub will actually decode %0A
echo "::notice::${{ github.server_url }}/${{ github.repository }}/releases/new?target=main&tag=$version&title=$version&body=$body"