Skip to content

Commit e7dc28b

Browse files
Extract shared Poetry+JFrog setup into composite action
Create .github/actions/setup-poetry that encapsulates JFrog setup, Python setup, Poetry install, JFrog source config, caching, and dependency installation. This removes duplication across all three workflows (check-linting, check-types, integration). Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent c8bb83f commit e7dc28b

3 files changed

Lines changed: 62 additions & 81 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Setup Poetry with JFrog
2+
description: Install Poetry, configure JFrog as primary PyPI source, and install project dependencies
3+
4+
inputs:
5+
python-version:
6+
description: Python version to set up
7+
required: true
8+
install-args:
9+
description: Extra arguments for poetry install (e.g. --all-extras)
10+
required: false
11+
default: ""
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Setup JFrog
17+
uses: ./.github/actions/setup-jfrog
18+
19+
- name: Set up python ${{ inputs.python-version }}
20+
id: setup-python
21+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
22+
with:
23+
python-version: ${{ inputs.python-version }}
24+
25+
- name: Install Poetry
26+
shell: bash
27+
run: |
28+
pip install poetry==2.2.1
29+
poetry config virtualenvs.create true
30+
poetry config virtualenvs.in-project true
31+
poetry config installer.parallel true
32+
33+
- name: Configure Poetry JFrog source
34+
shell: bash
35+
run: |
36+
poetry config repositories.jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
37+
poetry config http-basic.jfrog gha-service-account "${JFROG_ACCESS_TOKEN}"
38+
poetry source add --priority=primary jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
39+
poetry lock
40+
41+
- name: Load cached venv
42+
id: cached-poetry-dependencies
43+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
44+
with:
45+
path: .venv
46+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
47+
48+
- name: Install dependencies
49+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
50+
shell: bash
51+
run: poetry install --no-interaction --no-root
52+
53+
- name: Install library
54+
shell: bash
55+
run: poetry install --no-interaction ${{ inputs.install-args }}

.github/workflows/code-quality-checks.yml

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,10 @@ jobs:
2323
steps:
2424
- name: Check out repository
2525
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
26-
- name: Setup JFrog
27-
uses: ./.github/actions/setup-jfrog
28-
- name: Set up python ${{ matrix.python-version }}
29-
id: setup-python
30-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
26+
- name: Setup Poetry
27+
uses: ./.github/actions/setup-poetry
3128
with:
3229
python-version: ${{ matrix.python-version }}
33-
- name: Install Poetry
34-
run: |
35-
pip install poetry==2.2.1
36-
poetry config virtualenvs.create true
37-
poetry config virtualenvs.in-project true
38-
poetry config installer.parallel true
39-
- name: Configure Poetry JFrog source
40-
run: |
41-
poetry config repositories.jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
42-
poetry config http-basic.jfrog gha-service-account "${JFROG_ACCESS_TOKEN}"
43-
poetry source add --priority=primary jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
44-
poetry lock
45-
- name: Load cached venv
46-
id: cached-poetry-dependencies
47-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
48-
with:
49-
path: .venv
50-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
51-
- name: Install dependencies
52-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
53-
run: poetry install --no-interaction --no-root
54-
- name: Install library
55-
run: poetry install --no-interaction
5630
- name: Black
5731
run: poetry run black --check src
5832

@@ -66,36 +40,10 @@ jobs:
6640
steps:
6741
- name: Check out repository
6842
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
69-
- name: Setup JFrog
70-
uses: ./.github/actions/setup-jfrog
71-
- name: Set up python ${{ matrix.python-version }}
72-
id: setup-python
73-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
43+
- name: Setup Poetry
44+
uses: ./.github/actions/setup-poetry
7445
with:
7546
python-version: ${{ matrix.python-version }}
76-
- name: Install Poetry
77-
run: |
78-
pip install poetry==2.2.1
79-
poetry config virtualenvs.create true
80-
poetry config virtualenvs.in-project true
81-
poetry config installer.parallel true
82-
- name: Configure Poetry JFrog source
83-
run: |
84-
poetry config repositories.jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
85-
poetry config http-basic.jfrog gha-service-account "${JFROG_ACCESS_TOKEN}"
86-
poetry source add --priority=primary jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
87-
poetry lock
88-
- name: Load cached venv
89-
id: cached-poetry-dependencies
90-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
91-
with:
92-
path: .venv
93-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
94-
- name: Install dependencies
95-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
96-
run: poetry install --no-interaction --no-root
97-
- name: Install library
98-
run: poetry install --no-interaction
9947
- name: Mypy
10048
run: |
10149
mkdir .mypy_cache

.github/workflows/integration.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,10 @@ jobs:
2727
steps:
2828
- name: Check out repository
2929
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
30-
- name: Setup JFrog
31-
uses: ./.github/actions/setup-jfrog
32-
- name: Set up python
33-
id: setup-python
34-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
30+
- name: Setup Poetry
31+
uses: ./.github/actions/setup-poetry
3532
with:
3633
python-version: "3.10"
37-
- name: Install Poetry
38-
run: |
39-
pip install poetry==2.2.1
40-
poetry config virtualenvs.create true
41-
poetry config virtualenvs.in-project true
42-
poetry config installer.parallel true
43-
- name: Configure Poetry JFrog source
44-
run: |
45-
poetry config repositories.jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
46-
poetry config http-basic.jfrog gha-service-account "${JFROG_ACCESS_TOKEN}"
47-
poetry source add --priority=primary jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
48-
poetry lock
49-
- name: Load cached venv
50-
id: cached-poetry-dependencies
51-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
52-
with:
53-
path: .venv
54-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
55-
- name: Install dependencies
56-
run: poetry install --no-interaction --all-extras
34+
install-args: "--all-extras"
5735
- name: Run SQL Alchemy tests
5836
run: poetry run python -m pytest tests/test_local

0 commit comments

Comments
 (0)