Skip to content
Open
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
36 changes: 36 additions & 0 deletions .github/actions/dev_setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pygl_dev_setup
description: Installs GardenLinux Python library dev packages

inputs:
version:
description: GardenLinux Python library version to install
default: "0.10.5"
python_version:
description: Python version to setup
default: "3.14"

outputs:
version:
description: GardenLinux Python library version
value: ${{ inputs.version }}
python_version:
description: Python version to setup
value: ${{ inputs.python_version }}

runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 2.2.1

- name: Install GardenLinux Python library
shell: bash
run: |
poetry install --with=dev
2 changes: 1 addition & 1 deletion .github/actions/flavors_parse/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ outputs:
runs:
using: composite
steps:
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@0.10.5
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@255-improve-caching-used-in-gh-actions
- id: matrix
shell: bash
run: |
Expand Down
50 changes: 23 additions & 27 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: python_lib
description: Installs the given GardenLinux Python library
name: pygl_setup
description: Installs GardenLinux Python library

inputs:
version:
description: GardenLinux Python library version
description: GardenLinux Python library version to install
default: "0.10.5"
python_version:
description: Python version to setup
Expand All @@ -16,39 +16,35 @@ outputs:
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: 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: Restore python site-packages from cache
id: restore-python-cache
uses: actions/cache/restore@v4
with:
path: |
~/.local/lib/python${{ inputs.python_version }}/site-packages
~/.local/bin
key: pygl-${{ runner.arch }}-${{ inputs.python_version }}-${{ inputs.version }}

- name: Install GardenLinux Python library
shell: bash
run: |
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@${{ inputs.version }}
pip install --user \
https://github.com/gardenlinux/python-gardenlinux-lib/releases/download/${{ inputs.version }}/gardenlinux-${{ inputs.version }}-py3-none-any.whl

- name: Cache python site-packages
id: save-python-cache
uses: actions/cache/save@v4
with:
path: |
~/.local/lib/python${{ inputs.python_version }}/site-packages
~/.local/bin
key: pygl-${{ runner.arch }}-${{ inputs.python_version }}-${{ inputs.version }}
2 changes: 1 addition & 1 deletion .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/dev_setup@255-improve-caching-used-in-gh-actions
- name: Simple bandit security checks
run: make security
- name: Show Report in Action Output
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/dev_setup@255-improve-caching-used-in-gh-actions
- run: make lint
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/dev_setup@255-improve-caching-used-in-gh-actions
- name: Simple poetry build no package
run: make build
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@main
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/dev_setup@255-improve-caching-used-in-gh-actions
- run: make docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/pytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ jobs:
with:
fetch-depth: 2

- name: Setup Gardenlinux
uses: ./.github/actions/setup
with:
python_version: ${{ matrix.python_version }}
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/dev_setup@255-improve-caching-used-in-gh-actions

- name: Install dependencies
run: poetry install --with dev
Expand Down
Loading