quicktex/.github/workflows/python-package.yml

122 lines
3.7 KiB
YAML
Raw Normal View History

2021-04-08 00:26:38 +00:00
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python Package
2021-04-14 03:48:19 +00:00
on: [ push, pull_request ]
2021-04-08 00:26:38 +00:00
jobs:
test:
2021-04-08 04:01:39 +00:00
runs-on: ${{ matrix.os }}
2021-04-08 00:26:38 +00:00
strategy:
matrix:
2021-04-08 01:42:45 +00:00
python-version: [ 3.7, 3.8, 3.9 ]
2021-04-12 22:31:14 +00:00
os: [ macos-latest, windows-latest, ubuntu-latest ]
2021-04-08 00:26:38 +00:00
steps:
2021-04-08 01:42:45 +00:00
- uses: actions/checkout@v2
with:
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
submodules: 'true'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
2021-04-12 22:31:14 +00:00
- name: Install libomp
2021-04-08 05:33:25 +00:00
if: runner.os == 'macOS'
# openMP isnt part of core apple clang for some reason?
run: brew install libomp
2021-04-08 05:33:25 +00:00
2021-04-08 01:42:45 +00:00
- name: Install dependencies
run: |
python -m pip install --upgrade pip
2021-04-14 03:48:19 +00:00
python -m pip install flake8
2021-04-08 01:42:45 +00:00
- name: Install test images
run: git clone https://git.pileof.rocks/drewcassidy/quicktex-test-images.git tests/images
2021-04-08 01:42:45 +00:00
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Compile and install
2021-04-14 03:48:19 +00:00
run: python -m pip install -e .[tests]
2021-04-08 01:42:45 +00:00
- name: Test with nose
2021-04-08 04:10:58 +00:00
run: nosetests tests -d
2021-04-12 22:31:14 +00:00
2021-04-12 22:57:06 +00:00
build:
2021-04-12 22:31:14 +00:00
needs: test
2021-05-09 01:12:37 +00:00
if: github.event_name == 'push'
2021-04-12 22:31:14 +00:00
runs-on: ${{ matrix.os }}
2021-04-13 03:56:51 +00:00
env:
2021-04-13 04:02:21 +00:00
MACOSX_DEPLOYMENT_TARGET: 10.15
2021-04-13 03:56:51 +00:00
2021-04-12 22:31:14 +00:00
steps:
- uses: actions/checkout@v2
with:
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
submodules: 'true'
- name: Install libomp
if: runner.os == 'macOS'
# openMP isnt part of core apple clang for some reason?
run: brew install libomp
2021-05-09 01:12:37 +00:00
- name: Build wheels
uses: joerick/cibuildwheel@v1.11.0
env:
CIBW_BUILD: { cp,pp }{ 37,38,39 }-*
CIBW_SKIP: "*-win32 *-manylinux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
2021-04-12 22:31:14 +00:00
2021-04-12 22:57:06 +00:00
- name: Upload wheel as artifact
uses: actions/upload-artifact@v2
2021-04-12 22:31:49 +00:00
with:
2021-04-12 22:57:06 +00:00
name: dist
2021-05-09 01:12:37 +00:00
path: ./wheelhouse/*.whl
2021-04-12 22:31:14 +00:00
2021-04-12 22:57:06 +00:00
publish:
needs: build
2021-04-13 03:56:51 +00:00
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
2021-04-12 22:31:14 +00:00
runs-on: ubuntu-latest
steps:
2021-04-12 23:45:34 +00:00
- uses: actions/checkout@v2
with:
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
submodules: 'true'
2021-04-12 22:31:14 +00:00
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
2021-04-12 22:57:06 +00:00
- name: Download artifacts
uses: actions/download-artifact@v2
- name: List artifacts
run: ls -l dist
2021-04-12 22:31:14 +00:00
- name: Install dependencies
run: |
python -m pip install --upgrade pip
2021-04-14 03:32:56 +00:00
python -m pip install setuptools wheel twine build
2021-04-12 22:31:14 +00:00
- name: Build a source tarball
run: python -m build --sdist --outdir dist/
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2021-04-12 22:31:49 +00:00
with:
2021-04-12 22:31:14 +00:00
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/