-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: TES struct #36
Closed
+2,379
−0
Closed
Feat: TES struct #36
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
7cf9dfd
Initial commit
aaravm 0087881
added tes-autogenerated code for all the models
aaravm 4560fc4
corrected workflow
aaravm 4210498
added function create_task from autogenerated, trying some stuff for …
aaravm 61fcb7a
made service.rs class
aaravm 780e7ff
changed return type of service class, added TES class, using service …
aaravm 47e3ca5
removed return type temporarily fortes class
aaravm df64e6d
added tests for service class
aaravm b0ea439
added unit test for tes class
aaravm b54b56f
changed a lot of names
aaravm 4e5c8dc
merged configuration and service class
aaravm ce11ae1
refactoring
pavelnikonorov 395b00a
tes.rs code moved to mod.rs to avoid import as ::tes::tes
pavelnikonorov b1c12fe
corrected tests in service.rs
aaravm 432ca96
added service-info(not complete) and made build.sh
aaravm 57406a1
Update Readme.md
aaravm ab08a44
Update Readme.md
aaravm 02685c0
added serviceinfo class
aaravm cbba4ae
checking whether correct from servicinfo
aaravm be2e486
Merge remote-tracking branch 'origin/dev' into dev
aaravm e9ccf43
checking tests
aaravm d4faee2
added service-info unit test using funnel
aaravm f1bd0c5
added check function in TES
aaravm c9cdbfc
openapi models auto-generation: build script update, rm generated mod…
pavelnikonorov 27bab17
refactoring, fixes, tests improvement
pavelnikonorov d656d3b
CI/CD workflow update
pavelnikonorov afbe68c
CI/CD workflow fix
pavelnikonorov da80b57
CI/CD workflow fix
pavelnikonorov a655a90
CI/CD workflow fix
pavelnikonorov 6514f6e
CI/CD workflow fix
pavelnikonorov e0bdcf5
commenting out non-finished Task struct that fails CI/CD
pavelnikonorov a1cd3bf
applying code formating using
pavelnikonorov 97595e0
rustfmt.toml: ignore code formatting checks of the autogenerated models
pavelnikonorov a6b63ac
changed return type of create to Task
aaravm 431a831
added status to Task
aaravm e447b5a
corrected CI/CD
aaravm bcce6ec
trying out tes_status unit tests
aaravm f08c9dc
unit test working, with no params
aaravm d8ef075
completed the unit test of tes_status
aaravm 49a702d
CI/CD framework
aaravm c110379
CI/CD
aaravm 4d88c44
added cancel function
aaravm dda27a7
added cancel fn in Task
aaravm df1fc62
adding cancel unit test
aaravm a25c499
changed transport struct for optional params and data
aaravm 3c92b70
changed the status fn to Task struct
aaravm bc07b65
moved cancel to Task, added get in TES
aaravm 0f7decc
added list tasks fn
aaravm 19ece96
correcting get list() fn
aaravm 4e415a5
cargo fmt: code formatting
pavelnikonorov ac64bb3
tests simplifaction though TES and Task objects reuse
pavelnikonorov 1487961
corrected the list fn
aaravm 976846b
merged changes
aaravm c96b636
Sorcery-ai suggestion
aaravm d613722
Sorcery-ai suggestion
aaravm 4f482d3
Apply suggestions from code review
aaravm ebc9bec
sorcery-ai suggestions
aaravm e56a623
sorcery-ai suggestions
aaravm d37b000
sorcery-ai suggestions
aaravm 7725298
added some Pavel's suggestions
aaravm bad81eb
readding accidently deleted workflows folder
aaravm c95ac80
Update Readme.md
aaravm 198e0f8
changed Cargo.toml
aaravm 206c6c4
changed the sample file, changed author name
aaravm 2f2b6a8
changed versions of ci.yml
aaravm 4a41548
added parameters in a much easier manner
aaravm 2d48bdd
changing git ignore file
aaravm a5b484e
changed local and github workflows
aaravm 598646f
correct github workflows
aaravm 1369f7e
correct github workflows
aaravm 8ec57cc
using cargo nextest for tests
aaravm 1913d3d
correcting ci/cd
aaravm ee0948c
correcting ci/cd
aaravm 44a1d64
removing commented out code
aaravm 5a13d19
moved ListTaskParam to model.rs
aaravm 0e29df7
added unit coverage
aaravm e02346c
trying to remove installing rust in ci/cd
aaravm dff1a21
trying to remove installing rust in ci/cd
aaravm bedf68f
trying to remove installing rust in ci/cd
aaravm 4ee3302
trying to remove installing rust in ci/cd
aaravm b8ea658
trying to remove installing rust in ci/cd
aaravm 2d24c43
trying to remove installing rust in ci/cd
aaravm f6ef231
trying to remove installing rust in ci/cd
aaravm 5d9c4bf
remove comments
aaravm 0d8d25c
changed openapi generator to Bash Launcher
aaravm 7fa6bd6
remove nodejs
aaravm 00b6367
changed gitignore
aaravm 6566d7d
sorcery suggestions
aaravm 9e9a4a7
sorcery-ai suggestions
aaravm 81e26e6
sorcery-ai suggestions
aaravm 816e47c
sorcery ai suggestion
aaravm a9ee309
sorcery-ai suggestion
aaravm a9b3c0b
separate cargo.toml
aaravm 8ddb90b
initial commit
aaravm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: GitHub CI/CD Workflow | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:24.04 | ||
env: | ||
OPENSSL_DIR: /usr/include/openssl | ||
OPENSSL_LIB_DIR: /usr/lib/x86_64-linux-gnu | ||
OPENSSL_INCLUDE_DIR: /usr/include/openssl | ||
|
||
steps: | ||
- name: Install dependencies | ||
run: | | ||
apt-get update | ||
apt-get install -y curl git build-essential libssl-dev | ||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Install Rust | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
- name: Set up JDK 11 # required for build-models.sh | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22' | ||
- name: Install Funnel | ||
run: | | ||
if [ -d "funnel" ]; then rm -Rf funnel; fi | ||
git clone https://github.com/ohsu-comp-bio/funnel.git | ||
cd funnel && make && make install && cd .. | ||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Build models | ||
run: | | ||
bash ./build-models.sh | ||
- name: Build | ||
run: | | ||
cargo build --verbose | ||
- name: Run tests | ||
run: | | ||
bash ./run-tests.sh | ||
- name: Lint | ||
run: | | ||
cargo clippy -- -D warnings | ||
- name: Format | ||
run: | | ||
cargo fmt -- ./lib/src/serviceinfo/models/*.rs # workaround to fix autogenerated code formatting | ||
cargo fmt -- ./lib/src/tes/models/*.rs | ||
cargo fmt -- --check |
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,98 @@ | ||
name: Local CI/CD Workflow | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:24.04 | ||
env: | ||
OPENSSL_DIR: /usr/include/openssl | ||
OPENSSL_LIB_DIR: /usr/lib/x86_64-linux-gnu | ||
OPENSSL_INCLUDE_DIR: /usr/include/openssl | ||
|
||
steps: | ||
|
||
- name: Cache Rust dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cargo | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
|
||
- name: Cache Rust build output | ||
uses: actions/cache@v3 | ||
with: | ||
path: target | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-build- | ||
|
||
- name: Cache Maven dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-maven- | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
|
||
- name: Cache Funnel dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/funnel/build | ||
key: ${{ runner.os }}-funnel-${{ hashFiles('**/funnel/*') }} | ||
restore-keys: ${{ runner.os }}-funnel- | ||
|
||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Install Rust | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
|
||
- name: Set up JDK 11 # required for build-models.sh | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22' | ||
- name: Install Funnel | ||
run: | | ||
if [ -d "funnel" ]; then rm -Rf funnel; fi | ||
git clone https://github.com/ohsu-comp-bio/funnel.git | ||
cd funnel && make && make install && cd .. | ||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Build models | ||
run: | | ||
. $HOME/.cargo/env | ||
bash ./build-models.sh | ||
- name: Build | ||
run: | | ||
. $HOME/.cargo/env | ||
cargo build --verbose | ||
- name: Run tests | ||
run: | | ||
. $HOME/.cargo/env | ||
bash ./run-tests.sh | ||
- name: Lint | ||
run: | | ||
. $HOME/.cargo/env | ||
cargo clippy -- -D warnings | ||
- name: Format | ||
run: | | ||
. $HOME/.cargo/env | ||
# rustup install nightly – fails for some reason | ||
# rustup default nightly | ||
cargo fmt -- ./lib/src/serviceinfo/models/*.rs # workaround to fix autogenerated code formatting | ||
cargo fmt -- ./lib/src/tes/models/*.rs | ||
cargo fmt -- --check # --config-path ./rustfmt.toml |
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,7 @@ | ||
target/ | ||
debug/ | ||
Cargo.lock | ||
openapitools.json | ||
*.log | ||
funnel-work-dir/ | ||
funnel/ |
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,12 @@ | ||
[workspace] | ||
members = [ | ||
"lib" | ||
] | ||
|
||
[workspace.package] | ||
version = "0.1.0" | ||
authors = ["Aarav Mehta <[email protected]> (Google Summer of Code Participant)", "Pavel Nikonorov <[email protected]> (Google Summer of Code Mentor; GENXT)", "ELIXIR Cloud & AAI <[email protected]> (ELIXIR Europe)"] | ||
edition = "2021" | ||
readme = "./README.md" | ||
license-file = "LICENSE.txt" | ||
repository = "https://github.com/elixir-cloud-aai/ga4gh-sdk.git" |
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,36 @@ | ||||||
# A Generic SDK and CLI for GA4GH API services | ||||||
|
||||||
## Building | ||||||
|
||||||
First, clone the repository, and then run the following command to automatically generate models using OpenAPI specifications: | ||||||
``` | ||||||
bash ./build-models.sh | ||||||
``` | ||||||
|
||||||
To build the project: | ||||||
``` | ||||||
cargo build | ||||||
``` | ||||||
|
||||||
## Running the tests | ||||||
|
||||||
Before running the tests, you need to install Funnel, a task execution system that is compatible with the GA4GH TES API. Follow the instructions in the [Funnel Developer's Guide](https://ohsu-comp-bio.github.io/funnel/docs/development/developers/) to install Funnel. | ||||||
|
||||||
Once you have installed Funnel, you can run the tests. This will automatically run Funnel as well: | ||||||
|
||||||
``` | ||||||
bash ./run-tests.sh | ||||||
``` | ||||||
or, you can run using: | ||||||
``` | ||||||
cargo nextest run | ||||||
``` | ||||||
For checking the unit coverage, you can run: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (documentation): Consider changing 'unit coverage' to 'unit test coverage'. Changing 'unit coverage' to 'unit test coverage' can improve clarity.
Suggested change
|
||||||
``` | ||||||
cargo llvm-cov nextest | ||||||
``` | ||||||
|
||||||
To test the CI/CD workflow locally, install `act` and run the following command: | ||||||
``` | ||||||
act -j build --container-architecture linux/amd64 -P ubuntu-latest=ubuntu:24.04 --reuse | ||||||
``` |
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,79 @@ | ||
# Exit immediately if a command exits with a non-zero status. | ||
set -e | ||
|
||
set -u | ||
|
||
# Ensure the OpenAPI Generator JAR file is set up | ||
mkdir -p ~/bin/openapitools | ||
OPENAPI_GENERATOR_JAR=~/bin/openapitools/openapi-generator-cli.jar | ||
if [ ! -f "$OPENAPI_GENERATOR_JAR" ]; then | ||
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.7.0/openapi-generator-cli-7.7.0.jar -o "$OPENAPI_GENERATOR_JAR" | ||
fi | ||
|
||
get_git_repo_name() { | ||
# Extract the URL of the remote "origin" | ||
url=$(git config --get remote.origin.url) | ||
|
||
# Extract the repository name from the URL | ||
repo_name=$(basename -s .git "$url") | ||
|
||
echo "$repo_name" | ||
} | ||
|
||
SCRIPT_DIR="$(pwd)" | ||
|
||
generate_openapi_models() { | ||
# Parameters | ||
OPENAPI_SPEC_PATH="$1" | ||
API_NAME="$2" | ||
DESTINATION_DIR="$3" | ||
|
||
# Define the temporary output directory for the OpenAPI generator | ||
TEMP_OUTPUT_DIR=$(mktemp -d) | ||
|
||
# Remove the temporary directory at the end of the script | ||
trap 'rm -rf "$TEMP_OUTPUT_DIR"' EXIT | ||
|
||
# Run the OpenAPI generator CLI using the JAR file | ||
java -jar "$OPENAPI_GENERATOR_JAR" generate -g rust \ | ||
-i "$OPENAPI_SPEC_PATH" \ | ||
-o "$TEMP_OUTPUT_DIR" \ | ||
--additional-properties=useSingleRequestParameter=true | ||
|
||
# Check if the generation was successful | ||
if [ $? -ne 0 ]; then | ||
echo "OpenAPI generation failed. Check the verbose output for details." | ||
exit 1 | ||
fi | ||
|
||
# Remove the openapitools.json file | ||
rm -f ./openapitools.json | ||
|
||
echo "TEMP_OUTPUT_DIR is $TEMP_OUTPUT_DIR" | ||
|
||
# Modify the import statements in each generated file | ||
SED_RULE="s/use crate::models;/#![allow(unused_imports)]\n#![allow(clippy::empty_docs)]\nuse crate::$API_NAME::models;/" | ||
for file in $(find "$TEMP_OUTPUT_DIR" -name '*.rs'); do | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# macOS (BSD) sed syntax | ||
sed -i '' "$SED_RULE" "$file" | ||
else | ||
# Linux (GNU) sed syntax | ||
sed -i "$SED_RULE" "$file" | ||
fi | ||
done | ||
|
||
rm -rf "$DESTINATION_DIR/models" | ||
mkdir -p "$DESTINATION_DIR" | ||
cp -r "$TEMP_OUTPUT_DIR/src/models" "$DESTINATION_DIR" | ||
|
||
echo "OpenAPI generation complete. Models copied to $DESTINATION_DIR" | ||
} | ||
|
||
generate_openapi_models \ | ||
"https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-info/develop/service-info.yaml" \ | ||
"serviceinfo" "$SCRIPT_DIR/lib/src/serviceinfo/" | ||
|
||
generate_openapi_models \ | ||
"https://raw.githubusercontent.com/ga4gh/task-execution-schemas/develop/openapi/task_execution_service.openapi.yaml" \ | ||
"tes" "$SCRIPT_DIR/lib/src/tes/" |
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,38 @@ | ||
|
||
[package] | ||
name = "ga4gh-lib" | ||
description = """ | ||
Generic SDK and CLI for GA4GH API services | ||
""" | ||
repository = "https://github.com/elixir-cloud-aai/ga4gh-sdk/tree/main/lib" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
readme.workspace = true | ||
license-file.workspace = true | ||
# rust-version = "1.74" | ||
|
||
[dependencies] | ||
tokio = { version = "1", features = ["full"] } | ||
serde = "^1.0" | ||
serde_derive = "^1.0" | ||
serde_json = "^1.0" | ||
url = "^2.2" | ||
uuid = { version = "^1.0", features = ["serde", "v4"] } | ||
log = "0.4" | ||
env_logger = "0.9" | ||
once_cell = "1.8.0" | ||
|
||
[dependencies.reqwest] | ||
version = "^0.11" | ||
features = ["json", "multipart"] | ||
|
||
[dev-dependencies] | ||
mockito = "0.31" | ||
mockall = "0.10.2" | ||
cargo-nextest = "0.9.30" | ||
|
||
[lib] | ||
name = "ga4gh_sdk" | ||
path = "src/lib.rs" | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (documentation): Consider adding a brief description of Funnel.
Adding a brief description of Funnel can help users quickly understand what it is without needing to follow the link.