Remove author_email #370
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-test-cpp: | |
name: Build and test C++ library on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Build and install | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
cmake -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$PWD/install . | |
make install | |
- name: Build and install | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
cmake -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$PWD/install -DICU_ROOT=/usr/local/opt/icu4c/ . | |
make install | |
- name: Test | |
run: | | |
test/onmt_tokenizer_test test/data | |
check-python-style: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install black==22.* flake8==3.9.* isort==5.* | |
- name: Check code format with Black | |
working-directory: bindings/python | |
run: | | |
black --check . | |
- name: Check imports order with isort | |
working-directory: bindings/python | |
run: | | |
isort --check-only . | |
- name: Check code style with Flake8 | |
working-directory: bindings/python | |
if: ${{ always() }} | |
run: | | |
flake8 . | |
build-and-test-python-wheels: | |
name: Build and test wheels on ${{ matrix.os }} for ${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-11, windows-2019] | |
arch: [auto64] | |
include: | |
- os: ubuntu-20.04 | |
arch: aarch64 | |
- os: macos-11 | |
arch: arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: docker/setup-qemu-action@v2 | |
if: ${{ matrix.arch == 'aarch64' }} | |
name: Set up QEMU | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: bindings/python | |
output-dir: wheelhouse | |
env: | |
CIBW_ENVIRONMENT_WINDOWS: TOKENIZER_ROOT='${{ github.workspace }}\install' | |
CIBW_BEFORE_ALL: bindings/python/tools/prepare_build_environment.sh | |
CIBW_BEFORE_ALL_WINDOWS: bash bindings/python/tools/prepare_build_environment_windows.sh | |
CIBW_BEFORE_BUILD: pip install pybind11==2.10.1 | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | |
CIBW_TEST_COMMAND: pytest {project}/bindings/python/test/test.py | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_SKIP: pp* *-musllinux_* | |
CIBW_TEST_SKIP: "*-macosx_arm64" | |
- name: Upload Python wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-wheels | |
path: wheelhouse | |
publish-python-wheels-on-pypi: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [build-and-test-cpp, build-and-test-python-wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Python wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-wheels | |
- name: Publish Python wheels to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: . |