Refactor qt module, create ui manager class #1516
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
name: Build | |
on: | |
push: | |
tags: | |
- '*' | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
env: | |
PYTHON_VER: "3.11.9" | |
NAME: "BlackboardSync" | |
PRE_RELEASE: ${{ contains(github.ref_name, '-') }} | |
jobs: | |
test: | |
uses: ./.github/workflows/pytest.yml | |
with: | |
python-version: "3.11.9" | |
version: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
outputs: | |
code: ${{ steps.version-check.outputs.code }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- run: | | |
pip install --upgrade setuptools | |
pip install setuptools-scm | |
- id: version-check | |
run: echo "code=$(python -m setuptools_scm)" >> "$GITHUB_OUTPUT" | |
release-notes: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
outputs: | |
body: ${{ steps.extract-release-notes.outputs.release_notes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: extract-release-notes | |
uses: ffurrer2/extract-release-notes@v2 | |
with: | |
prerelease: ${{ env.PRE_RELEASE }} | |
package-prep: | |
needs: [ version ] | |
runs-on: ubuntu-latest | |
env: | |
VERSION: ${{ needs.version.outputs.code }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install jinja2 GitPython packaging | |
- name: Run jinja2 | |
run: python packaging/replace.py $VERSION | |
- run: cp LICENSE replaced | |
- run: cp packaging/windows/*.ico replaced | |
- run: cp packaging/linux/icon.svg replaced | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packaging | |
path: replaced/ | |
package-metadata: | |
needs: [ package-prep ] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Clone metadata repository | |
uses: actions/checkout@v4 | |
with: | |
repository: "sanjacob/app.bbsync.BlackboardSync.metadata" | |
ref: "master" | |
path: metadata | |
token: ${{ secrets.METADATA_PAT }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packaging | |
path: metadata | |
- run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
working-directory: metadata | |
- run: | | |
git add . | |
git commit -m "Generated from $GITHUB_REF_NAME" && git push origin HEAD || true | |
working-directory: metadata | |
- name: Create repository tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git tag $GITHUB_REF_NAME | |
git push --tags | |
working-directory: metadata | |
translations: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo apt install pyqt6-dev-tools | |
- run: lrelease blackboard_sync/qt/translations/*.ts | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: translations | |
path: blackboard_sync/qt/translations | |
pypi: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VER }} | |
- uses: sanjacob/pipenv-requirements@v1 | |
with: | |
from-pipfile: true | |
dev: true | |
- run: python -m build | |
- name: Deploy to PyPI | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
run: twine upload dist/* | |
flatpak: | |
needs: [ test, package-metadata ] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
env: | |
MATURIN_REF: v1.7.1 | |
SETUPTOOLS_RUST_REF: v1.10.1 | |
FLATHUB_BRANCH: ${{ contains(github.ref_name, '-') && 'beta' || 'master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: sanjacob/[email protected] | |
with: | |
flatpak-repo: 'sanjacob/app.bbsync.BlackboardSync' | |
flatpak-repo-branch: ${{ env.FLATHUB_BRANCH }} | |
flatpak-repo-secret: ${{ secrets.FLATHUB_PAT }} | |
use-pipfile: true | |
python-version: ${{ env.PYTHON_VER }} | |
maturin-version: ${{ env.MATURIN_REF }} | |
setuptools-rust-version: ${{ env.SETUPTOOLS_RUST_REF }} | |
- name: Fetch my-tools | |
run: | | |
mkdir my-tools | |
git clone https://gist.github.com/b0ed4ff1be1e4d13ac47e21132b92dbd.git my-tools | |
chmod +x my-tools/*.py | |
- name: Update other sources manually | |
run: | | |
../my-tools/*.py *.yml --update PyO3/maturin $MATURIN_REF | |
../my-tools/*.py *.yml --update pydantic/pydantic-core $PYDANTIC_CORE_REF | |
../my-tools/*.py *.yml --update sanjacob/BlackboardSync $GITHUB_REF_NAME | |
../my-tools/*.py *.yml --update sanjacob/app.bbsync.BlackboardSync.metadata $GITHUB_REF_NAME | |
working-directory: flathub | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: flatpak-repo | |
path: flathub | |
- if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
working-directory: flathub | |
- if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git add . | |
git commit -m "Generated from $GITHUB_REF_NAME" | |
git push origin HEAD | |
working-directory: flathub | |
pyinstaller: | |
needs: [ test ] | |
uses: ./.github/workflows/pyinstaller.yml | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, macos-14, windows-latest] | |
with: | |
python-version: "3.11.9" | |
runs-on: ${{ matrix.os }} | |
package-windows: | |
needs: [ pyinstaller, version, package-prep ] | |
runs-on: windows-latest | |
env: | |
BUILD_SCRIPT: "packaging/pkg_win.nsi" | |
VERSION: ${{ needs.version.outputs.code }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packaging | |
path: ./packaging | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-windows-latest | |
- run: tar -xvf build.tar | |
- name: Create windows installer | |
uses: joncloud/[email protected] | |
with: | |
script-file: ${{ env.BUILD_SCRIPT }} | |
arguments: "/V3 /DVERSION=${{ env.VERSION }}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: package-windows-latest | |
path: dist/*.exe | |
package-macos: | |
needs: [ pyinstaller, version, package-prep ] | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, macos-14] | |
env: | |
BUILD_SCRIPT: "packaging/pkg_macos.sh" | |
VERSION: ${{ needs.version.outputs.code }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: packaging | |
path: ./packaging | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ format('build-{0}', matrix.os) }} | |
- run: tar -xvf build.tar | |
- name: Import signing certificate | |
if: github.event_name == 'push' | |
uses: apple-actions/import-codesign-certs@v3 | |
with: | |
p12-file-base64: ${{ secrets.BB_P12 }} | |
p12-password: ${{ secrets.BB_P12_PASSWORD }} | |
- name: Sign and Package into DMG | |
env: | |
ARCH: ${{ matrix.os == 'macos-12' && 'x86_64' || 'arm64' }} | |
run: | | |
chmod +x $BUILD_SCRIPT | |
$BUILD_SCRIPT "blackboard_sync-$VERSION_$ARCH" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ format('package-{0}', matrix.os) }} | |
path: dist/*.dmg | |
gh-release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [ package-windows, package-macos, release-notes ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
RELEASE_NOTES: ${{ needs.release-notes.outputs.body }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ./dist | |
pattern: package-* | |
merge-multiple: true | |
- uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{ env.RELEASE_NOTES }} | |
prerelease: ${{ env.PRE_RELEASE }} | |
files: | | |
dist/*.exe | |
dist/*.dmg | |
pr-comment: | |
if: ${{ github.event_name == 'pull_request' }} | |
needs: [ package-windows, package-macos ] | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
env: | |
ACTION_RUNS: https://github.com/sanjacob/BlackboardSync/actions/runs/ | |
steps: | |
- uses: mshick/add-pr-comment@v2 | |
continue-on-error: true | |
with: | |
message: > | |
The build process has succeeded. | |
Please test either `package-macos-12` (x86_64), | |
`package-macos-14` (arm64), or `package-windows-latest`. | |
You can find them | |
[here](${{ format('{0}{1}', env.ACTION_RUNS, github.run_id) }}) | |
at the bottom of the page. | |
Let me know if everything seems fine. |