pedpy-ci #1922
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: pedpy-ci | |
on: | |
schedule: | |
# Runs at 2:00 am each day | |
- cron: '00 2 * * *' | |
push: | |
branches: | |
- main | |
- rls-* | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- main | |
- rls-* | |
jobs: | |
pre-build-checks: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
python-version: [ '3.11' ] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -VV | |
python3 -m site | |
python3 -m pip install --upgrade pip setuptools wheel build | |
python3 -m pip install -r requirements.txt | |
- name: Check format, docstring style, typing, linting | |
run: | | |
${{github.workspace}}/scripts/ci.sh | |
build: | |
needs: pre-build-checks | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-12, macos-14, windows-latest ] | |
python-version: [ '3.11' ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -VV | |
python3 -m site | |
python3 -m pip install --upgrade pip setuptools wheel build | |
python3 -m pip install -r requirements.txt | |
- name: Run pytests | |
run: | | |
python3 -m pytest --cov=pedpy --cov-report=xml -vv -s tests | |
- name: Upload results to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Build wheel | |
id: build-wheel | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
python3 -m build | |
- name: Upload wheel as artifact | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Upload notebooks and demo files as artifacts | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: demos_usage | |
path: | | |
notebooks/ | |
test: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-12, macos-14, windows-latest ] | |
python-version: [ '3.11', '3.12' , '3.13'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download notebooks and demo files as artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: demos_usage | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Install wheel | |
shell: bash | |
run: | | |
python3 -m pip install --upgrade pip jupyter nbconvert nbformat matplotlib | |
python3 -m pip install dist/*whl | |
- name: Test if install was successful | |
run: | | |
python3 -c "import pedpy; print(f'PedPy {pedpy.__version__} (SHA: {pedpy.__commit_hash__})')" | |
- name: Run getting started notebook | |
run: | | |
jupyter nbconvert --to notebook --execute getting_started.ipynb | |
- name: Run user guide notebook | |
run: | | |
jupyter nbconvert --to notebook --execute user_guide.ipynb | |
- name: Run fundamental diagram notebook | |
run: | | |
jupyter nbconvert --to notebook --execute fundamental_diagram.ipynb | |
publish: | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags')}} | |
needs: [ build, test ] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
python-version: [ '3.11' ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Publish package to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |