Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/actions/install_package/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@ description: 'Installs a specified Python package from a requirements file, allo
inputs:
requirements-path:
required: true
description: Path to the requirements file
package:
required: true
description: Package you would like to install from the requirements file

runs:
using: composite
steps:
- name: Get project version with yq
id: get_python_version
uses: mikefarah/yq@v4.46.1
with:
cmd: yq '.project.requires-python' pyproject.toml

- name: Set up Python
uses: actions/setup-python@v5.6.0
with:
python-version: ${{ steps.get_python_version.outputs.result }}

- name: Extract Package Version
id: extract_package_version
shell: bash
Expand Down
10 changes: 8 additions & 2 deletions .github/actions/setup_env/action.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: Setup/Cache Env
description: 'Sets up and caches a python env. Will only install dependencies if no cache was hit.'


inputs:
pyproject-toml-path:
required: false
description: Path to the pyporject toml
default: "./pyproject.toml"
runs:
using: composite
steps:
- name: Get project version with yq
id: get_python_version
uses: mikefarah/yq@v4.46.1
with:
cmd: yq '.project.requires-python' pyproject.toml
cmd: yq '.project.requires-python' ${{ inputs.pyproject-toml-path }}

- name: Set up Python
uses: actions/setup-python@v5.6.0
Expand All @@ -20,7 +26,7 @@ runs:
id: env-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ hashFiles('./requirements/requirements.txt') }}-${{ hashFiles('./requirements/requirements_scripts.txt') }}-${{ hashFiles('./requirements/requirements_test.txt') }}
key: ${{ hashFiles('./requirements/requirements.txt') }}-${{ hashFiles('./requirements/requirements_test.txt') }}

- name: Install Dependencies
if: ${{ steps.env-cache.outputs.cache-hit != 'true' }}
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup Env
uses: ./.github/actions/install_package
- name: Ruff Formatting
uses: astral-sh/ruff-action@v3.5.0
with:
requirements-path: requirements/requirements_test.txt
package: ruff
version-file: "requirements/requirements_test.txt"
args: "format --check"

- name: Ruff Formatting
run: ruff format --check

linting:
name: Linting
Expand All @@ -59,11 +57,7 @@ jobs:
with:
fetch-depth: 0

- name: Setup Env
uses: ./.github/actions/install_package
with:
requirements-path: requirements/requirements_test.txt
package: ruff

- name: Ruff Linting
run: ruff check
uses: astral-sh/ruff-action@v3.5.0
with:
version-file: "requirements/requirements_test.txt"