ensemble #43
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: deploy-pypi | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
name: Publish python distribution to PyPI | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install twine and wheel | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade numpy | |
python -m pip install --upgrade twine | |
python -m pip install --upgrade wheel | |
- name: Build distribution | |
run: | | |
python setup.py sdist | |
python setup.py bdist_wheel | |
twine check dist/* | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
test_pypi: | |
needs: [build-and-deploy] | |
name: Test on ${{ matrix.os }} and Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.9', '3.10', '3.11'] | |
steps: | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install prerequisites | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install geos | |
- name: Install packages | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest-cov | |
python -m pip install --upgrade restoreio | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Move source to avoid import from local folder | |
- name: Rename source | |
run: mv restoreio restoreio-DoNotImport | |
# # This is to prevent the error "libomp is already initialized", | |
# # which occurs only in MacOS. To circumvent the error, the | |
# # following script will remove libomp.dylib from imate package, and | |
# # copies libomp.dylib from restoreio to imate package. | |
# - name: Remove duplicate libomp | |
# if: matrix.os == 'macos-latest' | |
# run: | | |
# chmod +x scripts/fix_libomp.sh | |
# ./scripts/fix_libomp.sh `which python` | |
# shell: bash | |
- name: Test | |
run: pytest |