Top-down hierarchical #270
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: hammer-pr-ci | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
env: | |
POETRY_VERSION: "1.5.0" | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
outputs: | |
pytestOutput: ${{ steps.unit-tests.outputs.test }} | |
mypyOutput: ${{ steps.type-checks.outputs.test }} | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Load Cached Poetry Install | |
id: cached-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local | |
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
version: ${{ env.POETRY_VERSION }} | |
- name: Load Cached Poetry virtualenv | |
id: cached-venv | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Create Poetry env | |
if: steps.cached-venv.outputs.cache-hit != 'true' | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry install --no-ansi | |
- name: Run unit tests | |
id: unit-tests | |
run: | | |
poetry run pytest tests/ -v | |
- name: Type checking | |
id: type-checks | |
run: | | |
touch .venv/lib/python${{ matrix.python-version }}/site-packages/ruamel/py.typed | |
poetry run mypy --namespace-packages -p hammer |