Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Python checks

on:
push:
branches: [ "main" ]
branches: [main]
pull_request:
branches: [ "main" ]
branches: [main]

permissions:
contents: read

jobs:
build:

runs-on: windows-latest
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
env:
QT_QPA_PLATFORM: offscreen

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if (Test-Path requirements.txt) { pip install -r requirements.txt }
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
# no test modules found, exit with code 0
if ($LASTEXITCODE -eq 5) { exit 0 }
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Linux Qt runtime libraries
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --yes libegl1 libgl1 libxkbcommon-x11-0
- name: Install project and development tools
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Lint
run: ruff check .
- name: Check formatting
run: ruff format --check .
- name: Test
run: python -m pytest
119 changes: 119 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: GitHub Release

on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: v-prefixed version to validate
required: true
type: string
publish:
description: Publish an existing tag after successful builds
required: true
default: false
type: boolean

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Check out tagged release
if: github.event_name == 'push' || inputs.publish
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Check out rehearsal source
if: github.event_name == 'workflow_dispatch' && !inputs.publish
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- name: Install Linux Qt runtime libraries
run: |
sudo apt-get update
sudo apt-get install --yes libegl1 libgl1 libxkbcommon-x11-0
- name: Install and test
run: |
python -m pip install -e ".[dev]"
ruff format --check .
ruff check .
QT_QPA_PLATFORM=offscreen python -m pytest
- name: Verify tag matches project version
run: python scripts/release.py verify-tag "${{ inputs.tag || github.ref_name }}"

build:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
asset: glint-windows-x86_64
archive: zip
- os: macos-14
asset: glint-macos-arm64
archive: zip
- os: macos-15-intel
asset: glint-macos-x86_64
archive: zip
- os: ubuntu-22.04
asset: glint-linux-x86_64
archive: gztar
runs-on: ${{ matrix.os }}
steps:
- name: Check out tagged release
if: github.event_name == 'push' || inputs.publish
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Check out rehearsal source
if: github.event_name == 'workflow_dispatch' && !inputs.publish
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- name: Install release tooling
run: python -m pip install -e ".[release]"
- name: Build native bundle
run: python scripts/release.py build --asset-name "${{ matrix.asset }}" --archive "${{ matrix.archive }}"
- name: Upload native bundle
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: dist-release/*
if-no-files-found: error
retention-days: 7

publish:
needs: build
if: github.event_name == 'push' || inputs.publish
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Download native bundles
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Generate checksums
run: python scripts/release.py checksums release-assets
- name: Publish GitHub Release
run: gh release create "$RELEASE_TAG" release-assets/* --verify-tag --generate-notes --latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
# Distribution / packaging
build/
dist/
dist-release/
*.egg-info/
*.egg

Expand Down
Loading
Loading