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
40 changes: 40 additions & 0 deletions .github/actions/python/setup-uv/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'UV Python Setup'
description: 'Set up the environment for a UV-managed Python project'
inputs:
project:
description: 'Which project (by subdirectory) to set up'
required: true
python-version:
description: 'Python version to install via setup-uv'
required: false
default: '3.12'
install-system-deps:
description: 'Whether to install system dependencies (libsystemd-dev on Linux)'
required: false
default: 'true'
runs:
using: 'composite'
steps:
- shell: bash
if: inputs.install-system-deps == 'true'
run: |
if [[ "${OSTYPE}" =~ "linux" ]]; then
# WORKAROUND: Remove microsoft debian repo due to https://github.com/microsoft/linux-package-repositories/issues/130. Remove line below after it is resolved
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends libsystemd-dev
fi
- shell: bash
run: npm install --global [email protected]
- name: Setup Python and UV
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ inputs.python-version }}
enable-cache: true
cache-dependency-glob: |
${{ inputs.project }}/pyproject.toml
${{ inputs.project }}/uv.lock
- name: Setup Python Environment
id: setup-env
shell: bash
run: make -C ${{ inputs.project }} setup
32 changes: 21 additions & 11 deletions .github/actions/python/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ inputs:
project:
description: 'Which project (by subdirectory) to set up'
required: true
python-version:
description: "What Python version to use to create the project's virtual environment"
install-system-deps:
description: 'Whether to install system dependencies (libsystemd-dev on Linux)'
required: false
default: "false"
default: 'true'
runs:
using: 'composite'
steps:
Expand All @@ -28,11 +28,21 @@ runs:
run: echo "OT_VIRTUALENV_VERSION=${{ inputs.python-version }}" >> $GITHUB_ENV
- shell: bash
run: npm install --global [email protected]
- shell: bash
run: $OT_PYTHON -m pip install --upgrade pip
- shell: bash
run: $OT_PYTHON -m pip install --user pipenv==2023.12.1
- shell: bash
run: $OT_PYTHON -m pip install --user virtualenv==20.30.0
- shell: bash
run: 'make -C ${{ inputs.project }} setup || make -C ${{ inputs.project }} setup'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pipenv and virtualenv
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install --user pipenv==2023.12.1
python -m pip install --user virtualenv==20.30.0
- name: Setup Python Environment
id: setup-env
shell: bash
run: |
# For pipenv projects, make setup runs "pipenv sync --dev" which always installs dev dependencies
# (see scripts/python.mk where pipenv_opts includes --dev)
make -C ${{ inputs.project }} setup
echo "::notice::Setup completed"
40 changes: 10 additions & 30 deletions .github/workflows/api-test-lint-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v4'
with:
python-version: '3.12'

- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'api'
python-version: '3.12'
- name: Lint with opentrons_hardware
run: make -C api lint
test:
Expand Down Expand Up @@ -95,24 +92,19 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v4'
with:
python-version: ${{ matrix.python }}
- name: 'set complex environment variables'
uses: actions/github-script@v6
with:
script: |
const { buildComplexEnvVars, } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'api'
python-version: ${{ matrix.python }}
- if: ${{ matrix.with-ot-hardware == 'false' }}
name: Remove OT-3 hardware package
run: make -C api setup-ot2
env:
OT_VIRTUALENV_VERSION: ${{ matrix.python }}
- if: ${{ matrix.with-ot-hardware == 'false' }}
name: Test without opentrons_hardware
run: make -C api test-ot2
Expand Down Expand Up @@ -147,21 +139,12 @@ jobs:
run: |
git fetch -f origin ${{ github.ref }}:${{ github.ref }}
git checkout ${{ github.ref }}
- uses: 'actions/setup-python@v4'
with:
python-version: ${{matrix.python}}
- name: Set up package-testing
id: setup
if: ${{ matrix.os != 'windows-2022' }}
working-directory: package-testing
shell: bash
run: make setup
- name: Set up package-testing (Windows)
id: setup-windows
if: ${{ matrix.os == 'windows-2022' }}
working-directory: package-testing
shell: pwsh
run: make setup-windows
uses: './.github/actions/python/setup-uv'
with:
project: 'package-testing'
python-version: '3.12'
- name: Run the tests
if: ${{ matrix.os != 'windows-2022' }}
shell: bash
Expand All @@ -174,7 +157,7 @@ jobs:
working-directory: package-testing
run: make test-windows
- name: Save the test results
if: ${{ always() && steps.setup.outcome == 'success' || steps.setup-windows.outcome == 'success' }}
if: ${{ always() && steps.setup.outcome == 'success' }}
id: results
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -208,22 +191,19 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v4'
with:
python-version: '3.12'
- name: 'set complex environment variables'
uses: actions/github-script@v6
with:
script: |
const { buildComplexEnvVars, } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'api'
python-version: '3.12'
- name: 'build api distributables'
shell: bash
run: make -C api sdist wheel

# creds and repository configuration for deploying python wheels
- if: ${{ !env.OT_TAG }}
name: 'upload to test pypi'
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/docs-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v3'
with:
python-version: '3.12'
- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'api'
- name: 'Build docs'
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/g-code-confirm-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '12'
- uses: 'actions/setup-python@v3'
with:
python-version: '3.12'
- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'g-code-testing'

- name: 'Verify no missing comparison files'
run: make -C g-code-testing check-for-missing-comparison-files

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/g-code-testing-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ jobs:
script: |
const { buildComplexEnvVars } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: 'actions/setup-python@v4'
with:
python-version: '3.12'
- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'g-code-testing'
- name: 'cache yarn cache'
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/hardware-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,8 @@ jobs:
with:
node-version: '12'

- name: Setup Python
uses: 'actions/setup-python@v4'
with:
python-version: '3.12'

- name: Setup Hardware Project
uses: './.github/actions/python/setup'
uses: './.github/actions/python/setup-uv'
with:
project: 'hardware'

Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/http-docs-build.yaml

This file was deleted.

6 changes: 1 addition & 5 deletions .github/workflows/robot-server-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v4'
with:
python-version: '3.12'

- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'robot-server'
- if: ${{ matrix.with-ot-hardware == 'false' }}
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/server-utils-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v4'
with:
python-version: '3.12'

- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'server-utils'
- name: Lint
Expand All @@ -68,10 +64,7 @@ jobs:
- uses: 'actions/setup-node@v6'
with:
node-version: '22.12.0'
- uses: 'actions/setup-python@v4'
with:
python-version: '3.12'
- uses: './.github/actions/python/setup'
- uses: './.github/actions/python/setup-uv'
with:
project: 'server-utils'
- name: Test
Expand Down
Loading
Loading