Skip to content

Commit

Permalink
[apache#2518] feat(build): support Github CI for client-python (apach…
Browse files Browse the repository at this point in the history
…e#2684)

### What changes were proposed in this pull request?

 - use Gradle to manage Python build.
 - add Github CI
 - `./gradlew clean clients:client-python:test`

### Why are the changes needed?

Fix: apache#2518 

### Does this PR introduce _any_ user-facing change?

- no

### How was this patch tested?

- `./gradlew clean clients:client-python:test`
  • Loading branch information
coolderli authored and xunliu committed Mar 29, 2024
1 parent 3f516c9 commit b0677c4
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/backend-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
- api/**
- bin/**
- catalogs/**
- clients/**
- clients/client-java/**
- clients/client-java-runtime/**
- clients/filesystem-hadoop3/**
- clients/filesystem-hadoop3-runtime/**
- common/**
- conf/**
- core/**
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ jobs:
- api/**
- bin/**
- catalogs/**
- clients/**
- clients/client-java/**
- clients/client-java-runtime/**
- clients/filesystem-hadoop3/**
- clients/filesystem-hadoop3-runtime/**
- common/**
- conf/**
- core/**
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/frontend-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
- api/**
- bin/**
- catalogs/**
- clients/**
- clients/client-java/**
- clients/client-java-runtime/**
- clients/filesystem-hadoop3/**
- clients/filesystem-hadoop3-runtime/**
- common/**
- conf/**
- core/**
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Python CI'

on:
push:
branches: [ "main", "branch-*" ]

pull_request:
branches: [ "main", "branch-*" ]
paths:
- 'clients/client-python/**'
concurrency:
group: ${{ github.worklfow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_requests' }}

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python: [ '3.8', '3.9', '3.10', '3.11' ]

steps:
- uses: actions/checkout@v4
- name: Unit tests
run: ./gradlew clean clients:client-python:test
37 changes: 37 additions & 0 deletions clients/client-python/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2024 Datastrato Pvt Ltd.
* This software is licensed under the Apache License version 2.
*/

tasks.withType(Exec::class) {
workingDir = file("${project.projectDir}")
}

tasks {
val pythonVersion by registering(Exec::class) {
commandLine("python", "--version")
}

val installPip by registering(Exec::class) {
dependsOn(pythonVersion)
commandLine("python", "-m", "pip", "install", "--upgrade", "pip")
}

val installDeps by registering(Exec::class) {
dependsOn(installPip)
commandLine("python", "-m", "pip", "install", "-r", "requirements.txt")
}

val pyTest by registering(Exec::class) {
dependsOn(installDeps)
commandLine("pytest", "${project.projectDir}/tests")
}

test {
dependsOn(pyTest)
}

clean {
delete("build")
}
}
8 changes: 7 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ include(
)
include("catalogs:catalog-hadoop")
include("catalogs:catalog-messaging-kafka")
include("clients:client-java", "clients:client-java-runtime", "clients:filesystem-hadoop3", "clients:filesystem-hadoop3-runtime")
include(
"clients:client-java",
"clients:client-java-runtime",
"clients:filesystem-hadoop3",
"clients:filesystem-hadoop3-runtime",
"clients:client-python"
)
include("trino-connector")
include("spark-connector")
include("web")
Expand Down

0 comments on commit b0677c4

Please sign in to comment.