bugfix #133
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.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- if: runner.os == 'Windows' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install mkl-devel | |
- if: runner.os == 'Linux' | |
run: | | |
python -m pip install --upgrade pip | |
sudo apt-get install -y libopenblas-dev | |
- if: runner.os == 'macOS' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install mkl-devel | |
- name: Install python dependencies | |
run: | | |
python -m pip install flake8 pytest pytest-runner coverage | |
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: | | |
python setup.py pytest --addopts "test" | |
- if: runner.os == 'macOS' | |
name: Test with pytest | |
run: | | |
python setup.py pytest --addopts "test" | |
- if: runner.os == 'Windows' | |
name: Build | |
run: | | |
python setup.py install | |
- if: runner.os == 'Linux' | |
name: Generate Report | |
run: | | |
coverage run -m unittest | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
build_wheels: | |
needs: [build] | |
if: startsWith( github.ref, 'refs/tags/') | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, windows-2022, macos-11] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v3 | |
with: | |
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@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
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@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |