Update training.md #419
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Python package | |
on: | |
push: | |
branches: [ "**" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow | |
# from installing Poetry every time, which can be slow. Note the use of the Poetry version | |
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache | |
# manually if/when you want to upgrade Poetry, or if something goes wrong. | |
- name: Cache poetry | |
uses: actions/[email protected] | |
with: | |
path: ~/.local | |
key: poetry-1.8.3-0 | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.3 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- run: poetry --version | |
# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache | |
# key: if you're using multiple Python versions, or multiple OSes, you'd need to include | |
# them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock. | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/[email protected] | |
with: | |
path: .venv | |
key: pydeps-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
# The `if` statement ensures this only runs on a cache miss. | |
run: poetry install --no-interaction | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: poetry run pytest |