From dea6c6097eda2e7d51efe8c2eba1d2f701d96cc7 Mon Sep 17 00:00:00 2001 From: Sebastiano Romi Date: Mon, 5 Oct 2026 11:27:05 +0200 Subject: [PATCH] Streamline release preparation and cancel superseded CI runs --- .github/workflows/ci.yml | 5 ++ .github/workflows/cross-platform-ci.yml | 14 ++- .github/workflows/cross-platform-release.yml | 93 +++++++------------- cross_platform/requirements-ci.txt | 2 + 4 files changed, 50 insertions(+), 64 deletions(-) create mode 100644 cross_platform/requirements-ci.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df03022..ec37853 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,9 +8,14 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: validate: runs-on: windows-2022 + timeout-minutes: 15 steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/cross-platform-ci.yml b/.github/workflows/cross-platform-ci.yml index b033b8e..c93c928 100644 --- a/.github/workflows/cross-platform-ci.yml +++ b/.github/workflows/cross-platform-ci.yml @@ -8,6 +8,10 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: name: ${{ matrix.os }} / Python ${{ matrix.python }} @@ -17,6 +21,10 @@ jobs: os: [windows-2022, ubuntu-22.04] python: ['3.10', '3.12'] runs-on: ${{ matrix.os }} + timeout-minutes: 20 + env: + QT_QPA_PLATFORM: offscreen + PACE_CONTROLLER_DATA_DIR: ${{ runner.temp }}/pace-controller-data steps: - uses: actions/checkout@v6 @@ -24,7 +32,9 @@ jobs: with: python-version: ${{ matrix.python }} cache: pip - cache-dependency-path: cross_platform/requirements-dev.txt + cache-dependency-path: | + cross_platform/requirements*.txt + cross_platform/pyproject.toml - name: Install Linux Qt runtime libraries if: runner.os == 'Linux' @@ -34,7 +44,7 @@ jobs: - name: Install application and tests working-directory: cross_platform - run: python -m pip install -e . -r requirements-dev.txt + run: python -m pip install -e . -r requirements-ci.txt - name: Compile and test working-directory: cross_platform diff --git a/.github/workflows/cross-platform-release.yml b/.github/workflows/cross-platform-release.yml index 25213ea..54b55fe 100644 --- a/.github/workflows/cross-platform-release.yml +++ b/.github/workflows/cross-platform-release.yml @@ -18,54 +18,14 @@ concurrency: cancel-in-progress: false jobs: - screenshot: - name: Render real PySide6 screenshot - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v6 - with: - ref: main - fetch-depth: 0 - - - uses: actions/setup-python@v6 - with: - python-version: '3.12' - cache: pip - cache-dependency-path: cross_platform/requirements.txt - - - name: Install Qt runtime libraries - run: | - sudo apt-get update - sudo apt-get install -y libegl1 libgl1 libxkbcommon0 libxkbcommon-x11-0 libdbus-1-3 libfontconfig1 libxcb-cursor0 libxcb-xkb1 libxcb-image0 libxcb-icccm4 libxcb-render-util0 libxcb-keysyms1 libxcb-shape0 libxcb-randr0 libxcb-xfixes0 - - - name: Render and validate the current real interface - working-directory: cross_platform - env: - QT_QPA_PLATFORM: offscreen - PACE_CONTROLLER_DATA_DIR: ${{ runner.temp }}/pace-controller-data - run: | - python -m pip install . - python -m pace_controller --language en --screenshot docs/pace_controller_gui.png - python -c "from PySide6.QtGui import QImage; i=QImage('docs/pace_controller_gui.png'); assert not i.isNull() and i.width() >= 1000 and i.height() >= 700, (i.width(), i.height())" - - - name: Commit the real screenshot - shell: bash - run: | - set -euo pipefail - git config user.name 'github-actions[bot]' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git add cross_platform/docs/pace_controller_gui.png - if ! git diff --cached --quiet; then - git commit -m 'Update real cross-platform interface screenshot [skip ci]' - git fetch origin main - git rebase origin/main - git push origin HEAD:main - fi - prepare: if: github.actor != 'github-actions[bot]' || github.event_name == 'workflow_dispatch' - needs: screenshot runs-on: ubuntu-24.04 + timeout-minutes: 30 + env: + QT_QPA_PLATFORM: offscreen + PACE_CONTROLLER_DATA_DIR: ${{ runner.temp }}/pace-controller-data + PYTHONPATH: cross_platform/src outputs: version: ${{ steps.prepare.outputs.version }} commit_sha: ${{ steps.commit.outputs.commit_sha }} @@ -79,23 +39,15 @@ jobs: with: python-version: '3.12' cache: pip - cache-dependency-path: cross_platform/requirements-dev.txt + cache-dependency-path: | + cross_platform/requirements*.txt + cross_platform/pyproject.toml - name: Install test and manual dependencies run: | sudo apt-get update sudo apt-get install -y pandoc texlive-xetex texlive-latex-extra texlive-fonts-recommended libegl1 libgl1 libxkbcommon0 libxkbcommon-x11-0 libdbus-1-3 libfontconfig1 libxcb-cursor0 libxcb-xkb1 libxcb-image0 libxcb-icccm4 libxcb-render-util0 libxcb-keysyms1 libxcb-shape0 libxcb-randr0 libxcb-xfixes0 - python -m pip install -r cross_platform/requirements-dev.txt - - - name: Validate source before release - env: - QT_QPA_PLATFORM: offscreen - PACE_CONTROLLER_DATA_DIR: ${{ runner.temp }}/pace-controller-data - run: | - python tests/test_project.py - python -m pytest -q cross_platform/tests - python -m compileall -q cross_platform/src - python -c "from pathlib import Path; import hashlib; data=Path('PACE_Controller.ps1').read_bytes().replace(b'\r\n', b'\n'); assert hashlib.sha256(data).hexdigest() == 'aa6ffe5431dfab7d2ea998f9b59e8ac5163b0e3478e84a3c15e2e826fb356b8e'" + python -m pip install -r cross_platform/requirements-ci.txt - name: Prepare semantic version and metadata id: prepare @@ -104,6 +56,11 @@ jobs: echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "Preparing PACE Controller v$VERSION" + - name: Render and validate the versioned interface + run: | + python -m pace_controller --language en --screenshot cross_platform/docs/pace_controller_gui.png + python -c "from PySide6.QtGui import QImage; i=QImage('cross_platform/docs/pace_controller_gui.png'); assert not i.isNull() and i.width() >= 1000 and i.height() >= 700, (i.width(), i.height())" + - name: Build versioned PDF manual run: | pandoc cross_platform/docs/PACE_Controller_Manual.md \ @@ -118,9 +75,9 @@ jobs: VERSION="${{ steps.prepare.outputs.version }}" python tests/test_project.py python -m pytest -q cross_platform/tests + python -m compileall -q cross_platform/src python - <<'PY' from pathlib import Path - import re version = "${{ steps.prepare.outputs.version }}" init = Path("cross_platform/src/pace_controller/__init__.py").read_text(encoding="utf-8") @@ -142,8 +99,6 @@ jobs: git add README.md CITATION.cff CHANGELOG.md cross_platform if ! git diff --cached --quiet; then git commit -m "Prepare cross-platform v${VERSION} release" - git fetch origin main - git rebase origin/main git push origin HEAD:main fi echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" @@ -164,6 +119,7 @@ jobs: name: Windows executable (x86_64) needs: prepare runs-on: windows-2022 + timeout-minutes: 30 steps: - uses: actions/checkout@v6 with: @@ -173,7 +129,9 @@ jobs: with: python-version: '3.12' cache: pip - cache-dependency-path: cross_platform/requirements-dev.txt + cache-dependency-path: | + cross_platform/requirements*.txt + cross_platform/pyproject.toml - name: Build standalone executable shell: powershell @@ -192,11 +150,14 @@ jobs: name: pace-controller-windows path: cross_platform/dist/PACE-Controller-v${{ needs.prepare.outputs.version }}-Windows-x86_64.exe if-no-files-found: error + compression-level: 0 + retention-days: 7 linux-exe: name: Linux executable (x86_64) needs: prepare runs-on: ubuntu-22.04 + timeout-minutes: 30 steps: - uses: actions/checkout@v6 with: @@ -206,7 +167,9 @@ jobs: with: python-version: '3.12' cache: pip - cache-dependency-path: cross_platform/requirements-dev.txt + cache-dependency-path: | + cross_platform/requirements*.txt + cross_platform/pyproject.toml - name: Install Linux build libraries run: | @@ -229,11 +192,14 @@ jobs: name: pace-controller-linux path: cross_platform/dist/PACE-Controller-v${{ needs.prepare.outputs.version }}-Linux-x86_64.tar.gz if-no-files-found: error + compression-level: 0 + retention-days: 7 source-package: name: Source archive and manual needs: prepare runs-on: ubuntu-24.04 + timeout-minutes: 10 steps: - uses: actions/checkout@v6 with: @@ -261,11 +227,14 @@ jobs: PACE-Controller-v${{ needs.prepare.outputs.version }}-source.zip PACE_Controller_Manual.pdf if-no-files-found: error + compression-level: 0 + retention-days: 7 publish: name: Publish GitHub release needs: [prepare, windows-exe, linux-exe, source-package] runs-on: ubuntu-24.04 + timeout-minutes: 10 steps: - uses: actions/download-artifact@v7 with: diff --git a/cross_platform/requirements-ci.txt b/cross_platform/requirements-ci.txt new file mode 100644 index 0000000..31c406a --- /dev/null +++ b/cross_platform/requirements-ci.txt @@ -0,0 +1,2 @@ +-r requirements.txt +pytest==8.3.5