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
70 changes: 50 additions & 20 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
name: python_lib
description: Installs the given GardenLinux Python library

inputs:
version:
description: GardenLinux Python library version
default: "0.8.9"
version:
description: GardenLinux Python library version
default: "0.8.9"
python_version:
description: Python version to setup
default: "3.13"

outputs:
version:
description: GardenLinux Python library version
value: ${{ inputs.version }}
python_version:
description: Python version to setup
value: ${{ inputs.python_version }}
package_tool:
description: "Detected Python cache strategy."
value: ${{ steps.env-check.outputs.package_tool }}

runs:
using: composite
steps:
- name: Verify requirements.txt for "actions/setup-python" with enabled "pip" cache
shell: bash
run: |
if [ ! -f "requirements.txt" ]; then
echo "python-gardenlinux-lib @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}" | tee -a requirements.txt
fi
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: 'pip'
- name: Install GardenLinux Python library
shell: bash
run: |
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}
using: composite
steps:
- name: Evaluate Python environment
id: env-check
shell: bash
run: |
# Determine cache type based on available lockfile
if [ -f poetry.lock ]; then
echo "package_tool=poetry" >> $GITHUB_OUTPUT
elif [ -f requirements.txt ]; then
echo "package_tool=pip" >> $GITHUB_OUTPUT
else
# no lockfile present: create one and use pip caching
echo "gardenlinux @ git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}" | tee -a requirements.txt
echo "package_tool=pip" >> $GITHUB_OUTPUT
fi

- name: Install Poetry
if: steps.env-check.outputs.package_tool == 'poetry'
uses: snok/install-poetry@v1

- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
cache: ${{ steps.env-check.outputs.package_tool }}

- name: Install GardenLinux Python library
shell: bash
run: |
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}
10 changes: 6 additions & 4 deletions .github/workflows/pytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [ "3.13" ]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -19,9 +22,8 @@ jobs:

- name: Setup Gardenlinux
uses: ./.github/actions/setup

- name: Install Poetry
uses: snok/install-poetry@v1
with:
python_version: ${{ matrix.python_version }}

- name: Install dependencies
run: poetry install --with dev
Expand All @@ -30,7 +32,7 @@ jobs:
run: make install-test

- name: Run tests
run: |
run: |
export GLOCI_REGISTRY_TOKEN="invalid"
make test-coverage-ci

Expand Down