Skip to content

Commit

Permalink
build(docker): update CI and docker to python 3.11 using uv (#402)
Browse files Browse the repository at this point in the history
* build(docker): update to python 3.11 and use uv

* ci(github): update workflow to python 3.11 and uv

* style(precommit): bump precommit python

* ci(style): fix deps installation command
  • Loading branch information
frgfm authored Jan 9, 2025
1 parent 516aa35 commit 45de7a7
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 184 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ on:
pull_request:
branches: main

env:
PYTHON_VERSION: "3.11"
UV_VERSION: "0.5.13"
POETRY_VERSION: "1.8.3"


jobs:
docker:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.2"
poetry-version: ${{ env.POETRY_VERSION }}
- name: Resolve dependencies
run: poetry export -f requirements.txt --without-hashes --output requirements.txt
- name: Build, run & check docker
Expand Down Expand Up @@ -56,9 +59,10 @@ jobs:
with:
python-version: ${{ matrix.python }}
architecture: x64
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install project
run: |
python -m pip install --upgrade uv
uv pip install --system -e client/.
- name: Import package
run: python -c "import pyroclient; print(pyroclient.__version__)"
python -c "import pyroclient; print(pyroclient.__version__)"
27 changes: 13 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ on:
push:
branches: main

env:
UV_VERSION: "0.5.13"

jobs:
gh-pages:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python: [3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
python-version: 3.9
architecture: x64
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install --system -e "client/.[docs]"
run: uv pip install --system -e "client/.[docs]"

- name: Build documentation
run: sphinx-build client/docs/source client/docs/build -a -v
Expand All @@ -37,8 +37,7 @@ jobs:
- name: Deploy to Github Pages
uses: JamesIves/[email protected]
with:
BRANCH: gh-pages
FOLDER: 'client/docs/build'
COMMIT_MESSAGE: '[skip ci] Documentation updates'
CLEAN: true
SSH: true
branch: gh-pages
folder: 'client/docs/build'
commit-message: '[skip ci] Documentation updates'
clean: true
19 changes: 13 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
release:
types: [ published ]

env:
PYTHON_VERSION: "3.11"
UV_VERSION: "0.5.13"

jobs:
pypi:
if: "!github.event.release.prerelease"
Expand All @@ -12,12 +16,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install --system setuptools wheel twine --upgrade
run: uv pip install --system setuptools wheel twine --upgrade
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand All @@ -42,9 +47,11 @@ jobs:
with:
python-version: ${{ matrix.python }}
architecture: x64
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install package
run: |
python -m pip install --upgrade uv
uv pip install --system pyroclient
python -c "import pyroclient; print(pyroclient.__version__)"
Expand All @@ -57,7 +64,7 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
shell: bash -el {0}
run: conda install -y conda-build conda-verify anaconda-client
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
pull_request:
branches: main

env:
UV_VERSION: "0.5.13"

jobs:
docs-client:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python: [3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
python-version: 3.9
architecture: x64
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install --system -e "client/.[docs]"
run: uv pip install --system -e "client/.[docs]"

- name: Build documentation
run: sphinx-build client/docs/source client/docs/build -a -v
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
env:
BACKEND_IMAGE_NAME: alert-api
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_LOGIN }}
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.8.3"

jobs:
docker:
Expand All @@ -14,11 +16,11 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.2"
poetry-version: ${{ env.POETRY_VERSION }}
- name: Resolve dependencies
run: poetry export -f requirements.txt --without-hashes --output requirements.txt
- name: Build docker
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ on:
pull_request:
branches: main

env:
PYTHON_VERSION: "3.11"
UV_VERSION: "0.5.13"
POETRY_VERSION: "1.8.3"

jobs:
end-to-end:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: [3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.2"
poetry-version: ${{ env.POETRY_VERSION }}
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Resolve dependencies
run: |
poetry export -f requirements.txt --without-hashes --output requirements.txt
python -m pip install --upgrade uv
uv pip install --system -r scripts/requirements.txt
- name: Run the backend & the test
env:
Expand Down
Loading

0 comments on commit 45de7a7

Please sign in to comment.