Skip to content

Commit

Permalink
Some more adjustments for uv
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Dec 17, 2024
1 parent 68fca78 commit 0855459
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,22 @@ jobs:
- name: check-java
run: java --version

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Uv
uses: astral-sh/setup-uv@v4

- name: Install Poetry
uses: snok/install-poetry@v1
- name: "Set up Python"
uses: actions/setup-python@v5
with:
version: 1.8.1
plugins: poetry-plugin-export
python-version-file: "rewrite/.python-version"

- name: build-java
run: ./gradlew ${{ env.GRADLE_SWITCHES }} build

- name: build-python
run: |
for directory in rewrite/rewrite-*/; do
if [ -f "$directory/pyproject.toml" ]; then
echo "Building project in $directory"
cd "$directory"
poetry install --no-interaction --no-ansi
poetry build
poetry run pytest
cd - > /dev/null
fi
done
echo "Building project in rewrite"
cd "rewrite"
uv sync --all-extras --dev
- name: publish-snapshots
if: github.event_name != 'pull_request'
Expand Down
6 changes: 3 additions & 3 deletions rewrite-python/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
testImplementation("org.junit-pioneer:junit-pioneer:latest.release")
}

val poetryProjectDir = file("../rewrite")
val pythonProjectDir = file("../rewrite")
val outputDir = layout.buildDirectory.dir("resources/main/META-INF")
val requirementsFile = outputDir.map { it.file("python-requirements.txt") }

Expand All @@ -42,8 +42,8 @@ tasks.register("prepareOutputDir") {

tasks.register<Exec>("exportPoetryRequirements") {
dependsOn("prepareOutputDir")
workingDir = poetryProjectDir
commandLine("sh", "-c", "poetry export --without-hashes -o ${requirementsFile.get().asFile.absolutePath}")
workingDir = pythonProjectDir
commandLine("sh", "-c", "uv export --no-header --frozen --no-hashes --no-dev -o ${requirementsFile.get().asFile.absolutePath}")
standardOutput = System.out
errorOutput = System.err
}
Expand Down

0 comments on commit 0855459

Please sign in to comment.