Cache poetry deps during CI runs #10
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: Application CI/CD | |
on: | |
push: | |
branches: [main, development] | |
pull_request: | |
branches: [main, development, '109-cache-poetry-deps'] | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
py_modified: ${{ steps.filter.outputs.py_modified }} | |
py_modified_files: ${{ steps.filter.outputs.py_modified_files }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get changed files | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
list-files: shell | |
filters: | | |
py_modified: | |
- added|modified: "./**/*.py" | |
setup: | |
needs: changes | |
#if: ${{ needs.changes.outputs.py_modified == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install | |
pytest: | |
needs: setup | |
#if: ${{ needs.changes.outputs.py_modified == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install | |
- name: Style check | |
run: | | |
poetry run flake8 ${{ needs.changes.outputs.py_modified_files }} | |
- name: Tests | |
run: | | |
poetry run python -m pytest tests | |
flake8: | |
needs: setup | |
#if: ${{ needs.changes.outputs.py_modified == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: "poetry" | |
- name: Install dependencies | |
run: poetry install | |
- name: run | |
run: | | |
poetry run flake8 ${{ needs.changes.outputs.py_modified_files }} |