Skip to content

use micromamba

use micromamba #5

Workflow file for this run

name: build conda for Windows
on: [push]
jobs:
build-windows:
runs-on: windows-latest
strategy:
max-parallel: 5
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Setup base conda for Python
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: 'latest'
environment-name: test_environment
init-shell: >-
bash
condarc: |
channels:
- MaxBo
- conda-forge
- defaults
create-args: >-
python=${{ matrix.python-version }}
numpy
pytest-cov
cache-environment: true
post-cleanup: 'all'
env:
ACTIONS_STEP_DEBUG: true
TMPDIR: ${{ runner.TEMP }}
CONDA_BLD_PATH: env.TMPDIR
UPLOAD_COV: ${{ matrix.python-version == '3.12' }}
- name: Install dependencies and set channels
run: |
micromamba install -n root conda-build conda-verify anaconda-client twine readme_renderer
micromamba info -a
- name: build cythoninstallhelpers and cythonarrays for base environment
run: |
micromamba build --python 3.9 cythoninstallhelpers/conda.recipe
micromamba install -n root --use-local cythoninstallhelpers
micromamba build --python 3.9 cythonarrays/conda.recipe
micromamba install -n root --use-local cythonarrays
- name: build cythoninstallhelpers and cythonarrays for python version
run: |
micromamba activate test-environment
micromamba build --python python=${{ matrix.python-version }} cythoninstallhelpers/conda.recipe
micromamba install --use-local cythoninstallhelpers
micromamba build --python python=${{ matrix.python-version }} cythonarrays/conda.recipe
micromamba install --use-local cythonarrays
micromamba build --python python=${{ matrix.python-version }} matrixconverters/conda.recipe
micromamba install --use-local matrixconverters
- name: Upload package to conda
env:
CONDA_BLD_PATH: ${{ runner.TEMP }}
ANACONDA_TOKEN: ${{ secrets.ANACONDA_GITHUBACTION_TOKEN }}
ANACONDA_USERNAME: MaxBo
if: ${{ env.ANACONDA_TOKEN }}
run: |
micromamba activate test-environment
anaconda -t %ANACONDA_TOKEN% upload --skip-existing --user %ANACONDA_USERNAME% %CONDA_BLD_PATH%/win-64/cythoninstallhelpers-*.tar.bz2
anaconda -t %ANACONDA_TOKEN% upload --skip-existing --user %ANACONDA_USERNAME% %CONDA_BLD_PATH%/win-64/cythonarrays-*.tar.bz2
anaconda -t %ANACONDA_TOKEN% upload --skip-existing --user %ANACONDA_USERNAME% %CONDA_BLD_PATH%/win-64/matrixconverters-*.tar.bz2
- name: Build wheel and run tests for cythoninstallhelpers
run: |
micromamba activate test-environment
cd cythoninstallhelpers
pip install -y .
python -m pytest --pyargs cythoninstallhelpers
cd ..
- name: Build wheel and run tests for cythonarrays
run: |
micromamba activate test-environment
cd cythonarrays
pip install -y .
python -m pytest --pyargs cythonarrays
cd ..
- name: Build wheel and run tests for matrixconverters
run: |
micromamba activate test-environment
cd matrixconverters
pip install -y .
python -m pytest --pyargs matrixconverters
cd ..
- name: Publish cythoninstallhelpers to PyPI
uses: ortega2247/pypi-upload-action@master
if: startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_CYTHONINSTALLHELPERS }}
packages_dir: cythoninstallhelpers
- name: Publish cythonarrays to PyPI
uses: ortega2247/pypi-upload-action@master
if: startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_CYTHONARRAYS }}
packages_dir: cythonarrays
- name: Publish matrixconverters to PyPI
uses: ortega2247/pypi-upload-action@master
if: startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_MATRIXCONVERTERS }}
packages_dir: matrixconverters
- name: run code coverage
if: ${{ env.UPLOAD_COV }}
run: |
micromamba activate test-environment
pip install -y pytest-cov pytest-benchmark
cd cythoninstallhelpers
pip install -y -e .
py.test --cov=src --cov-report xml --pyargs cythoninstallhelpers
cd ..
cd cythonarrays
pip install -y -e .
python setup.py build_ext --force --inplace --define CYTHON_TRACE_NOGIL
py.test --cov=src --cov-report xml --pyargs cythonarrays
cd ..
cd matrixconverters
pip install -y -e .
py.test --cov=src --cov-report xml --pyargs matrixconverters
cd ..
coverage combine cythoninstallhelpers\.coverage cythonarrays\.coverage matrixconverters\.coverage
coverage xml
- name: Upload to Codecov
if: ${{ env.UPLOAD_COV }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage1.xml
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)