Skip to content

Conversation

@snim2
Copy link
Contributor

@snim2 snim2 commented Apr 22, 2025

Remove PHP code and add scripts-to-rule-them-all for Rust.

Description

This PR sets up the repo for Rust development. It:

  • Removes all PHP code and tooling
  • Adds Rust tooling and scripts in the scripts-to-rule-them-all pattern
  • Adds a hello-world app automatically generated by cargo init
  • Adds a unit test for that app to ensure that the test scripts work
  • Adds a GitHub action to run the test scripts
  • Adds architecture decision records which now includes the decision to try Rust, experimentally

This PR does not:

  • Attempt to do anything related to Whippet features
  • Attempt to build a "release" of the Whippet binary or produce any other artefacts

Note that this PR merges into a new protected branch, experiment/whippet-3.0 because we may choose not to keep this code.

Testing

  1. Checkout this branch
  2. Run ./script/test if I've got the Brew dependencies right then you should see something like:
❯ ./script/test
==> Building...
==> Updating...
==> Bootstrapping...
==> Updating Cargo dependencies...
     Locking 0 packages to latest Rust 1.86.0 compatible versions
==> Cleaning old files...
     Removed 0 files
==> Building Whippet...
   Compiling whippet v3.0.0 (.../whippet)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.42s
==> Running ShellCheck...
Checking ./script/bootstrap
Checking ./script/test
Checking ./script/update
Checking ./script/setup
Checking ./script/build
Checking ./.shellcheck.sh
OK
==> Running code formatter...
==> Running code linter...
    Checking whippet v3.0.0 (/Users/sarah.mount/code/github.com/dxw/whippet)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
==> Running the tests...
   Compiling whippet v3.0.0 (/Users/sarah.mount/code/github.com/dxw/whippet)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.31s
     Running unittests src/main.rs (target/debug/deps/whippet-5e4893a47ad8b6ef)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/hello_world.rs (target/debug/deps/hello_world-8940bbc8d2d2757d)

running 2 tests
test test_correct_output ... ok
test test_application_runs ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.30s
  • Includes tests (if new features are introduced)
  • Commit message includes link to the ticket/issue
  • Changelog updated
  • PR open against dxw's Homebrew Tap to point the Whippet formula to the new version number

snim2 added 12 commits April 7, 2025 13:25
This commit records the result of 'cargo init' with no
changes at all to the generated files.
Note that:

* We don't have a separate build script for the CI pipeline
* We run 'cargo clean' before building, which might prove
  to be unnecessary and time consuming
This commit does not modify the hello world app that was
automatically generated by 'cargo init', it just adds
some tests so that we can:

a) ensure the test scripts work
b) set the expectation of full coverage
@snim2 snim2 force-pushed the chore/rust-scripts-to-rule-them-all branch from d3bdbda to 3f3e63d Compare April 22, 2025 17:42
@RobjS
Copy link
Contributor

RobjS commented Apr 23, 2025

@snim2 Currently I'm getting this from script/test:

...
==> Running ShellCheck...
Checking ./script/bootstrap
Checking ./script/test
Checking ./script/update
Checking ./script/setup
Checking ./script/build
Checking ./.shellcheck.sh
OK
==> Running code formatter...
Invalid value for `--edition`

@snim2
Copy link
Contributor Author

snim2 commented Apr 23, 2025

@snim2 Currently I'm getting this from script/test:

...
==> Running ShellCheck...
Checking ./script/bootstrap
Checking ./script/test
Checking ./script/update
Checking ./script/setup
Checking ./script/build
Checking ./.shellcheck.sh
OK
==> Running code formatter...
Invalid value for `--edition`

OK, what do you get as the output of these commands?

rustc --version
rustfmt --version
cargo --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants