-
-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1614 from mhsmith/workflows
Update release workflow
- Loading branch information
Showing
385 changed files
with
302 additions
and
299 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,72 +4,64 @@ on: | |
push: | ||
branches: | ||
- main | ||
workflow_call: | ||
|
||
env: | ||
min_python_version: "3.7" | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
beefore: | ||
name: Pre-test checks | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
task: | ||
- flake8 | ||
# - towncrier-check | ||
- docs | ||
- package | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: "3.7" | ||
python-version: ${{ env.min_python_version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install tox | ||
- name: Run pre-test checks | ||
run: | | ||
tox -e ${{ matrix.task }} | ||
- run: tox -e ${{ matrix.task }} | ||
|
||
smoke: | ||
name: Smoke test (3.7) | ||
needs: | ||
- beefore | ||
package: | ||
needs: beefore | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: "3.7" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install --upgrade tox | ||
- name: Test | ||
run: | | ||
tox -e py | ||
- name: Check coverage | ||
uses: codecov/codecov-action@v1 | ||
python-version: ${{ env.min_python_version }} | ||
- run: pip install tox | ||
- run: tox -e package | ||
- name: Collect packages | ||
run: | | ||
mkdir packages | ||
mv {.,demo,src/*}/dist/* packages | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
flags: unittests | ||
fail_ci_if_error: true | ||
name: packages | ||
path: packages | ||
if-no-files-found: error | ||
|
||
python-versions: | ||
# Only run this and subsequent steps on branches. | ||
# `github.head_ref` only exists on pull requests. | ||
if: github.head_ref | ||
name: Python compatibility test | ||
needs: smoke | ||
runs-on: ubuntu-latest | ||
core: | ||
needs: package | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"] | ||
platform: ['macos', 'ubuntu', 'windows'] | ||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-alpha - 3.11.0"] | ||
runs-on: ${{ matrix.platform }}-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
|
@@ -81,152 +73,68 @@ jobs: | |
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install --upgrade tox | ||
- name: Get packages | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: packages | ||
path: packages | ||
- name: Test | ||
env: | ||
TOGA_INSTALL_COMMAND: 'bash -c "pip install packages/toga_{core,dummy}*.whl"' | ||
run: | | ||
tox -e py | ||
- if: matrix.platform == 'ubuntu' && matrix.python-version == env.min_python_version | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
flags: unittests | ||
fail_ci_if_error: true | ||
|
||
windows: | ||
name: Winforms backend tests | ||
needs: python-versions | ||
runs-on: windows-latest | ||
backend: | ||
needs: package | ||
strategy: | ||
matrix: | ||
backend: [android, cocoa, gtk, iOS, web, winforms] | ||
include: | ||
- runs-on: ubuntu-latest | ||
- python-version: "3.7" # Should be env.min_python_version (https://github.com/actions/runner/issues/480) | ||
- pre-command: | ||
- test-command: pytest | ||
- backend: cocoa | ||
runs-on: macos-latest | ||
- backend: gtk | ||
pre-command: "sudo apt-get update -y && sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config" | ||
test-command: "xvfb-run -a -s '-screen 0 2048x1536x24' pytest" | ||
- backend: iOS | ||
runs-on: macos-latest | ||
- backend: winforms | ||
runs-on: windows-latest | ||
# Py3.9 is the first Python version for which | ||
# a wheel of pythonnet isn't available on PyPI. | ||
python-version: "3.9" | ||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.9 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/[email protected] | ||
with: | ||
# Py3.9 is the first Python version for which | ||
# a wheel of pythonnet isn't available on PyPI. | ||
python-version: "3.9" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install pytest-tldr | ||
python -m pip install -e src/core | ||
python -m pip install -e src/dummy | ||
python -m pip install -e src/winforms | ||
- name: Test | ||
run: | | ||
cd src/winforms | ||
pytest | ||
- name: Core Test | ||
run: | | ||
cd src/core | ||
pytest | ||
macOS: | ||
name: macOS backend tests | ||
needs: python-versions | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.7" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install pytest-tldr | ||
python -m pip install -e src/core | ||
python -m pip install -e src/dummy | ||
python -m pip install -e src/cocoa | ||
- name: Test | ||
run: | | ||
cd src/cocoa | ||
pytest | ||
iOS: | ||
name: iOS backend tests | ||
needs: python-versions | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.7" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install pytest-tldr | ||
python -m pip install -e src/core | ||
python -m pip install -e src/dummy | ||
python -m pip install -e src/iOS | ||
- name: Test | ||
run: | | ||
cd src/iOS | ||
pytest | ||
gtk: | ||
name: GTK+ backend tests | ||
needs: python-versions | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.7" | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-dev libgirepository1.0-dev libcairo2-dev pkg-config | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install pytest-tldr | ||
python -m pip install -e src/core | ||
python -m pip install -e src/dummy | ||
python -m pip install -e src/gtk | ||
- name: Test | ||
run: | | ||
cd src/gtk | ||
xvfb-run -a -s '-screen 0 2048x1536x24' pytest | ||
android: | ||
name: Android backend tests | ||
needs: python-versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.7" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install pytest-tldr | ||
python -m pip install -e src/core | ||
python -m pip install -e src/dummy | ||
python -m pip install -e src/android | ||
- name: Test | ||
run: | | ||
cd src/android | ||
pytest | ||
web: | ||
name: Web backend tests | ||
needs: python-versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
python-version: ${{ matrix.python-version }} | ||
- name: Get packages | ||
uses: actions/download-artifact@v3 | ||
with: | ||
python-version: "3.7" | ||
name: packages | ||
path: packages | ||
- name: Install dependencies | ||
run: | | ||
${{ matrix.pre-command }} | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install pytest-tldr | ||
python -m pip install -e src/core | ||
python -m pip install -e src/dummy | ||
python -m pip install -e src/web | ||
python -m pip install packages/toga_{core,dummy,${{ matrix.backend }}}*.whl | ||
- name: Test | ||
run: | | ||
cd src/web | ||
pytest | ||
cd src/${{ matrix.backend }} | ||
${{ matrix.test-command }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: published | ||
|
||
jobs: | ||
deploy: | ||
strategy: | ||
matrix: | ||
package: ["toga", "toga_android", "toga_cocoa", "toga_core", "toga_demo", | ||
"toga_dummy", "toga_gtk", "toga_iOS", "toga_web", "toga_winforms"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get packages | ||
uses: dsaltares/[email protected] | ||
with: | ||
version: tags/${{ github.event.release.tag_name }} | ||
file: ${{ github.event.repository.name }}.* | ||
regex: true | ||
target: packages/ | ||
- name: Extract ${{ matrix.package }} | ||
run: | | ||
mkdir dist | ||
mv packages/$(echo ${{ matrix.package }} | sed 's/_/?/')-[0-9]* dist | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets[format('PYPI_PASSWORD_{0}', matrix.package)] }} |
Oops, something went wrong.