Skip to content

Commit

Permalink
new: Improve existing toolchains. (#1807)
Browse files Browse the repository at this point in the history
* Add implicit relations.

* Move checkpoint prints.

* Add bun.lock parsing.

* Update logic.

* Rework deno.

* Polish.

* Fixes.

* Add debug.

* Set env var.

* Fix.
  • Loading branch information
milesj authored Jan 30, 2025
1 parent 7824c0c commit ee888a6
Show file tree
Hide file tree
Showing 36 changed files with 598 additions and 163 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
env:
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
MOON_NODE_VERSION: ${{ matrix.node-version }}
MOONBASE_SECRET_KEY: ${{ secrets.MOONBASE_SECRET_KEY }}
MOONBASE_ACCESS_KEY: ${{ secrets.MOONBASE_ACCESS_KEY }}
RUST_BACKTRACE: '1'
- uses: moonrepo/run-report-action@v1
if: success() || failure()
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ jobs:
# SCCACHE_NO_DAEMON: 1
SCCACHE_REGION: us-east-2
SCCACHE_S3_SERVER_SIDE_ENCRYPTION: true
AWS_LC_SYS_PREBUILT_NASM: 1
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
Expand All @@ -92,7 +91,10 @@ jobs:
auto-install: true
cache: ${{ runner.os == 'Linux' }}
proto-version: '0.45.1' # Keep in sync
- uses: mozilla-actions/[email protected]
# Fixes issues where proto can't find a version because nothing is pinned globally
- run: cp .prototools ~/.proto/.prototools
if: ${{ runner.os == 'Linux' }}
- uses: mozilla-actions/[email protected]
if: ${{ vars.ENABLE_SCCACHE == 'true' }}
- uses: lukka/get-cmake@latest
if: ${{ runner.os == 'Windows' }}
Expand Down
4 changes: 2 additions & 2 deletions .prototools
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These are used by tests that require the tools
# to exist in the environment!
# bun = "1.0.15"
deno = "1.40.0"
bun = "1.2.1"
deno = "2.1.7"
node = "20.8.0"
npm = "10.1.0"
pkl = "0.27.2"
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@
- Added timeout and concurrency limit to clients.
- Added a `MOON_DEBUG_REMOTE` environment variable, which can be used to debug internal errors for
diagnosing connection/integration issues.
- Improved the Bun toolchain.
- Added support for the new v1.2 `bun.lock` file. We do our best to detect this, but we suggest
configuring `--save-text-lockfile`.
- Improved the Deno toolchain.
- Added support for Deno v2 and `deno install`. Will now run this command instead of `deno cache`.
- Added support for v3 and v4 lockfiles (we now use the `deno_lockfile` crate).
- Added basic support for workspaces.
- Added `deno.installArgs` setting.
- Improved the Rust toolchain.
- The root-level project is now properly taken into account when detecting the package workspaces.
- Project dependencies (`dependsOn`) are now automatically inferred from `Cargo.toml`
dependencies.

#### 🐞 Fixes

Expand Down
120 changes: 116 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ clap = { version = "4.5.27", default-features = false, features = [
"std",
"error-context",
] }
clap_complete = "4.5.43"
clap_complete = "4.5.44"
compact_str = { version = "0.8.1", default-features = false, features = [
"serde",
] }
Expand Down
75 changes: 36 additions & 39 deletions crates/cli/tests/run_bun_test.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
// These are very flaky in CI, as they error with "Text file busy" nonstop
#[cfg(not(target_os = "linux"))]
mod bun {
use moon_config::PartialBunConfig;
use moon_test_utils::{
assert_snapshot, create_sandbox, create_sandbox_with_config, get_bun_fixture_configs,
predicates::prelude::*, Sandbox,
};
use std::fs;

fn bun_sandbox() -> Sandbox {
bun_sandbox_with_config(|_| {})
}
use moon_config::PartialBunConfig;
use moon_test_utils::{
assert_snapshot, create_sandbox, create_sandbox_with_config, get_bun_fixture_configs,
predicates::prelude::*, Sandbox,
};
use std::fs;

fn bun_sandbox() -> Sandbox {
bun_sandbox_with_config(|_| {})
}

fn bun_sandbox_with_config<C>(callback: C) -> Sandbox
where
C: FnOnce(&mut PartialBunConfig),
{
let (workspace_config, mut toolchain_config, tasks_config) = get_bun_fixture_configs();
fn bun_sandbox_with_config<C>(callback: C) -> Sandbox
where
C: FnOnce(&mut PartialBunConfig),
{
let (workspace_config, mut toolchain_config, tasks_config) = get_bun_fixture_configs();

if let Some(bun_config) = &mut toolchain_config.bun {
callback(bun_config);
}
if let Some(bun_config) = &mut toolchain_config.bun {
callback(bun_config);
}

let sandbox = create_sandbox_with_config(
"bun",
Some(workspace_config),
Some(toolchain_config),
Some(tasks_config),
);
let sandbox = create_sandbox_with_config(
"bun",
Some(workspace_config),
Some(toolchain_config),
Some(tasks_config),
);

sandbox.enable_git();
sandbox
}
sandbox.enable_git();
sandbox
}

mod bun {
use super::*;

#[test]
fn runs_self() {
Expand Down Expand Up @@ -162,11 +162,10 @@ mod bun {
cmd.arg("run").arg("bun:unhandledPromise");
});

if cfg!(windows) {
assert.code(1);
} else {
assert_snapshot!(assert.output());
}
let output = assert.output();

// Output contains os/arch stuff that we cant snapshot
assert!(predicate::str::contains("error: Oops").eval(&output));
}

#[test]
Expand Down Expand Up @@ -345,8 +344,6 @@ mod bun {
}
}

// Need multiple windows versions for this to work
#[cfg(not(windows))]
mod workspace_overrides {
use super::*;

Expand All @@ -362,8 +359,8 @@ mod bun {

let output = assert.output();

assert!(predicate::str::contains("1.1.3").eval(&output));
assert!(predicate::str::contains("0.8.0").eval(&output));
assert!(predicate::str::contains("1.2.1").eval(&output));
assert!(predicate::str::contains("1.1.0").eval(&output));

assert.success();
}
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/tests/run_deno_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod deno {
let output = assert.output();

// Output contains arch info
assert!(predicate::str::contains("deno 1.40.0").eval(&output));
assert!(predicate::str::contains("deno 2.1.7").eval(&output));
}

#[test]
Expand Down Expand Up @@ -230,7 +230,7 @@ mod deno {

// Output includes the arch, so can't be snapshotted
assert!(predicate::str::contains("deno platform").eval(&output));
assert!(predicate::str::contains("deno 1.40.0").eval(&output));
assert!(predicate::str::contains("deno 2.1.7").eval(&output));
}

mod workspace_overrides {
Expand All @@ -248,7 +248,7 @@ mod deno {

let output = assert.output();

assert!(predicate::str::contains("1.40.0").eval(&output));
assert!(predicate::str::contains("2.1.7").eval(&output));
assert!(predicate::str::contains("1.30.0").eval(&output));

assert.success();
Expand Down
Loading

0 comments on commit ee888a6

Please sign in to comment.