Skip to content

Changed the dist directory in ci_test.yml #38

Changed the dist directory in ci_test.yml

Changed the dist directory in ci_test.yml #38

Workflow file for this run

name: Python package CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [published]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel cython
pip install "numpy>=1.16.3" --only-binary=numpy "scipy>=1.11.3" --only-binary=scipy
pip install black pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
shell: bash
- name: Build Cython extensions
run: python setup.py build_ext --inplace
- name: Lint with black
run: |
black . --check
- name: Install package in editable mode
run: pip install -e .
shell: bash
- name: Run tests with pytest
run: |
pytest --cov=fastshermanmorrison --cov-report xml:coverage.xml tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
build:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1
- name: Install project dependencies
run: |
pip install "numpy>=1.16.3" --only-binary=numpy "scipy>=1.2.0" --only-binary=scipy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build wheels using cibuildwheel
run: cibuildwheel --output-dir dist
env:
CIBW_BEFORE_BUILD: "pip install numpy>=1.16.3 --only-binary=numpy scipy>=1.2.0 --only-binary=scipy"
CIBW_BUILD_VERBOSITY: 1
CIBW_SKIP: "pp* cp27-* cp35-* cp36-* cp37-* cp38-* *-win32 *-manylinux_i686 *-musllinux_i686 *-macosx_10_6_intel *-macosx_10_9_intel *-macosx_10_10_intel *-macosx_10_11_intel *-macosx_10_12_intel *-macosx_10_13_intel *-macosx_10_14_intel *-macosx_10_15_intel"
CIBW_ARCHS: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
- name: Build source distribution
run: python setup.py sdist
- uses: actions/upload-artifact@v3
with:
name: dist
path: |
./dist/*.whl
./dist/*.tar.gz
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Download built distributions
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist/
- name: List files in dist
run: echo "Content of dist:" && ls -lah dist/ && echo "Content of ./:" && ls -lah ./
- name: Publish to PyPI
run: |
python -m pip install --upgrade twine
python -m twine upload ./dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
#TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/