-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### 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: #2518 ### Does this PR introduce _any_ user-facing change? - no ### How was this patch tested? - `./gradlew clean clients:client-python:test`
- Loading branch information
Showing
6 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters