Continuous Integration #30
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: Continuous Integration | |
on: | |
schedule: | |
- cron: "0 8 * * 1" | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: actions-id-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-formatting: | |
name: Check Formatting Errors | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: | | |
python -m pip install pycodestyle autopep8 | |
python -m pip install ./fastsolv | |
- name: Run pycodestyle | |
run: | | |
pycodestyle --statistics --count --max-line-length=150 --show-source ./fastsolv | |
build-and-test: | |
needs: check-formatting | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macos-13] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} Subtest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Miniforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Miniforge3 | |
miniforge-version: latest | |
python-version: ${{ matrix.python-version }} | |
use-mamba: true | |
- name: Install Dependencies | |
run: | | |
python -m pip install ./fastsolv | |
python -m pip install pytest | |
- name: Run Tests | |
run: | | |
pytest -v fastsolv/test | |
check-for-new-release: | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check PyPI version | |
uses: maybe-hello-world/pyproject-check-version@v3 | |
id: versioncheck | |
with: | |
pyproject-path: "./fastsolv/pyproject.toml" | |
- name: Report Results | |
run: | | |
echo "New Release found? ${{ steps.versioncheck.outputs.local_version_is_higher }}" | |
echo "Local version: ${{ steps.versioncheck.outputs.local_version }}" | |
echo "Public version: ${{ steps.versioncheck.outputs.public_version }}" | |
outputs: | |
do_publish: ${{ steps.versioncheck.outputs.local_version_is_higher }} | |
pypi-package: | |
name: Build and publish Python distributions to PyPI | |
runs-on: ubuntu-latest | |
needs: check-for-new-release | |
if: ${{ needs.check-for-new-release.outputs.do_publish == 'true' && github.ref == 'refs/heads/main' && github.repository == 'JacksonBurns/fastsolv'}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: >- | |
python -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--wheel | |
--outdir ./fastsolv/dist/ | |
./fastsolv | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip-existing: true | |
verbose: true | |
packages-dir: ./fastsolv/dist/ |