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
25 changes: 25 additions & 0 deletions .github/actions/install_package/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Install a Python Package
description: 'Installs a specified Python package from a requirements file, allowing for flexible package management.'

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: Extract Package Version
id: extract_package_version
shell: bash
run: |
echo "PACKAGE_LINE=$(grep -w "^${{ inputs.package }}" ${{ inputs.requirements-path }} || echo "${{ inputs.package }}")" >> $GITHUB_OUTPUT

- name: Install Package
shell: bash
run: |
python -m pip install --upgrade pip
pip install "${{ steps.extract_package_version.outputs.PACKAGE_LINE }}"
10 changes: 9 additions & 1 deletion .github/actions/setup_env/action.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
name: Setup/Cache Env
description: 'Sets up and caches a python env. Will only install dependencies if no cache was hit.'


inputs:
pyproject-file-path:
required: False
description: "Path to the pyproject.toml including filename"
default: "./pyproject.toml"
runs:
using: composite
steps:
- name: Setup Python from pyproject.toml
uses: ./.github/actions/python_from_pyproject
with:
pyproject-file-path: ${{ inputs.pyproject-file-path }}

- name: Cache Env
uses: actions/cache@v4.2.3
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup Env
uses: ./.github/actions/setup_env

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


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

- name: Setup Env
uses: ./.github/actions/setup_env

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