Fix the need for a dummy bindings.rs file included in the repo (#296)

This commit is contained in:
Jeremy Felder
2023-12-13 12:45:00 +02:00
committed by GitHub
parent 644aa93d3f
commit d5dd16dd9b
4 changed files with 14 additions and 5 deletions

View File

@@ -18,7 +18,12 @@ jobs:
uses: actions/checkout@v3
- name: Check rustfmt
working-directory: ./wrappers/rust
run: if [[ $(cargo fmt --check) ]]; then echo "Please run cargo fmt"; exit 1; fi
# "-name tagret -prune" removes searching in any directory named "target"
# Formatting by single file is necessary due to generated files not being present
# before building the project.
# e.g. icicle-cuda-runtime/src/bindings.rs is generated and icicle-cuda-runtime/src/lib.rs includes that module
# causing rustfmt to fail.
run: if [[ $(find . -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --) ]]; then echo "Please run cargo fmt"; exit 1; fi
# - name: Check clippy
# run: cargo clippy --no-deps --all-features --all-targets

View File

@@ -8,3 +8,6 @@ use_field_init_shorthand = true
use_try_shorthand = true
# Unstable Configs
# This is required to enable checking single files without checking their imports/submodules
# However, this also breaks running "cargo fmt" at the workspace level
skip_children = true

View File

@@ -12,6 +12,7 @@ then
echo ""
echo "If you only want to see what formatting is required please run:"
echo "find ./ \( -path ./icicle/build -prune -o -path ./**/target -prune \) -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -style=file"
echo ""
status=1
fi
@@ -20,15 +21,17 @@ if [[ $(go list ./... | xargs go fmt) ]];
then
echo "🚨 There are Golang files that need formatting."
echo "Please commit the formatted files"
echo ""
status=1
fi
# Run cargo fmt on Rust files
cd wrappers/rust
if [[ $(cargo fmt --check) ]];
if [[ $(find . -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --) ]];
then
echo "🚨 There are Rust files that need formatting."
echo "Please format the Rust files using 'cargo fmt' from the wrappers/rust directory"
echo "Please format the Rust files using the following command:"
echo "find . -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --"
status=1
fi

View File

@@ -1,2 +0,0 @@
// Empty mod file - This is necessary for cargo fmt to operate correctly in CI
// All content in this file will be overwritten when building the crate