name: Tests on: - push - pull_request jobs: tests: runs-on: ubuntu-latest steps: - name: Check out the repository uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v5.0.0 with: python-version: "3.10" - name: Cache poetry install uses: actions/cache@v4 with: path: ~/.local key: poetry-1.7.1-0 - name: Install poetry uses: snok/install-poetry@v1 with: version: 1.7.1 virtualenvs-create: true virtualenvs-in-project: true - name: cache deps id: cache-deps uses: actions/cache@v4 with: path: .venv key: pydeps-${{ hashFiles('**/poetry.lock') }} - run: poetry install --no-interaction --no-root if: steps.cache-deps.outputs.cache-hit != 'true' # Now install _your_ project. This isn't necessary for many types of projects -- particularly # things like Django apps don't need this. But it's a good idea since it fully-exercises the # pyproject.toml and makes that if you add things like console-scripts at some point that # they'll be installed and working. - run: poetry install --no-interaction # And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml` # so this line is super-simple. But it could be as complex as you need. - run: poetry run pytest --cov - name: Upload coverage roports to Codecov uses: codecov/codecov-action@v4 env: CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}