From fd588242a271547c339229222f98254b0974d338 Mon Sep 17 00:00:00 2001 From: Austin Welch Date: Wed, 20 Nov 2024 13:15:22 -0500 Subject: [PATCH] Update test.yml (#17) --- .github/workflows/test.yml | 106 +++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb8b8e3..153282b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,67 +1,69 @@ -name: Test +name: test on: - workflow_dispatch: - push: - branches: - - main - - master - - test-github-actions - pull_request: + workflow_dispatch: + push: + branches: + - main + - master + - test-github-actions + pull_request: jobs: - test: - runs-on: ubuntu-latest + test: + name: test + runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.11"] + strategy: + fail-fast: false + matrix: + python-version: ["3.11"] - name: Python ${{ matrix.python-version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Set up Python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: 1.5.1 + virtualenvs-create: true + virtualenvs-in-project: true - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - version: 1.5.1 - virtualenvs-create: true - virtualenvs-in-project: true + - 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') }} - - 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') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root --with test,dev,docs - - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root --with test,dev,docs + - name: Install project + run: poetry install --no-interaction --with test,dev,docs - - name: Install project - run: poetry install --no-interaction --with test,dev,docs + - name: Verify Git installation + run: git --version - - name: Verify Git installation - run: git --version + - name: Verify pre-commit installation + run: poetry run pre-commit --version - - name: Verify pre-commit installation - run: poetry run pre-commit --version + - name: Run pre-commit hooks + run: | + poetry run pre-commit install + poetry run pre-commit run --all-files - - name: Run pre-commit hooks - run: | - poetry run pre-commit install - poetry run pre-commit run --all-files - - - name: Run tests - run: poetry run pytest + - name: Run tests + run: poetry run pytest + env: + PYTHONPATH: ${{ github.workspace }}