Skip to content

Commit 1c9f09d

Browse files
committed
refactor: fix to run tests only for our create in CI
1 parent 76ad82e commit 1c9f09d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ jobs:
3535
- name: Run Rust tests
3636
shell: bash
3737
run: |
38-
# Get all workspace packages and filter out those starting with 'ruff'
39-
packages=$(cargo metadata --format-version 1 --no-deps | \
40-
jq -r '.workspace_members[]' | \
41-
sed 's/.*\///' | \
42-
grep -v '^ruff' | \
43-
xargs)
4438
# Build cargo test command with -p flags for each package
45-
# Format as `cargo test -p <package> -p <package> ...`
39+
# We do so because the ruff submodule also contains crates and those will
40+
# run if we don't limit the tests to only our packages.
41+
# And `cargo test` command doesn't allow to exclude crates based on patterns.
42+
#
43+
# 1. Get all directories in our `crates/` folder
44+
packages=$(find crates -maxdepth 1 -mindepth 1 -type d | \
45+
sed 's/crates\///' | \
46+
tr '\n' ' ')
4647
echo "Running tests for packages: $packages"
48+
# 2. Format as `cargo test -p <package> -p <package> ...`
4749
cargo test $(echo "$packages" | sed 's/\([^ ]*\)/-p \1/g')
4850
4951
# After Rust tests pass, run Python tests next

0 commit comments

Comments
 (0)