ext py 5 #52
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-conda | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build_conda: | |
runs-on: ubuntu-latest | |
name: Publish to Conda | |
strategy: | |
fail-fast: false | |
# To upload to PyPI on every tag starting with 'v', use the following: | |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
# To publish to pypi on each GitHub Release, use the following: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: "latest" | |
auto-update-conda: true | |
- name: Install prerequisites | |
run: sudo apt install libgeos3.10.2 libgeos-dev -y | |
- name: Build and upload package | |
shell: bash -el {0} | |
run: | | |
# conda update -y -n base conda | |
# conda install -y -n base conda-libmamba-solver | |
# conda config --set solver libmamba | |
conda install -y conda-build anaconda-client | |
conda config --set anaconda_upload yes | |
export PATH=$(conda info --root):$PATH | |
export PATH=$(conda info --root)/bin:$PATH | |
conda-build --output-folder . . -c conda-forge | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
test_conda: | |
needs: [build_conda] | |
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 Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
activate-environment: myenv | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Move source to avoid import from local folder | |
- name: Rename source | |
run: | | |
mv restoreio restoreio-DoNotImport | |
rm setup.cfg | |
# 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: Test (MacOS) | |
# if: matrix.os == 'macos-latest' | |
# run: | | |
# export PATH=$(conda info --root):$PATH | |
# export PATH=$(conda info --root)/bin:$PATH | |
# conda install -c s-ameli restoreio -y | |
# conda install pytest -y | |
# chmod +x scripts/fix_libomp.sh | |
# ./scripts/fix_libomp.sh "$(conda info --root)/bin/python" | |
# pytest | |
# shell: bash | |
# - name: Test (Linux, Windows) | |
# if: matrix.os != 'macos-latest' | |
- name: Test | |
shell: bash -l {0} | |
run: | | |
conda install -c conda-forge -c s-ameli restoreio -y | |
conda install pytest -y | |
pytest |