Version 2024.11.1 - Fix PyPI Source Distribution #2092
Workflow file for this run
This file contains 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
on: | |
push: | |
branches: [main] | |
pull_request: | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
python_version: '3.13' | |
name: CI | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ env.python_version }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v0.4.17 | |
with: | |
enable-cache: true | |
cache-dependency-glob: ".pre-commit-config.yaml" | |
- name: Install pre-commit | |
run: uv tool install pre-commit --with pre-commit-uv | |
- name: Lint with pre-commit | |
run: pre-commit run --show-diff-on-failure --color=always --all-files | |
- name: Check uv lock file integrity | |
run: uv lock --locked --offline | |
test: | |
needs: lint | |
name: Test with Python ${{ matrix.python-version }} | |
runs-on: windows-latest | |
timeout-minutes: 60 | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v0.4.17 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install the project | |
run: uv sync | |
- name: Install tox | |
run: uv tool install tox --with tox-uv | |
- name: Setup test suite | |
run: tox run --notest --skip-missing-interpreters false | |
- name: Run test suite | |
run: tox run --skip-pkg-install | |
build: | |
needs: lint | |
name: Build GTK${{ matrix.gtk-version }} Binaries | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
timeout-minutes: 75 | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
strategy: | |
matrix: | |
gtk-version: ['3', '4'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ env.python_version }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v0.4.17 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Seed pip | |
run: uv venv --seed | |
- name: Install the project | |
run: uv sync --no-dev | |
- name: Build GTK3 | |
if: matrix.gtk-version == '3' | |
run: > | |
uv run gvsbuild build --ninja-opts -j2 --enable-gi --py-wheel gtk3 gtksourceview4 graphene pygobject | |
adwaita-icon-theme glib-networking | |
- name: Build GTK4 | |
if: matrix.gtk-version == '4' | |
run: > # Use -j2 option to prevent out of memory errors with GitHub Action runners | |
uv run gvsbuild build --ninja-opts -j2 --enable-gi --py-wheel gtk4 libadwaita gtksourceview5 pygobject | |
adwaita-icon-theme gtkmm | |
- name: Copy wheel files | |
run: | | |
New-Item "C:\gtk-build\gtk\x64\release\wheels" -ItemType "directory" | |
Copy-Item (Resolve-Path C:\gtk-build\build\x64\release\pygobject\dist\PyGObject*.whl) "C:\gtk-build\gtk\x64\release\wheels" | |
Copy-Item (Resolve-Path C:\gtk-build\build\x64\release\pycairo\dist\pycairo*.whl) "C:\gtk-build\gtk\x64\release\wheels" | |
- name: Archive GTK runtime | |
run: 7z a -tzip GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.sha }}_x64.zip C:\gtk-build\gtk\x64\release\* | |
- name: Upload GTK${{ matrix.gtk-version }}_Gvsbuild-${{ github.sha }}_x64.zip | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.sha }}_x64.zip | |
path: GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.sha }}_x64.zip | |
- name: Upload Release Assets | |
if: github.event_name == 'release' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
mv GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.sha }}_x64.zip GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.event.release.tag_name }}_x64.zip | |
gh release upload ${{ github.event.release.tag_name }} "GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.event.release.tag_name }}_x64.zip" | |
- name: Cleanup Zip Files | |
if: github.event_name == 'release' | |
run: rm GTK${{ matrix.gtk-version }}_Gvsbuild_${{ github.event.release.tag_name }}_x64.zip | |
- name: Create Source Dist and Wheel | |
if: matrix.gtk-version == '4' | |
run: uv build | |
- name: Upload gvsbuild-${{ github.event.release.tag_name }}.tar.gz | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: github.event_name == 'release' && matrix.gtk-version == '4' | |
with: | |
name: gvsbuild-${{ github.event.release.tag_name }}.tar.gz | |
path: dist/gvsbuild-${{ github.event.release.tag_name }}.tar.gz | |
- name: Upload gvsbuild-${{ github.event.release.tag_name }}-py3-none-any.whl | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: github.event_name == 'release' && matrix.gtk-version == '4' | |
with: | |
name: gvsbuild-${{ github.event.release.tag_name }}-py3-none-any.whl | |
path: dist/gvsbuild-${{ github.event.release.tag_name }}-py3-none-any.whl | |
publish-to-pypi: | |
name: Publish to PyPI (release only) | |
needs: build | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
if: ${{ github.event_name == 'release' }} | |
steps: | |
- name: Download tar.gz | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: gvsbuild-${{ github.event.release.tag_name }}.tar.gz | |
path: dist | |
- name: Download wheel | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: gvsbuild-${{ github.event.release.tag_name }}-py3-none-any.whl | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # release/v1 |