-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from qdrvm/ci/ci_build
ci tests
- Loading branch information
Showing
9 changed files
with
607 additions
and
0 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,25 @@ | ||
#!/bin/bash | ||
|
||
cd ../ | ||
|
||
run_build() { | ||
build_type=$1 | ||
build_dir=$2 | ||
|
||
echo "Building with BUILD_TYPE=$build_type..." | ||
|
||
make -B build BUILD_TYPE="$build_type" BUILD_DIR="$build_dir" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Error: Build failed for BUILD_TYPE=$build_type." | ||
exit 1 | ||
else | ||
echo "Success: Build completed successfully for BUILD_TYPE=$build_type." | ||
fi | ||
} | ||
|
||
run_build Debug build-debug | ||
run_build Release build | ||
|
||
echo "All build tests completed successfully." | ||
exit 0 |
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,24 @@ | ||
#!/bin/bash | ||
|
||
export HEADER_FILE="/dev/null" | ||
export CBINDGEN_CONFIG="../../cbindgen.toml" | ||
|
||
CRATES_DIR="../crates" | ||
|
||
for dir in "$CRATES_DIR"/*; do | ||
if [ -d "$dir" ]; then | ||
echo "Entering directory: $dir" | ||
cd "$dir" || exit | ||
|
||
cargo test | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Error: cargo test failed in $dir" | ||
exit 1 | ||
fi | ||
|
||
cd - || exit | ||
fi | ||
done | ||
|
||
echo "All tests completed successfully." |
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 @@ | ||
import os | ||
|
||
required_structure = { | ||
'install': { | ||
'include': { | ||
'arkworks': ['arkworks.h'], | ||
'bandersnatch_vrfs': ['bandersnatch_vrfs.h'], | ||
'schnorrkel': ['schnorrkel.h'] | ||
}, | ||
'lib': { | ||
'cmake': { | ||
'arkworks': ['arkworksConfig.cmake'], | ||
'bandersnatch_vrfs': ['bandersnatch_vrfsConfig.cmake'], | ||
'schnorrkel': ['schnorrkelConfig.cmake'] | ||
}, | ||
'': ['libarkworks_crust.a', 'libbandersnatch_vrfs_crust.a', 'libschnorrkel_crust.a'] | ||
} | ||
} | ||
} | ||
|
||
def check_structure(base_path, structure): | ||
for folder, contents in structure.items(): | ||
current_path = os.path.join(base_path, folder) | ||
|
||
if isinstance(contents, dict): | ||
if not os.path.isdir(current_path): | ||
print(f"Missing directory: {current_path}") | ||
else: | ||
check_structure(current_path, contents) | ||
else: | ||
for file in contents: | ||
file_path = os.path.join(base_path, folder, file) | ||
if not os.path.isfile(file_path): | ||
print(f"Missing file: {file_path}") | ||
|
||
base_path = '../' | ||
|
||
check_structure(base_path, required_structure) |
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,34 @@ | ||
#!/bin/bash | ||
|
||
scripts=("build_test.sh" "check_files.py" "cargo_tests.sh") | ||
|
||
error_found=0 | ||
|
||
for script in "${scripts[@]}"; do | ||
echo "Running $script..." | ||
|
||
if [[ "$script" == *.py ]]; then | ||
python3 "$script" | ||
elif [[ "$script" == *.sh ]]; then | ||
bash "$script" | ||
else | ||
echo "Unknown file type for script: $script" | ||
error_found=1 | ||
continue | ||
fi | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Error: $script failed." | ||
error_found=1 | ||
else | ||
echo "Success: $script completed successfully." | ||
fi | ||
done | ||
|
||
if [ $error_found -ne 0 ]; then | ||
echo "One or more scripts failed." | ||
exit 1 | ||
else | ||
echo "All scripts ran successfully." | ||
exit 0 | ||
fi |
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,30 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache folders | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
build | ||
build-debug | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/CMakeLists.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-build- | ||
- name: Run tests | ||
working-directory: .ci | ||
run: bash run_all_tests.sh |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
target | ||
/build | ||
/generated | ||
/install | ||
/.idea | ||
/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
BUILD_DIR ?= build | ||
BUILD_TYPE ?= Release | ||
|
||
BUILD_THREADS := $$(nproc 2>/dev/null || sysctl -n hw.ncpu) | ||
|
||
|
||
build: | ||
if [ "$$(uname)" = "Darwin" ]; then \ | ||
export SDKROOT=$$(xcrun --sdk macosx --show-sdk-path) ; \ | ||
fi ; \ | ||
cmake . -B"$(BUILD_DIR)" -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ; \ | ||
cmake --build "$(BUILD_DIR)" -- -j$(BUILD_THREADS) ; \ | ||
cmake --install "$(BUILD_DIR)" | ||
|
||
run_tests: | ||
cd .ci && ./run_all_tests.sh |
Oops, something went wrong.