Skip to content

two level model

two level model #296

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# 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
- name: Test with pytest
run: |
pip install pytest
pytest
- name: Bump version number
if: github.ref == 'refs/heads/master'
run: |
python -m pip install black
echo "NEW_VERSION=$(python .github/workflows/bumper.py)" >> $GITHUB_ENV
- name: Commit possibly updated setup.py
if: github.ref == 'refs/heads/master'
run: |
git config --local user.email "fbda@nfi.nl"
git config --local user.name "Version bumper"
git add setup.py
git commit -m "Bump version to ${{ env.NEW_VERSION }}" || echo "Did not bump the patch part of the version number, this could be caused by a manual version bump"
- name: Push changes
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if: github.ref == 'refs/heads/master'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.NEW_VERSION }}
release_name: Release ${{ env.NEW_VERSION }}
body: |
Automated patch release
draft: false
prerelease: false
- name: Install publishing dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
if: github.ref == 'refs/heads/master'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
- uses: actions/upload-artifact@v2
with:
name: Distribution files
path: dist/*