[pre-commit.ci] pre-commit autoupdate #62
This file contains hidden or 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: pytest | |
| on: | |
| push: | |
| branches: ["main", "develop"] | |
| pull_request: | |
| branches: ["main", "develop"] | |
| jobs: | |
| build: | |
| name: Run tests for Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ "ubuntu-latest", "macos-latest" ] | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: szenius/set-timezone@v1.2 | |
| with: | |
| timezoneLinux: "Europe/Berlin" | |
| #---------------------------------------------- | |
| # check-out repo and set-up python | |
| #---------------------------------------------- | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| id: setup-python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| #---------------------------------------------- | |
| # load pip cache if cache exists | |
| #---------------------------------------------- | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip | |
| #---------------------------------------------- | |
| # install & configure poetry | |
| #---------------------------------------------- | |
| - name: Install poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| #---------------------------------------------- | |
| # load cached venv if cache exists | |
| #---------------------------------------------- | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| #---------------------------------------------- | |
| # install dependencies if cache does not exist | |
| #---------------------------------------------- | |
| - name: Install dependencies with poetry | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction --no-root --with test | |
| #---------------------------------------------- | |
| # install your root project, if required | |
| #---------------------------------------------- | |
| - name: Install library | |
| run: poetry install --no-interaction --with dev,test | |
| #---------------------------------------------- | |
| # run tests and genenrate summaries | |
| #---------------------------------------------- | |
| - uses: pavelzw/pytest-action@v2 | |
| with: | |
| emoji: true | |
| verbose: true | |
| job-summary: true | |
| click-to-expand: true | |
| custom-pytest: poetry run pytest tests | |
| report-title: "Test Report for Python ${{ matrix.python-version }} on ${{ matrix.os }}" |