|
1 | 1 | # This workflows will upload a Python Package using Twine when a release is created |
2 | 2 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
3 | 3 |
|
4 | | -#name: tests |
5 | | -# |
6 | | -#on: |
7 | | -# push: |
8 | | -# branches: |
9 | | -# - main |
10 | | -# - npe2 |
11 | | -# tags: |
12 | | -# - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
13 | | -# pull_request: |
14 | | -# branches: |
15 | | -# - main |
16 | | -# - npe2 |
17 | | -# workflow_dispatch: |
18 | | -# |
19 | | -#jobs: |
20 | | -# test: |
21 | | -# name: ${{ matrix.platform }} py${{ matrix.python-version }} |
22 | | -# runs-on: ${{ matrix.platform }} |
23 | | -# strategy: |
24 | | -# matrix: |
25 | | -# platform: [windows-latest] |
26 | | -# python-version: [3.8] |
27 | | -# |
28 | | -# steps: |
29 | | -# - uses: actions/checkout@v2 |
30 | | -# |
31 | | -# - name: Set up Python ${{ matrix.python-version }} |
32 | | -# uses: actions/setup-python@v2 |
33 | | -# with: |
34 | | -# python-version: ${{ matrix.python-version }} |
35 | | -# |
36 | | -# # these libraries enable testing on Qt on linux |
37 | | -# - uses: tlambert03/setup-qt-libs@v1 |
38 | | -# |
39 | | -# # strategy borrowed from vispy for installing opengl libs on windows |
40 | | -# - name: Install Windows OpenGL |
41 | | -# if: runner.os == 'Windows' |
42 | | -# run: | |
43 | | -# git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git |
44 | | -# powershell gl-ci-helpers/appveyor/install_opengl.ps1 |
45 | | -# |
46 | | -# # note: if you need dependencies from conda, considering using |
47 | | -# # setup-miniconda: https://github.com/conda-incubator/setup-miniconda |
48 | | -# # and |
49 | | -# # tox-conda: https://github.com/tox-dev/tox-conda |
50 | | -# - name: Install dependencies |
51 | | -# run: | |
52 | | -# python -m pip install --upgrade pip |
53 | | -# python -m pip install setuptools tox tox-gh-actions |
54 | | -# |
55 | | -# # this runs the platform-specific tests declared in tox.ini |
56 | | -# - name: Test with tox |
57 | | -# uses: GabrielBB/xvfb-action@v1 |
58 | | -# with: |
59 | | -# run: python -m tox |
60 | | -# env: |
61 | | -# PLATFORM: ${{ matrix.platform }} |
62 | | -# |
63 | | -# - name: Coverage |
64 | | -# uses: codecov/codecov-action@v2 |
65 | | -# |
66 | | -# deploy: |
67 | | -# # this will run when you have tagged a commit, starting with "v*" |
68 | | -# # and requires that you have put your twine API key in your |
69 | | -# # github secrets (see readme for details) |
70 | | -# needs: [test] |
71 | | -# runs-on: ubuntu-latest |
72 | | -# if: contains(github.ref, 'tags') |
73 | | -# steps: |
74 | | -# - uses: actions/checkout@v2 |
75 | | -# - name: Set up Python |
76 | | -# uses: actions/setup-python@v2 |
77 | | -# with: |
78 | | -# python-version: "3.8" |
79 | | -# - name: Install dependencies |
80 | | -# run: | |
81 | | -# python -m pip install --upgrade pip |
82 | | -# pip install -U setuptools setuptools_scm wheel twine build |
83 | | -# - name: Build and publish |
84 | | -# env: |
85 | | -# TWINE_USERNAME: __token__ |
86 | | -# TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} |
87 | | -# run: | |
88 | | -# git tag |
89 | | -# python -m build . |
90 | | -# twine upload dist/* |
91 | | -# |
| 4 | +name: tests |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - npe2 |
| 11 | + tags: |
| 12 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + - npe2 |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +jobs: |
| 20 | + test: |
| 21 | + name: ${{ matrix.platform }} py${{ matrix.python-version }} |
| 22 | + runs-on: ${{ matrix.platform }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + platform: [ubuntu-latest, windows-latest, macos-latest] |
| 26 | + python-version: [3.8, 3.9, "3.10"] |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: Set up Python ${{ matrix.python-version }} |
| 32 | + uses: actions/setup-python@v2 |
| 33 | + with: |
| 34 | + python-version: ${{ matrix.python-version }} |
| 35 | + |
| 36 | + # these libraries enable testing on Qt on linux |
| 37 | + - uses: tlambert03/setup-qt-libs@v1 |
| 38 | + |
| 39 | + # strategy borrowed from vispy for installing opengl libs on windows |
| 40 | + - name: Install Windows OpenGL |
| 41 | + if: runner.os == 'Windows' |
| 42 | + run: | |
| 43 | + git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git |
| 44 | + powershell gl-ci-helpers/appveyor/install_opengl.ps1 |
| 45 | + if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) {Exit 0} else {Exit 1} |
| 46 | +
|
| 47 | + # note: if you need dependencies from conda, considering using |
| 48 | + # setup-miniconda: https://github.com/conda-incubator/setup-miniconda |
| 49 | + # and |
| 50 | + # tox-conda: https://github.com/tox-dev/tox-conda |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + python -m pip install setuptools tox tox-gh-actions |
| 55 | +
|
| 56 | + # this runs the platform-specific tests declared in tox.ini |
| 57 | + - name: Test with tox |
| 58 | + uses: GabrielBB/xvfb-action@v1 |
| 59 | + with: |
| 60 | + run: python -m tox |
| 61 | + env: |
| 62 | + PLATFORM: ${{ matrix.platform }} |
| 63 | + |
| 64 | + - name: Coverage |
| 65 | + uses: codecov/codecov-action@v2 |
| 66 | + |
| 67 | + deploy: |
| 68 | + # this will run when you have tagged a commit, starting with "v*" |
| 69 | + # and requires that you have put your twine API key in your |
| 70 | + # github secrets (see readme for details) |
| 71 | + needs: [test] |
| 72 | + runs-on: ubuntu-latest |
| 73 | + if: contains(github.ref, 'tags') |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v2 |
| 76 | + - name: Set up Python |
| 77 | + uses: actions/setup-python@v2 |
| 78 | + with: |
| 79 | + python-version: "3.x" |
| 80 | + - name: Install dependencies |
| 81 | + run: | |
| 82 | + python -m pip install --upgrade pip |
| 83 | + pip install -U setuptools setuptools_scm wheel twine build |
| 84 | + - name: Build and publish |
| 85 | + env: |
| 86 | + TWINE_USERNAME: __token__ |
| 87 | + TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} |
| 88 | + run: | |
| 89 | + git tag |
| 90 | + python -m build . |
| 91 | + twine upload dist/* |
0 commit comments