Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,11 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dist
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.27.0/cargo-dist-installer.sh | sh"
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Run tests
run: |
cd server
./bt install
./bt install --dev
./bt check
2 changes: 1 addition & 1 deletion builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ edition = "2021"
[dependencies]
clap = { version = "4.5.19", features = ["derive"] }
cmd_lib = "1.9.5"
current_platform = "0.2.0"
current_platform = "0.2.0"
39 changes: 33 additions & 6 deletions builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ fn quick_copy_dir<P: AsRef<OsStr>>(
println!("{:#?}", &copy_process);

// Check for errors.
let exit_status = match copy_process.status() {
Ok(es) => es,
Err(err) => return Err(format!("Error running copy process: {err}").into()),
};
let exit_status = copy_process
.status()
.map_err(|err| -> String { format!("Error running copy process: {err}") })?;
let exit_code = exit_status
.code()
.expect("Copy process terminated by signal");
Expand Down Expand Up @@ -291,9 +290,13 @@ fn run_install(dev: bool) -> Result<(), Box<dyn std::error::Error>> {
cargo fetch;
)?;
if dev {
// If the dist install reports an error, perhaps it's already installed.
if run_cmd!(cargo install --locked cargo-dist;).is_err() {
run_cmd!(dist --version;)?;
}
run_cmd!(
cargo install --locked cargo-outdated;
cargo install --locked cargo-dist;
cargo install cargo-sort;
)?;
}
Ok(())
Expand All @@ -318,6 +321,22 @@ fn run_update() -> Result<(), Box<dyn std::error::Error>> {
}

fn run_check() -> Result<(), Box<dyn std::error::Error>> {
// On Windows, `cargo sort --check` fails since it default to LF, not CRLF,
// line endings. Work around this by changing this setting only on Windows.
// See the
// [cargo sort config docs](https://github.com/DevinR528/cargo-sort?tab=readme-ov-file#config)
// and the
// [related issue](https://github.com/DevinR528/cargo-sort/issues/85).
//
// However, this still fails: `cargo sort` uses
// [inconsistent line endings](https://github.com/DevinR528/cargo-sort/issues/86).
/***
#[cfg(windows)]
{
fs::write("tomlfmt.toml", "crlf = true")
.map_err(|err| -> String { format!("Unable to write tomlfmt.toml: {err}") })?;
}
*/
// The `-D warnings` flag causes clippy to return a non-zero exit status if
// it issues warnings.
run_cmd!(
Expand All @@ -326,6 +345,14 @@ fn run_check() -> Result<(), Box<dyn std::error::Error>> {
cargo clippy --all-targets --manifest-path=../builder/Cargo.toml -- -D warnings;
cargo fmt --check --manifest-path=../builder/Cargo.toml;
)?;
// `cargo sort` produces false positives under Windows. Ignore for now. See
// the above comments. It also doesn't support the
#[cfg(not(windows))]
run_cmd!(
cargo sort --check;
cd ../builder;
cargo sort --check;
)?;
run_build()?;
// Verify that compiling for release produces no errors.
run_cmd!(dist build;)?;
Expand All @@ -351,7 +378,7 @@ fn run_build() -> Result<(), Box<dyn std::error::Error>> {
fn run_prerelease() -> Result<(), Box<dyn std::error::Error>> {
// Clean out all bundled files before the rebuild.
remove_dir_all_if_exists("../client/static/bundled")?;
run_install(false)?;
run_install(true)?;
run_script("npm", &["run", "dist"], "../client", true)?;
Ok(())
}
Expand Down
2 changes: 2 additions & 0 deletions server/dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-
ci = "github"
# Skip checking whether the specified configuration files are up to date
allow-dirty = ["ci"]
# Which actions to run on pull requests
pr-run-mode = "upload"
Loading