Skip to content

Commit 33a13f1

Browse files
authored
Deprecate python 3.6 and 3.7, migrate to poetry, add MacOS test target (#93)
* Deprecate python 3.6 and python 3.7 * Add MacOS to the test matrix * Migrate from Pipenv to poetry
1 parent fc75340 commit 33a13f1

18 files changed

+868
-360
lines changed

Diff for: .flake8

-3
This file was deleted.

Diff for: .github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "pip"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
8+
# disable version updates for dependencies
9+
open-pull-requests-limit: 0
10+
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"

Diff for: .github/workflows/main.yml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
branches:
10+
- '**'
11+
12+
concurrency:
13+
group: tests-${{ github.head_ref || github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
jobs:
17+
tests:
18+
name: ${{ matrix.os }} / ${{ matrix.python-version }}
19+
runs-on: ${{ matrix.image }}
20+
strategy:
21+
matrix:
22+
os: [Ubuntu, Windows, MacOS]
23+
python-version: ["3.8", "3.9", "3.10"]
24+
qt-version: ["pyside2", "pyside6", "pyqt5", "pyqt6"]
25+
include:
26+
- os: Ubuntu
27+
image: ubuntu-20.04
28+
- os: Windows
29+
image: windows-2022
30+
- os: MacOS
31+
image: macos-12
32+
fail-fast: false
33+
defaults:
34+
run:
35+
shell: bash
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Get full Python version
47+
id: full-python-version
48+
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
49+
50+
- name: Bootstrap poetry
51+
run: |
52+
curl -sSL https://install.python-poetry.org | python - -y
53+
54+
- name: Update Path
55+
if: ${{ matrix.os != 'Windows' }}
56+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
57+
58+
- name: Update Path for Windows
59+
if: ${{ matrix.os == 'Windows' }}
60+
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
61+
62+
- name: Enable long paths on Windows
63+
if: ${{ matrix.os == 'Windows' }}
64+
run: git config --system core.longpaths true
65+
66+
- name: Configure poetry
67+
run: poetry config virtualenvs.in-project true
68+
69+
- name: Setup cache
70+
uses: actions/cache@v3
71+
id: cache
72+
with:
73+
path: .venv
74+
key: venv-${{ runner.os }}-${{ matrix.qt-version }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
75+
76+
- name: Valdate cache
77+
if: steps.cache.outputs.cache-hit == 'true'
78+
run: |
79+
# `timeout` is not available on macOS, so we define a custom function.
80+
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
81+
82+
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
83+
timeout 10s poetry run pip --version || rm -rf .venv
84+
85+
- name: Check lock file
86+
run: poetry check --lock
87+
88+
- name: Install dependencies
89+
run: poetry install --with github-actions
90+
91+
# - name: Run mypy
92+
# run: poetry run mypy
93+
94+
- name: Install Qt
95+
run: poetry run pip install ${{ matrix.qt-version }}
96+
97+
- name: Install libxcb dependencies
98+
if: ${{ matrix.os == 'Ubuntu' }}
99+
env:
100+
DEBIAN_FRONTEND: noninteractive
101+
run: |
102+
sudo apt-get -qq update
103+
sudo apt-get -qq install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
104+
105+
- name: Run pytest
106+
uses: coactions/setup-xvfb@v1
107+
env:
108+
QT_API: ${{ matrix.qt-version }}
109+
with:
110+
run: poetry run pytest --cov qasync -v

Diff for: .github/workflows/publish.yml

-31
This file was deleted.

Diff for: .github/workflows/release.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.10"
23+
24+
- name: Install Poetry
25+
run: |
26+
curl -sSL https://install.python-poetry.org | python - -y
27+
28+
- name: Update PATH
29+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
30+
31+
- name: Build project for distribution
32+
run: poetry build
33+
34+
- name: Check Version
35+
id: check-version
36+
run: |
37+
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
38+
39+
- name: Create Release
40+
uses: ncipollo/release-action@v1
41+
with:
42+
artifacts: "dist/*"
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
draft: false
45+
prerelease: steps.check-version.outputs.prerelease == 'true'
46+
47+
- name: Publish to PyPI
48+
env:
49+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
50+
run: poetry publish

Diff for: .github/workflows/test.yml

-58
This file was deleted.

0 commit comments

Comments
 (0)