Skip to content

Commit

Permalink
update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
enriquetomasmb committed Nov 18, 2024
1 parent 8f0ff6a commit 46c0cc9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
36 changes: 14 additions & 22 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
name: "setup-env"
description: "Set up a Python environment with Poetry"
description: "Set up a Python environment"

inputs:
python-version:
required: false
description: "The version of Python to use with Poetry"
default: "3.11"
description: "The version of Python"
default: "3.11.7"

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

- name: Install Poetry
env:
POETRY_VERSION: "1.8.4"
run: curl -sSL https://install.python-poetry.org | python - -y
run: |
curl -fsSL https://astral.sh/uv/install.sh | bash
uv python install ${{ inputs.python-version }}
uv python pin ${{ inputs.python-version }}
shell: bash

- name: Add Poetry to Path
- name: Add uv to Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash

- name: Configure Poetry virtual environment in project
run: poetry config virtualenvs.in-project true
shell: bash

- name: Load cached venv
id: cached-poetry-dependencies
- name: Cache virtual environment
id: cache-venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
- name: Install dependencies if cache is not hit
if: steps.cache-venv.outputs.cache-hit != 'true'
run: uv sync
shell: bash
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
uses: ./.github/actions/setup-env
- name: Install doc dependencies
run: |
poetry install --with docs --no-interaction
uv sync --group docs
- name: List directories
run: |
ls -la
- name: Build Documentation
run: |
poetry run mkdocs build -f docs/mkdocs.yml -d _build
uv run mkdocs build -f docs/mkdocs.yml -d _build
- name: Add files
run: |
echo "nebula.enriquetomasmb.com" > docs/_build/CNAME
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
- name: Check if documentation can be built
run: |
cd docs
poetry run mkdocs build -s
uv run mkdocs build -s
1 change: 0 additions & 1 deletion .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- name: Build and publish
run: |
source .venv/bin/activate
poetry version $RELEASE_VERSION
make build-and-publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Expand Down

0 comments on commit 46c0cc9

Please sign in to comment.