forked from mingruimingrui/fast-mosestokenizer
-
Notifications
You must be signed in to change notification settings - Fork 5
123 lines (100 loc) · 2.97 KB
/
release-github.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
name: Build and upload python packages to Github release
on:
workflow_dispatch:
push:
branches:
- opus-release
tags:
- '*'
jobs:
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
name: source
path: dist/*.tar.gz
build-wheels-macos:
runs-on: macos-12
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
MINICONDA_FILENAME: Miniconda3-latest-MacOSX-x86_64.sh
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v3
- name: Download and install miniconda
shell: bash
run: |
curl -L -o $MINICONDA_FILENAME "https://repo.continuum.io/miniconda/$MINICONDA_FILENAME"
bash ${MINICONDA_FILENAME} -b -f -p $HOME/miniconda3
echo "::add-path::$HOME/miniconda3/bin"
echo "::add-path::$HOME/miniconda3/Scripts"
conda init
- name: Download and build dependencies
run: |
eval "$(conda shell.bash hook)"
conda create -n meson python=3.8
conda activate meson
conda install -y meson
make download-build-static-deps
conda deactivate
- name: Build and upload packages
run: |
eval "$(conda shell.bash hook)"
for VERSION in 3.7 3.8 3.9 3.10 3.11; do
conda create -n py$VERSION python=$VERSION
conda activate py$VERSION
STATIC_LIBS=1 python setup.py build_ext bdist_wheel
conda deactivate
done
- uses: actions/upload-artifact@v3
with:
name: macos-wheels
path: dist/*.whl
build-wheels-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build package and upload from docker
run: |
docker run --rm -v "${PWD}:/opt/fast-mosestokenizer" \
ubuntu:22.04 /bin/bash /opt/fast-mosestokenizer/build-release-linux.sh
- uses: actions/upload-artifact@v3
with:
name: linux-wheels
path: dist/*.whl
make-release:
runs-on: ubuntu-latest
needs:
- build-sdist
- build-wheels-macos
- build-wheels-linux
steps:
- uses: actions/download-artifact@v3
with:
name: linux-wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: macos-wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: source
path: dist
- name: Upload release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: dist/*.whl
- name: Upload to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/