-
Notifications
You must be signed in to change notification settings - Fork 3
147 lines (124 loc) · 4.46 KB
/
Copy pathpython-package.yml
File metadata and controls
147 lines (124 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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
on: [ push, pull_request ]
jobs:
build-sdist:
name: Build SDist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5.1.1
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
python -m pip install setuptools twine build
- 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: Build SDist
run: python -m build --sdist
- name: Check metadata
run: python -m twine check dist/*
- name: Upload SDist
uses: actions/upload-artifact@v4
with:
name: wheel-sdist
path: dist/*.tar.gz
compression-level: 0 # already compressed
build-wheels:
name: Build Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ ubuntu-22.04, windows-latest, macos-13, macos-14 ]
linux_arch: [ 'x86_64' ] #[suffix, mac, windows, linux] arch names
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- 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://mac.r-project.org/openmp/openmp-13.0.0-darwin21-Release.tar.gz || wget https://pileof.rocks/openmp-13.0.0-darwin21-Release.tar.gz
sudo tar fvxz openmp-*.tar.gz -C /
- name: Install QEMU
# install QEMU if building for linux
uses: docker/setup-qemu-action@v2
if: runner.os == 'linux'
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
MACOSX_DEPLOYMENT_TARGET: "12"
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
compression-level: 0 # already compressed
publish-pypi:
name: Deploy to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [ build-wheels, build-sdist ]
runs-on: ubuntu-22.04
environment:
name: Publish
url: https://pypi.org/project/quicktex/${{ github.ref_name }}
permissions:
id-token: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: wheel*
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-github:
name: Deploy to Github
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [ build-wheels, build-sdist ]
runs-on: ubuntu-22.04
environment:
name: Publish
url: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: wheel*
path: dist
- name: List artifacts
run: ls -l dist
- name: Get Changelog Information
id: yaclog-show
uses: drewcassidy/yaclog@1.5.0
- name: Publish to Github
run: >
gh release create ${{ github.ref_name }}
--notes-file "${{ steps.yaclog-show.outputs.body-file }}"
--title "${{ steps.yaclog-show.outputs.name }}"
dist/*
env:
GH_TOKEN: ${{ github.token }}