-
-
Notifications
You must be signed in to change notification settings - Fork 113
142 lines (134 loc) · 4.75 KB
/
ci.yaml
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
name: Continuous Integration
on: [push, pull_request]
defaults:
run:
shell: bash
concurrency:
group: ci-tests-${{ github.ref }}-1
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0", "pypy3.8", "pypy3.9", "pypy3.10", ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Print Python Information
run: python -VV
- name: install TinyTeX
uses: r-lib/actions/setup-tinytex@v2
- name: Install and configure Poetry
run: |
pip3 install poetry
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v3
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Download pandoc
run: poetry run python setup_binary.py download_pandoc
- name: run tests
run: poetry run python tests.py
builder_pypandoc:
needs: [test]
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04 # Any OS is fine as this wheel is not OS dependent
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.9 # Build any 1 python version as this wheel is not version dependent
- name: Update dependencies
run: python -m pip install -U pip wheel setuptools
- name: Build wheel
run: python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
builder_pypandoc_binary:
needs: [test]
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
# Ref: https://cibuildwheel.readthedocs.io/en/stable/options/#archs
# macos-11 - Creates macosx_x86_64
# windows-2019 - Creates {win_amd64,win32}
# ubuntu-20.04 - Creates {manylinux,musllinux}_{x86_64,i686}
# In CIBW_SKIP we skip 32bit linux
os: [macos-11, windows-2019, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Remove pyproject and use setuptools
run: rm pyproject.toml
- name: Build binary Archive
uses: pypa/[email protected]
env:
CIBW_BEFORE_ALL: "mv setup_binary.py setup.py && python3 setup.py download_pandoc"
CIBW_BUILD: cp39-* # Build any 1 python version as this wheel is not version dependent
# We skip some variants because:
# - pandoc does not publish binaries for Linux 32bit
CIBW_SKIP: "*-{manylinux_i686,musllinux_i686}"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: wheelhouse/
publisher_release:
needs: [builder_pypandoc, builder_pypandoc_binary]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
publisher_latest:
needs: [builder_pypandoc, builder_pypandoc_binary]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Make release
uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
title: "Latest Development Version"
automatic_release_tag: "latest"
files: dist/*