Skip to content

Commit 002b492

Browse files
Move JFrog setup before setup-python, matching sqlalchemy pattern
Follow the proven pattern from databricks/databricks-sqlalchemy#59: checkout → Setup JFrog → setup-python → pip install poetry → poetry source add + poetry lock → poetry install. The hardened runners block pypi.org at the network level, so JFrog must be configured before actions/setup-python (which upgrades pip). Also simplified workflows by removing verbose section comments. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent 2067a8a commit 002b492

File tree

5 files changed

+77
-275
lines changed

5 files changed

+77
-275
lines changed

.github/actions/setup-jfrog/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Setup JFrog OIDC
2-
description: Obtain a JFrog access token via GitHub OIDC and configure pip and poetry to use JFrog PyPI proxy
2+
description: Obtain a JFrog access token via GitHub OIDC and configure pip to use JFrog PyPI proxy
33

44
runs:
55
using: composite
@@ -30,4 +30,3 @@ runs:
3030
set -euo pipefail
3131
echo "PIP_INDEX_URL=https://gha-service-account:${JFROG_ACCESS_TOKEN}@databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple" >> "$GITHUB_ENV"
3232
echo "pip configured to use JFrog registry"
33-

.github/workflows/code-coverage.yml

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,21 @@ jobs:
1919
DATABRICKS_CATALOG: peco
2020
DATABRICKS_USER: ${{ secrets.TEST_PECO_SP_ID }}
2121
steps:
22-
#----------------------------------------------
23-
# check-out repo and set-up python
24-
#----------------------------------------------
2522
- name: Check out repository
2623
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2724
with:
2825
fetch-depth: 0
26+
- name: Setup JFrog
27+
uses: ./.github/actions/setup-jfrog
2928
- name: Set up python
3029
id: setup-python
3130
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3231
with:
3332
python-version: "3.10"
34-
#----------------------------------------------
35-
# ----- configure JFrog PyPI proxy -----
36-
#----------------------------------------------
37-
- name: Setup JFrog
38-
uses: ./.github/actions/setup-jfrog
39-
#----------------------------------------------
40-
# ----- install system dependencies -----
41-
#----------------------------------------------
4233
- name: Install system dependencies
4334
run: |
4435
sudo apt-get update
4536
sudo apt-get install -y libkrb5-dev
46-
#----------------------------------------------
47-
# ----- install & configure poetry -----
48-
#----------------------------------------------
4937
- name: Install Poetry
5038
run: |
5139
pip install poetry==2.2.1
@@ -58,34 +46,21 @@ jobs:
5846
poetry config http-basic.jfrog gha-service-account "${JFROG_ACCESS_TOKEN}"
5947
poetry source add --priority=primary jfrog https://databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple
6048
poetry lock
61-
62-
#----------------------------------------------
63-
# load cached venv if cache exists
64-
#----------------------------------------------
6549
- name: Load cached venv
6650
id: cached-poetry-dependencies
6751
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
6852
with:
6953
path: .venv
7054
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
71-
#----------------------------------------------
72-
# install dependencies if cache does not exist
73-
#----------------------------------------------
7455
- name: Install dependencies
7556
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
7657
run: poetry install --no-interaction --no-root
77-
#----------------------------------------------
78-
# install your root project, if required
79-
#----------------------------------------------
8058
- name: Install Kerberos system dependencies
8159
run: |
8260
sudo apt-get update
8361
sudo apt-get install -y libkrb5-dev
8462
- name: Install library
8563
run: poetry install --no-interaction --all-extras
86-
#----------------------------------------------
87-
# run parallel tests with coverage
88-
#----------------------------------------------
8964
- name: Run parallel tests with coverage
9065
continue-on-error: false
9166
run: |
@@ -96,24 +71,15 @@ jobs:
9671
--cov-report=xml \
9772
--cov-report=term \
9873
-v
99-
100-
#----------------------------------------------
101-
# run telemetry tests with coverage (isolated)
102-
#----------------------------------------------
10374
- name: Run telemetry tests with coverage (isolated)
10475
continue-on-error: false
10576
run: |
106-
# Run test_concurrent_telemetry.py separately for isolation
10777
poetry run pytest tests/e2e/test_concurrent_telemetry.py \
10878
--cov=src \
10979
--cov-append \
11080
--cov-report=xml \
11181
--cov-report=term \
11282
-v
113-
114-
#----------------------------------------------
115-
# check for coverage override
116-
#----------------------------------------------
11783
- name: Check for coverage override
11884
id: override
11985
env:
@@ -129,9 +95,6 @@ jobs:
12995
echo "override=false" >> $GITHUB_OUTPUT
13096
echo "No coverage override found"
13197
fi
132-
#----------------------------------------------
133-
# check coverage percentage
134-
#----------------------------------------------
13598
- name: Check coverage percentage
13699
if: steps.override.outputs.override == 'false'
137100
run: |
@@ -140,39 +103,29 @@ jobs:
140103
echo "ERROR: Coverage file not found at $COVERAGE_FILE"
141104
exit 1
142105
fi
143-
144-
# Install xmllint if not available
145106
if ! command -v xmllint &> /dev/null; then
146107
sudo apt-get update && sudo apt-get install -y libxml2-utils
147108
fi
148-
149109
COVERED=$(xmllint --xpath "string(//coverage/@lines-covered)" "$COVERAGE_FILE")
150110
TOTAL=$(xmllint --xpath "string(//coverage/@lines-valid)" "$COVERAGE_FILE")
151111
PERCENTAGE=$(python3 -c "covered=${COVERED}; total=${TOTAL}; print(round((covered/total)*100, 2))")
152-
153112
echo "Branch Coverage: $PERCENTAGE%"
154113
echo "Required Coverage: 85%"
155-
156-
# Use Python to compare the coverage with 85
157114
python3 -c "import sys; sys.exit(0 if float('$PERCENTAGE') >= 85 else 1)"
158115
if [ $? -eq 1 ]; then
159116
echo "ERROR: Coverage is $PERCENTAGE%, which is less than the required 85%"
160117
exit 1
161118
else
162119
echo "SUCCESS: Coverage is $PERCENTAGE%, which meets the required 85%"
163120
fi
164-
165-
#----------------------------------------------
166-
# coverage enforcement summary
167-
#----------------------------------------------
168121
- name: Coverage enforcement summary
169122
env:
170123
OVERRIDE: ${{ steps.override.outputs.override }}
171124
REASON: ${{ steps.override.outputs.reason }}
172125
run: |
173126
if [ "$OVERRIDE" == "true" ]; then
174-
echo "⚠️ Coverage checks bypassed: $REASON"
127+
echo "Coverage checks bypassed: $REASON"
175128
echo "Please ensure this override is justified and temporary"
176129
else
177-
echo "Coverage checks enforced - minimum 85% required"
130+
echo "Coverage checks enforced - minimum 85% required"
178131
fi

0 commit comments

Comments
 (0)