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

137 lines
4.2 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:
2021-05-09 06:06:13 +00:00
build-sdist:
name: Build SDist
runs-on: ubuntu-latest
2021-04-08 00:26:38 +00:00
steps:
- uses: actions/checkout@v3
2021-04-08 01:42:45 +00:00
with:
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
submodules: 'true'
2021-05-09 06:06:13 +00:00
- name: Set up Python
2021-04-08 01:42:45 +00:00
uses: actions/setup-python@v2
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-05-09 06:06:13 +00:00
python -m pip install setuptools twine build
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
2021-05-09 06:06:13 +00:00
- name: Build SDist
run: python -m build --sdist
2021-04-08 01:42:45 +00:00
2021-05-09 06:06:13 +00:00
- name: Check metadata
2021-05-09 06:07:37 +00:00
run: python -m twine check dist/*
2021-04-12 22:31:14 +00:00
2021-05-09 06:06:13 +00:00
- name: Upload SDist
uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
build-wheels:
name: Build Wheels for ${{ matrix.os }}
2021-04-12 22:31:14 +00:00
runs-on: ${{ matrix.os }}
2021-05-09 01:29:45 +00:00
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
2021-04-13 03:56:51 +00:00
2021-04-12 22:31:14 +00:00
steps:
- uses: actions/checkout@v3
2021-04-12 22:31:14 +00:00
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 06:06:13 +00:00
- name: Install test images
run: git clone https://git.pileof.rocks/drewcassidy/quicktex-test-images.git tests/images
2021-05-09 01:12:37 +00:00
- name: Build wheels
uses: joerick/cibuildwheel@v1.11.0
2021-05-09 01:22:31 +00:00
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
CIBW_BUILD: "cp{37,38,39,310}-*"
2021-05-09 01:22:31 +00:00
CIBW_SKIP: "*-win32 *-manylinux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
2021-05-09 06:06:13 +00:00
CIBW_TEST_EXTRAS: "tests"
2021-05-09 06:15:52 +00:00
CIBW_TEST_COMMAND: nosetests {project}/tests -d
2021-04-12 22:31:14 +00:00
2021-05-09 06:06:13 +00:00
- name: Upload Wheels
2021-04-12 22:57:06 +00:00
uses: actions/upload-artifact@v2
2021-04-12 22:31:49 +00:00
with:
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:
2021-05-09 06:06:13 +00:00
name: Publish to PyPI and Github
needs: [build-wheels, build-sdist]
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:
- uses: actions/checkout@v3
2021-04-12 23:45:34 +00:00
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
2021-04-12 22:57:06 +00:00
2021-04-12 22:31:14 +00:00
- name: Install dependencies
run: |
python -m pip install --upgrade pip
2021-05-09 06:06:13 +00:00
python -m pip install yaclog
- name: Get version name and body
run: |
echo "VERSION_TILE=Version $(yaclog show -n)" >> $GITHUB_ENV
echo "$(yaclog show -mb)" >> RELEASE.md
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: artifact
path: dist
2021-04-12 22:31:14 +00:00
2021-05-09 06:06:13 +00:00
- name: List artifacts
run: ls -l dist
2021-04-12 22:31:14 +00:00
- 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 }}
2021-05-09 06:06:13 +00:00
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish to Github
uses: softprops/action-gh-release@v1
with:
files: dist/*
name: ${{ env.VERSION_TITLE }}
body_path: RELEASE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}