-
-
Notifications
You must be signed in to change notification settings - Fork 275
177 lines (175 loc) · 6.57 KB
/
release-pypi-core.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
on:
pull_request:
branches: [ main ]
types:
- labeled
- synchronize
env:
PYPI_TOKEN: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }}
PYTHON_SUPPORTED_VERSIONS: '["3.8", "3.9", "3.10", "3.11", "3.12"]'
jobs:
source_distribute:
name: "Source Distribute"
if: ${{ github.event.label.name == 'release-pypi-core' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/undertheseanlp/underthesea/build_rust:2.0.0a0
env:
HOME: /root
PYTHON: python${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v1
- name: Create environment and install package dependencies
working-directory: ./extensions/underthesea_core
env:
LC_ALL: en_US.UTF-8 # Known issue: https://github.com/python-poetry/poetry/issues/221#issuecomment-723652470
run: |
cargo --version
$PYTHON -m poetry --version
$PYTHON -m poetry install
$PYTHON -m poetry show
- name: Build and publish
working-directory: ./extensions/underthesea_core
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }}
run: |
$PYTHON -m poetry run maturin sdist
pip install twine
twine upload ./target/wheels/* -u __token__ -p "$PYPI_TOKEN"
linux:
name: "Linux"
if: ${{ github.event.label.name == 'release-pypi-core' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/undertheseanlp/underthesea/build_rust:2.0.0a0
env:
HOME: /root
PYTHON: python${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJson(env.PYTHON_SUPPORTED_VERSIONS) }}
steps:
- uses: actions/checkout@v1
- name: Create environment and install package dependencies
working-directory: ./extensions/underthesea_core
env:
LC_ALL: en_US.UTF-8 # Known issue: https://github.com/python-poetry/poetry/issues/221#issuecomment-723652470
run: |
cargo --version
$PYTHON -m poetry --version
$PYTHON -m poetry install
$PYTHON -m poetry show
- name: Build and publish
working-directory: ./extensions/underthesea_core
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }}
run: |
$PYTHON -m poetry run maturin build --release --no-sdist --strip --interpreter python${{ matrix.python-version }}
find ./target/wheels/
$PYTHON -m poetry run maturin publish --username __token__ --no-sdist --interpreter python${{ matrix.python-version }}
windows:
name: "Windows"
if: ${{ github.event.label.name == 'release-pypi-core' }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Create environment
run: |
python -m pip install --upgrade pip
mkdir "${HOME}/poetry"
curl -sSL https://install.python-poetry.org | python -
echo "C:\Users\runneradmin\AppData\Roaming\Python\Scripts\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install package dependencies
working-directory: ./extensions/underthesea_core
run: poetry install
- name: Build and publish
working-directory: ./extensions/underthesea_core
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }}
run: |
poetry run maturin build --release --no-sdist --strip --interpreter python
dir target\wheels\
poetry run maturin publish --username __token__ --no-sdist --interpreter python
macos-x64:
name: "MacOS x64"
if: ${{ github.event.label.name == 'release-pypi-core' }}
runs-on: macos-13
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Create environment
working-directory: ./extensions/underthesea_core
run: |
python -m pip install --upgrade pip
mkdir "${HOME}/poetry"
curl -sSL https://install.python-poetry.org | POETRY_HOME=${HOME}/poetry python -
echo "${HOME}/poetry/bin" >> $GITHUB_PATH
- name: Install package dependencies
working-directory: ./extensions/underthesea_core
run: poetry install
- name: Build and publish
working-directory: ./extensions/underthesea_core
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }}
run: |
poetry run maturin build --release --no-sdist --strip --interpreter python${{ matrix.python-version }}
find ./target/wheels/
pip install target/wheels/underthesea_core*.whl
poetry run maturin publish --username __token__ --no-sdist --interpreter python${{ matrix.python-version }}
macos-arm:
name: "MacOS ARM"
if: ${{ github.event.label.name == 'release-pypi-core' }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create environment and install package dependencies
working-directory: ./extensions/underthesea_core
run: |
mkdir "${PWD}/poetry"
curl -sSL https://install.python-poetry.org | POETRY_HOME=${PWD}/poetry python -
export PATH="${PWD}/poetry/bin:${PATH}"
poetry install
- name: Build and publish
working-directory: ./extensions/underthesea_core
env:
PYTHON: /Users/anhv/anaconda3/envs/python${{ matrix.python-version }}/bin/python${{ matrix.python-version }}
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }}
run: |
export PATH="${PWD}/poetry/bin:${PATH}"
$PYTHON --version
poetry run maturin build --release --no-sdist --strip --interpreter $PYTHON
find ./target/wheels/
poetry run maturin publish --username __token__ --no-sdist --interpreter $PYTHON