Skip to content

Feature/pyproject.toml #8

Feature/pyproject.toml

Feature/pyproject.toml #8

Workflow file for this run

name: build cythonarrays for Windows
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v[0-9].[0-9]+.[0-9]+
jobs:
build-windows:
runs-on: windows-latest
defaults:
run:
shell: cmd
strategy:
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- name: Setup base conda for Python
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
miniforge-version: latest
channels: conda-forge
env:
TMPDIR: ${{ runner.TEMP }}
CONDA_BLD_PATH: env.TMPDIR
- name: Install dependencies and set channels
run: |
(
mamba install -n base "conda>=23.7" conda-build conda-verify anaconda-client boa twine
mamba create -n test-wheels python=${{ matrix.python-version }} numpy pytest-cov build
mamba create -n test-conda python=${{ matrix.python-version }} numpy pytest-cov
)
- name: build cythonarrays for python version
env:
CONDA_BLD_PATH: ${{ runner.TEMP }}
TMPDIR: ${{ runner.TEMP }}
LIBARCHIVE: C:\Miniconda\Library\bin\archive.dll
run: |
(
conda build --python ${{ matrix.python-version }} --no-test cythonarrays\conda.recipe
conda install -c local -c conda-forge -n test-conda cythonarrays
)
- name: test cythonarrays for python version
env:
CONDA_BLD_PATH: ${{ runner.TEMP }}
TMPDIR: ${{ runner.TEMP }}
run: |
(
mamba activate test-conda
python -m pytest --pyargs cythonarrays
echo "### All tests with conda passed! :rocket:" >> $GITHUB_STEP_SUMMARY
)
- 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: |
(
mamba activate base
anaconda -t %ANACONDA_TOKEN% upload --skip-existing --user %ANACONDA_USERNAME% %CONDA_BLD_PATH%\win-64\cythonarrays-*.tar.bz2
)
- name: Build wheel and run tests for cythonarrays
run: |
(
mamba activate test-wheels
cd cythonarrays
echo "build cythonarrays from folder %CD%"
pip install -r requirements.txt
pip install .
python -m pytest --pyargs cythonarrays
python -m build -n .
echo "### All tests with pip passed! :rocket:" >> $GITHUB_STEP_SUMMARY
)
- name: run code coverage
if: ${{ matrix.python-version == '3.12' }}
run: |
(
conda activate test-wheels
cd cythonarrays
pip install -e .
python setup.py build_ext --force --inplace --define CYTHON_TRACE_NOGIL
py.test --cov=src --cov-report xml --pyargs cythonarrays
coverage xml
echo "### Code Coverage checked! :rocket:" >> $GITHUB_STEP_SUMMARY
)
- name: Upload to Codecov
if: ${{ matrix.python-version == '3.12' }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./cythonarrays/coverage.xml
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)
- name: Publish cythonarrays to PyPI
if: startsWith(github.ref, 'refs/tags/')
env:
TWINE_USERNAME: '__token__'
run: |
(
mamba activate base
twine upload --skip-existing -p ${{ secrets.PYPI_API_TOKEN_CYTHONARRAYS }} cythonarrays\dist\*
)
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
detached: true