Skip to content

Commit d56af36

Browse files
authored
Merge pull request #98 from UiPath/feat/extract-to-core
chore: extract to core (validate with uipath version 2.0.65.dev1004030443)
2 parents 769e9de + c4c780b commit d56af36

25 files changed

Lines changed: 1380 additions & 536 deletions
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Lint Custom Version
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
types: [opened, synchronize, labeled, unlabeled]
7+
8+
jobs:
9+
lint-with-custom-version:
10+
name: Lint with Custom UiPath Version
11+
runs-on: ubuntu-latest
12+
if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Extract version from PR
22+
id: extract-version
23+
shell: bash
24+
run: |
25+
# Extract version from PR title only
26+
PR_TITLE="${{ github.event.pull_request.title }}"
27+
28+
# Search for version pattern in title (any x.y.z.dev version)
29+
VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+' | head -1)
30+
31+
if [ -z "$VERSION" ]; then
32+
echo "No version found in PR title. Please include version in title like: 2.0.65.dev1004030443"
33+
exit 1
34+
fi
35+
36+
echo "Extracted version: $VERSION"
37+
echo "version=$VERSION" >> $GITHUB_OUTPUT
38+
39+
- name: Setup uv
40+
uses: astral-sh/setup-uv@v5
41+
with:
42+
enable-cache: true
43+
44+
- name: Setup Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version-file: ".python-version"
48+
49+
- name: Modify pyproject.toml for custom UiPath version
50+
shell: bash
51+
run: |
52+
# Backup original pyproject.toml
53+
cp pyproject.toml pyproject.toml.backup
54+
55+
# Update the uipath dependency to the custom version
56+
sed -i 's|"uipath>=.*"|"uipath==${{ steps.extract-version.outputs.version }}"|' pyproject.toml
57+
58+
59+
60+
# Add or update [tool.uv.sources] section if it doesn't exist
61+
if ! grep -q "\[tool\.uv\.sources\]" pyproject.toml; then
62+
echo "" >> pyproject.toml
63+
echo "[tool.uv.sources]" >> pyproject.toml
64+
echo 'uipath = { index = "testpypi" }' >> pyproject.toml
65+
else
66+
# Update existing sources if needed
67+
if ! grep -q 'uipath = { index = "testpypi" }' pyproject.toml; then
68+
sed -i '/\[tool\.uv\.sources\]/a uipath = { index = "testpypi" }' pyproject.toml
69+
fi
70+
fi
71+
72+
echo "Modified pyproject.toml to use UiPath version ${{ steps.extract-version.outputs.version }} from testpypi"
73+
echo "=== Modified pyproject.toml content ==="
74+
grep -A5 -B5 "uipath\|testpypi" pyproject.toml || true
75+
76+
- name: Install dependencies
77+
run: uv sync --all-extras
78+
79+
- name: Check static types
80+
run: uv run mypy --config-file pyproject.toml .
81+
82+
- name: Check linting
83+
run: uv run ruff check .
84+
85+
- name: Check formatting
86+
run: uv run ruff format --check .
87+
88+
- name: Restore original pyproject.toml
89+
if: always()
90+
shell: bash
91+
run: |
92+
mv pyproject.toml.backup pyproject.toml

.github/workflows/lint.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@ on:
44
workflow_call
55

66
jobs:
7+
# Job that runs when custom version testing is enabled - just completes successfully
8+
skip-lint:
9+
name: Skip Lint (Custom Version Testing)
10+
runs-on: ubuntu-latest
11+
if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')
12+
permissions:
13+
contents: read
14+
steps:
15+
- name: Skip lint for custom version testing
16+
run: |
17+
echo "Custom version testing enabled - skipping normal lint process"
18+
echo "This job completes successfully to allow PR merging"
19+
20+
# Job that runs normal lint process when custom version testing is NOT enabled
721
lint:
822
name: Lint
923
runs-on: ubuntu-latest
24+
if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')"
1025
permissions:
1126
contents: read
1227

.github/workflows/publish-dev.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,47 @@ jobs:
3232
with:
3333
python-version-file: ".python-version"
3434

35+
- name: Modify pyproject.toml for custom UiPath version
36+
if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')
37+
shell: bash
38+
run: |
39+
# Backup original pyproject.toml
40+
cp pyproject.toml pyproject.toml.backup
41+
42+
# Extract custom version from PR title
43+
PR_TITLE="${{ github.event.pull_request.title }}"
44+
VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+' | head -1)
45+
46+
if [ -z "$VERSION" ]; then
47+
echo "No version found in PR title. Please include version like: 2.0.65.dev1004030443"
48+
exit 1
49+
fi
50+
51+
echo "Extracted version: $VERSION"
52+
53+
# Update the uipath dependency to the custom version (match both == and >= patterns)
54+
# Target only the dependency lines in dependencies arrays, not project name
55+
sed -i '/dependencies = \[/,/\]/ s|"uipath[=><^~!]*[^"]*"|"uipath=='$VERSION'"|' pyproject.toml
56+
sed -i '/\[project\.optional-dependencies\]/,/^\[/ s|"uipath[=><^~!]*[^"]*"|"uipath=='$VERSION'"|' pyproject.toml
57+
58+
59+
60+
# Add or update [tool.uv.sources] section if it doesn't exist
61+
if ! grep -q "\[tool\.uv\.sources\]" pyproject.toml; then
62+
echo "" >> pyproject.toml
63+
echo "[tool.uv.sources]" >> pyproject.toml
64+
echo 'uipath = { index = "testpypi" }' >> pyproject.toml
65+
else
66+
# Update existing sources if needed
67+
if ! grep -q 'uipath = { index = "testpypi" }' pyproject.toml; then
68+
sed -i '/\[tool\.uv\.sources\]/a uipath = { index = "testpypi" }' pyproject.toml
69+
fi
70+
fi
71+
72+
echo "Modified pyproject.toml to use UiPath version $VERSION from testpypi"
73+
echo "=== Modified pyproject.toml content ==="
74+
grep -A5 -B5 "uipath\|testpypi" pyproject.toml || true
75+
3576
- name: Install dependencies
3677
run: uv sync --all-extras
3778

@@ -128,4 +169,4 @@ jobs:
128169
- name: Publish
129170
run: uv publish --index testpypi
130171
env:
131-
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
172+
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Publish Fixed Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
good_version:
7+
description: 'Version number of the good/fixed version from PyPI (e.g., 0.0.110)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
publish-prior-stable-version:
13+
name: Publish Fixed Version
14+
runs-on: ubuntu-latest
15+
environment: pypi
16+
17+
permissions:
18+
contents: write
19+
id-token: write
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup uv
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
enable-cache: true
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version-file: ".python-version"
34+
35+
- name: Get current version and increment
36+
id: version
37+
shell: pwsh
38+
run: |
39+
$pyprojcontent = Get-Content pyproject.toml -Raw
40+
$CURRENT_VERSION = ($pyprojcontent | Select-String -Pattern '(?m)^\[project\][^\[]*?version\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[1].Value
41+
42+
# Parse version and increment patch number
43+
$versionParts = $CURRENT_VERSION.Split('.')
44+
$major = [int]$versionParts[0]
45+
$minor = [int]$versionParts[1]
46+
$patch = [int]$versionParts[2] + 1
47+
48+
$NEW_VERSION = "$major.$minor.$patch"
49+
50+
Write-Output "current_version=$CURRENT_VERSION" >> $env:GITHUB_OUTPUT
51+
Write-Output "new_version=$NEW_VERSION" >> $env:GITHUB_OUTPUT
52+
Write-Output "good_version=${{ github.event.inputs.good_version }}" >> $env:GITHUB_OUTPUT
53+
54+
Write-Host "Current version: $CURRENT_VERSION"
55+
Write-Host "New version: $NEW_VERSION"
56+
Write-Host "Good version: ${{ github.event.inputs.good_version }}"
57+
58+
- name: Download and extract good version from PyPI
59+
shell: pwsh
60+
run: |
61+
$goodVersion = "${{ github.event.inputs.good_version }}"
62+
$packageName = "uipath-langchain"
63+
64+
Write-Host "Downloading $packageName==$goodVersion from PyPI..."
65+
66+
# Download the source package (tar.gz preferred for easier extraction)
67+
pip download "$packageName==$goodVersion" --no-deps --no-binary=:all: --dest .
68+
69+
# Find the downloaded tar.gz file
70+
$downloadedFile = Get-ChildItem | Where-Object { $_.Name -match "uipath.langchain.*\.tar\.gz$" } | Select-Object -First 1
71+
72+
if ($downloadedFile) {
73+
Write-Host "Found downloaded file: $($downloadedFile.FullName)"
74+
75+
# Extract the tar.gz file
76+
tar -xzf $downloadedFile.FullName --strip-components=1
77+
78+
Write-Host "Extracted good version content to current directory"
79+
80+
# Remove the downloaded tar.gz file
81+
Remove-Item $downloadedFile.FullName
82+
} else {
83+
Write-Error "Could not find downloaded package file"
84+
exit 1
85+
}
86+
87+
- name: Update version to new version in pyproject.toml
88+
shell: pwsh
89+
run: |
90+
(Get-Content pyproject.toml) -replace 'version = "${{ github.event.inputs.good_version }}"', 'version = "${{ steps.version.outputs.new_version }}"' | Set-Content pyproject.toml
91+
Write-Host "Updated version from ${{ github.event.inputs.good_version }} to ${{ steps.version.outputs.new_version }}"
92+
93+
- name: Install dependencies
94+
run: uv sync --all-extras
95+
96+
- name: Build and publish fixed version
97+
run: |
98+
echo "Building version ${{ steps.version.outputs.new_version }} (republishing PyPI version ${{ github.event.inputs.good_version }})..."
99+
uv build
100+
echo "Publishing fixed version to PyPI..."
101+
uv publish
102+
env:
103+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
104+
105+
- name: Summary
106+
run: |
107+
echo "✅ Successfully published version ${{ steps.version.outputs.new_version }} with content from PyPI version ${{ github.event.inputs.good_version }}"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Test Custom Version
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
UIPATH_URL:
7+
required: true
8+
UIPATH_CLIENT_ID:
9+
required: true
10+
UIPATH_CLIENT_SECRET:
11+
required: true
12+
pull_request:
13+
types: [opened, synchronize, labeled, unlabeled]
14+
15+
jobs:
16+
test-core-dev-version:
17+
name: Test Core Dev Version
18+
runs-on: ${{ matrix.os }}
19+
if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')
20+
strategy:
21+
matrix:
22+
python-version: ["3.11", "3.12", "3.13"]
23+
os: [ubuntu-latest, windows-latest]
24+
25+
permissions:
26+
contents: read
27+
pull-requests: read
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Extract version from PR
34+
id: extract-version
35+
shell: bash
36+
run: |
37+
# Extract version from PR title only
38+
PR_TITLE="${{ github.event.pull_request.title }}"
39+
40+
# Search for version pattern in title (any x.y.z.dev version)
41+
VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+' | head -1)
42+
43+
if [ -z "$VERSION" ]; then
44+
echo "No version found in PR title. Please include version in title like: 2.0.65.dev1004030443"
45+
exit 1
46+
fi
47+
48+
echo "Extracted version: $VERSION"
49+
echo "version=$VERSION" >> $GITHUB_OUTPUT
50+
51+
- name: Setup uv
52+
uses: astral-sh/setup-uv@v5
53+
with:
54+
enable-cache: true
55+
56+
- name: Setup Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Modify pyproject.toml for custom UiPath version
62+
shell: bash
63+
run: |
64+
# Backup original pyproject.toml
65+
cp pyproject.toml pyproject.toml.backup
66+
67+
# Update the uipath dependency to the custom version
68+
sed -i 's|"uipath>=.*"|"uipath==${{ steps.extract-version.outputs.version }}"|' pyproject.toml
69+
70+
71+
72+
# Add or update [tool.uv.sources] section if it doesn't exist
73+
if ! grep -q "\[tool\.uv\.sources\]" pyproject.toml; then
74+
echo "" >> pyproject.toml
75+
echo "[tool.uv.sources]" >> pyproject.toml
76+
echo 'uipath = { index = "testpypi" }' >> pyproject.toml
77+
else
78+
# Update existing sources if needed
79+
if ! grep -q 'uipath = { index = "testpypi" }' pyproject.toml; then
80+
sed -i '/\[tool\.uv\.sources\]/a uipath = { index = "testpypi" }' pyproject.toml
81+
fi
82+
fi
83+
84+
echo "Modified pyproject.toml to use UiPath version ${{ steps.extract-version.outputs.version }} from testpypi"
85+
echo "=== Modified pyproject.toml content ==="
86+
grep -A5 -B5 "uipath\|testpypi" pyproject.toml || true
87+
88+
- name: Install dependencies with specific UiPath version
89+
run: uv sync --all-extras
90+
91+
- name: Run all tests
92+
run: uv run pytest
93+
env:
94+
UIPATH_URL: ${{ secrets.UIPATH_URL }}
95+
UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }}
96+
UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }}
97+
98+
- name: Restore original pyproject.toml
99+
if: always()
100+
shell: bash
101+
run: |
102+
mv pyproject.toml.backup pyproject.toml

0 commit comments

Comments
 (0)