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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

138 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:
fetch-depth: 0
2021-04-08 01:42:45 +00:00
2021-05-09 06:06:13 +00:00
- name: Set up Python
uses: actions/setup-python@v3.1.2
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@v3
2021-05-09 06:06:13 +00:00
with:
path: dist/*.tar.gz
build-wheels:
2022-04-12 04:48:22 +00:00
name: Build Wheels on ${{ matrix.os }} ${{ matrix.arch[0] }}
2021-04-12 22:31:14 +00:00
runs-on: ${{ matrix.os }}
2021-05-09 01:29:45 +00:00
strategy:
matrix:
os: [ macos-11, windows-latest, ubuntu-latest ]
2022-04-12 04:48:22 +00:00
arch: [ ['x86', 'x86_64', 'AMD64', 'x86_64' ] ] #[suffix, mac, windows, linux] arch names
include:
- os: ubuntu-latest
2022-04-12 04:48:22 +00:00
arch: [ 'ARM', 'arm64', 'ARM64', 'aarch64' ]
2021-04-12 22:31:14 +00:00
steps:
- uses: actions/checkout@v3
2021-04-12 22:31:14 +00:00
with:
fetch-depth: 0
2021-04-12 22:31:14 +00:00
- name: Install libomp
if: runner.os == 'macOS'
# openMP isnt part of core apple clang for some reason?
# libomp is in homebrew, which works for end users but its not a fat binary
# so we have to install it manually
# compiled dylibs courtesy of https://mac.r-project.org/openmp/ and mirrored on my own server
run: |
wget https://pileof.rocks/openmp-13.0.0-darwin21-Release.tar.gz
sudo tar fvxz openmp-*.tar.gz -C /
2021-04-12 22:31:14 +00:00
2022-04-02 04:06:51 +00:00
- name: Install QEMU
# install QEMU if building for arm linux
uses: docker/setup-qemu-action@v2
2022-04-12 04:48:22 +00:00
if: runner.os == 'linux' && matrix.arch[3] == 'aarch64'
2022-04-02 04:06:51 +00:00
with:
platforms: arm64
2021-05-09 01:12:37 +00:00
- name: Build wheels
uses: pypa/cibuildwheel@2.5.0
2021-05-09 01:22:31 +00:00
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
2022-04-12 04:48:22 +00:00
CIBW_ARCHS_LINUX: ${{ matrix.arch[3] }}
2021-04-12 22:31:14 +00:00
2021-05-09 06:06:13 +00:00
- name: Upload Wheels
uses: actions/upload-artifact@v3
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 # just need the changelog
2021-04-12 23:45:34 +00:00
2021-04-12 22:31:14 +00:00
- name: Set up Python
uses: actions/setup-python@v3.1.2
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@v3
2021-05-09 06:06:13 +00:00
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 }}