-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
267 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
pipeline { | ||
agent any | ||
|
||
options{ | ||
skipDefaultCheckout(true) | ||
} | ||
environment { | ||
PYTHONPATH = "${env.WORKSPACE}/.venv/bin" | ||
CUDACXX = '/usr/local/cuda-12/bin/nvcc' | ||
CMAKE_ARGS = "-DLLAMA_CUBLAS=on" | ||
PATH="/usr/local/cuda-12.3/bin:$PATH" | ||
LD_LIBRARY_PATH="/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH" | ||
} | ||
|
||
|
||
stages { | ||
|
||
stage('Checkout') { | ||
steps { | ||
cleanWs() | ||
checkout scm | ||
} | ||
} | ||
|
||
stage('Create venv'){ | ||
steps { | ||
sh 'python3 -m venv .venv' | ||
} | ||
} | ||
|
||
stage('Install dependencies'){ | ||
steps { | ||
withPythonEnv(PYTHONPATH){ | ||
sh 'pip install -e .' | ||
} | ||
} | ||
|
||
} | ||
|
||
stage('Config'){ | ||
steps{ | ||
withPythonEnv(PYTHONPATH){ | ||
sh 'python3 ci/modify_config.py' | ||
sh 'rm -rf $JENKINS_HOME/ci_test_data/data/vectordb/ci_test' | ||
sh 'cp -r $JENKINS_HOME/ci_test_data/data/backup_vectordb/ci_test $JENKINS_HOME/ci_test_data/data/vectordb' | ||
} | ||
} | ||
} | ||
|
||
stage('Linting'){ | ||
steps { | ||
withPythonEnv(PYTHONPATH){ | ||
sh 'pip install ruff' | ||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE'){ | ||
sh 'ruff check . --exclude .pyenv-var-lib-jenkins-workspace-capstone_5-.venv-bin --output-format junit -o ruff-report.xml' | ||
sh 'ruff format .' | ||
} | ||
} | ||
} | ||
post { | ||
always{ | ||
withChecks('Lint Checks'){ | ||
junit 'ruff-report.xml' | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Static type check'){ | ||
steps { | ||
withPythonEnv(PYTHONPATH){ | ||
sh 'pip install mypy' | ||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE'){ | ||
sh 'python3 -m mypy -p src.grag --junit-xml mypy-report.xml' | ||
} | ||
} | ||
} | ||
post { | ||
always{ | ||
withChecks('Static Type Checks'){ | ||
junit 'mypy-report.xml' | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
stage('Tests'){ | ||
steps{ | ||
sh 'docker pull chromadb/chroma' | ||
sh 'docker run -d --name jenkins-chroma -p 8000:8000 chromadb/chroma' | ||
withPythonEnv(PYTHONPATH){ | ||
sh 'pip install pytest' | ||
sh 'python3 ci/unlock_deeplake.py' | ||
sh 'pytest src -vvv --junitxml=pytest-report.xml' | ||
} | ||
} | ||
post { | ||
always{ | ||
sh 'docker stop jenkins-chroma' | ||
sh 'docker rm jenkins-chroma' | ||
withChecks('Integration Tests'){ | ||
junit 'pytest-report.xml' | ||
} | ||
|
||
cleanWs( | ||
cleanWhenNotBuilt: false, | ||
deleteDirs: true, | ||
disableDeferredWipeout: true, | ||
notFailBuild: true, | ||
patterns: [[pattern: '.gitignore', type: 'INCLUDE'], | ||
[pattern: '.propsfile', type: 'EXCLUDE']] | ||
) | ||
} | ||
} | ||
} | ||
|
||
} | ||
} |
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 @@ | ||
import os | ||
|
||
from grag.components.utils import get_config | ||
|
||
get_config(load_env=True) | ||
|
||
print(os.environ['HF_TOKEN']) |
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,18 @@ | ||
import configparser | ||
import os | ||
|
||
from grag.components.utils import get_config | ||
|
||
config = configparser.ConfigParser() | ||
|
||
workspace = os.getenv('WORKSPACE') | ||
jenkins_home = os.getenv('JENKINS_HOME') | ||
|
||
config = get_config() | ||
config['root']['root_path'] = f'{workspace}' | ||
config['data']['data_path'] = f'{jenkins_home}/ci_test_data/data' | ||
config['llm']['base_dir'] = f'{jenkins_home}/ci_test_models/models' | ||
config['env']['env_path'] = f'{jenkins_home}/env_file/.env' | ||
|
||
with open(f'{workspace}/src/config.ini', 'w') as configfile: | ||
config.write(configfile) |
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,11 @@ | ||
import os | ||
import shutil | ||
from pathlib import Path | ||
|
||
jenkins_home = os.getenv('JENKINS_HOME') | ||
|
||
lock_path = Path(jenkins_home) / 'ci_test_data/data/vectordb/ci_test/dataset_lock.lock' | ||
|
||
if os.path.exists(lock_path): | ||
shutil.rmtree(lock_path) | ||
print('Deleting lock file: {}'.format(lock_path)) |
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
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
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
Oops, something went wrong.