fix code cov #368
Workflow file for this run
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: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- if: runner.os == 'Windows' | |
run: | | |
Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile vs_buildtools.exe | |
./vs_buildtools.exe --quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.140 --includeRecommended | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- if: runner.os == 'Windows' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install mkl-devel setuptools | |
- if: runner.os == 'Linux' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install mkl-devel | |
sudo apt-get install -y libopenblas-dev | |
- if: runner.os == 'macOS' | |
run: | | |
python -m pip install --upgrade pip | |
brew install openblas | |
- name: Install python dependencies | |
run: | | |
python -m pip install flake8 setuptools pytest pytest-runner coverage pytest-cov looseversion | |
pip install -r requirements.txt | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- if: runner.os == 'Linux' | |
name: Test with pytest | |
run: | | |
pip install -e . | |
pytest --cov | |
- if: runner.os == 'Windows' | |
name: Build | |
run: | | |
pip install . | |
- if: runner.os == 'MacOS' | |
name: Build | |
run: | | |
pip install . | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
build_wheels: | |
needs: [build] | |
if: startsWith( github.ref, 'refs/tags/') | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
needs: [build] | |
if: startsWith( github.ref, 'refs/tags/') | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |