You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way tests are implemented currently, it requires lots of manual changes to the CI config. Because of that, the CI configuration is getting bigger, noisy, harder to maintain and error-prone. It also contains lots of boilerplate to support cross-platform tests:
cargo run -- --config="tests\$env:SYNC_DIR.toml" sync
ls -l $env:SYNC_DIR
if (!(Test-Path $env:SYNC_DIR\bat.exe)) {
throw 'error on bat.exe'
}
if (!(Test-Path $env:SYNC_DIR\difft.exe)) {
throw 'error on difft.exe'
}
if (!(Test-Path $env:SYNC_DIR\fd.exe)) {
throw 'error on fd.exe'
}
if (!(Test-Path $env:SYNC_DIR\rg.exe)) {
throw 'error on rg.exe'
}
if (!(Test-Path $env:SYNC_DIR\tool.exe)) {
throw 'error on tool.exe'
}
I propose
Option 1: Move to bash scripts
A simple option would be to move those commands into Shell scripts (Bash and PowerShell). This doesn't solve the problem of having lots of boilerplate but at least it makes the CI config less noisy (although at the cost of having more indirections).
Pros
✅ Less noise in the CI config
✅ Pretty simple shell scripting and not so much of the code if you're familiar with shell
✅ Testing CLI parsing as well
Cons
❌ Requires more polyglot knowledge
❌ Requires lots of manual updates
❌ Boilerplate
❌ Requires separate static analysis like shellcheck
Option 2: Rust integration tests
Alternatively, all these tests can be written as rust integration tests. They can be put into the tests/ directory and run as cargo test (which we already do)
Pros
✅ No polyglot env, only Rust for testing
✅ No boilerplate, only one test suite, reusing lib utils
✅ Automatically cross-platform
✅ All Rust tooling works for tests automatically
Cons
❌ More code
❌ No CLI parsing testing (maybe it can be done separately with clap?)
The text was updated successfully, but these errors were encountered:
The way tests are implemented currently, it requires lots of manual changes to the CI config. Because of that, the CI configuration is getting bigger, noisy, harder to maintain and error-prone. It also contains lots of boilerplate to support cross-platform tests:
Just look at these 100 lines of YAML 😨
tool-sync/.github/workflows/ci.yml
Lines 43 to 141 in 2bb99cf
I propose
Option 1: Move to bash scripts
A simple option would be to move those commands into Shell scripts (Bash and PowerShell). This doesn't solve the problem of having lots of boilerplate but at least it makes the CI config less noisy (although at the cost of having more indirections).
Pros
✅ Less noise in the CI config
✅ Pretty simple shell scripting and not so much of the code if you're familiar with shell
✅ Testing CLI parsing as well
Cons
❌ Requires more polyglot knowledge
❌ Requires lots of manual updates
❌ Boilerplate
❌ Requires separate static analysis like
shellcheck
Option 2: Rust integration tests
Alternatively, all these tests can be written as rust integration tests. They can be put into the
tests/
directory and run ascargo test
(which we already do)Pros
✅ No polyglot env, only Rust for testing
✅ No boilerplate, only one test suite, reusing
lib
utils✅ Automatically cross-platform
✅ All Rust tooling works for tests automatically
Cons
❌ More code
❌ No CLI parsing testing (maybe it can be done separately with
clap
?)The text was updated successfully, but these errors were encountered: