Compare commits

...

11 Commits

Author SHA1 Message Date
Conrad Irwin
a89156cbbe expr returns 1 when it calculates 0, who knew... 2025-10-24 20:22:58 -06:00
Conrad Irwin
892e8cddcc Why are you failing? 2025-10-24 20:14:01 -06:00
Conrad Irwin
4ed39540e7 re-run 2025-10-24 19:50:56 -06:00
Conrad Irwin
91c509ea5e Clippppppy 2025-10-24 16:55:18 -06:00
Conrad Irwin
54ca5e7c91 Oops 2025-10-24 16:44:40 -06:00
Conrad Irwin
38db09157e New approach to installing nextest? 2025-10-24 16:29:21 -06:00
Conrad Irwin
8a4d85eb82 Try gh_workflow generation 2025-10-24 00:16:12 -06:00
Conrad Irwin
6a983f657a Cache more aggressively 2025-10-23 23:44:51 -06:00
Conrad Irwin
6439ea7fb8 build again 2025-10-23 23:22:20 -06:00
Conrad Irwin
59d8458a24 New cache? 2025-10-23 22:30:18 -06:00
Conrad Irwin
be7c18234d Try new namespace builder 2025-10-23 22:14:17 -06:00
9 changed files with 183 additions and 24 deletions

View File

@@ -296,49 +296,53 @@ jobs:
github.repository_owner == 'zed-industries' &&
needs.job_spec.outputs.run_tests == 'true'
runs-on:
- namespace-profile-16x32-ubuntu-2204
- namespace-profile-ubuntu22-x86-16x32-custom
steps:
- name: Add Rust to the PATH
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
run: |
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
echo "$HOME/.cargo-nextest/bin" >> "$GITHUB_PATH"
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
clean: false
- name: Cache dependencies
uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2
- name: Configure Go and Rust cache
uses: namespacelabs/nscloud-cache-action@v1
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
# cache-provider: "buildjet"
- name: Install Linux dependencies
run: ./script/linux
path: |
/home/runner/.cargo-nextest
/home/runner/.rustup
./target
- name: Configure CI
run: |
mkdir -p ./../.cargo
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
- name: cargo clippy
run: ./script/clippy
- name: Install cargo nextest
shell: bash -euxo pipefail {0}
run: |
cargo install cargo-nextest --locked --root ~/.cargo-nextest
- name: Limit target directory size
env:
MAX_SIZE: ${{ runner.os == 'macOS' && 300 || 100 }}
shell: bash -euxo pipefail {0}
# Use the variable in the run command
run: script/clear-target-dir-if-larger-than ${{ env.MAX_SIZE }}
- name: Run tests
uses: ./.github/actions/run_tests
shell: bash -euxo pipefail {0}
run: cargo nextest run --workspace --no-fail-fast --failure-output immediate-final
- name: Build other binaries and features
run: |
cargo build -p zed
cargo check -p workspace
cargo check -p gpui --examples
# Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
# But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
# to clean up the config file, Ive included the cleanup code here as a precaution.
# While its not strictly necessary at this moment, I believe its better to err on the side of caution.
- name: Clean CI config file
if: always()
run: rm -rf ./../.cargo
- name: cargo clippy
run: ./script/clippy
doctests:
# Nextest currently doesn't support doctests, so run them separately and in parallel.

108
Cargo.lock generated
View File

@@ -4902,6 +4902,18 @@ dependencies = [
"syn 2.0.106",
]
[[package]]
name = "derive_setters"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae5c625eda104c228c06ecaf988d1c60e542176bd7a490e60eeda3493244c0c9"
dependencies = [
"darling 0.20.11",
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]]
name = "deunicode"
version = "1.6.2"
@@ -6942,6 +6954,35 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "gh-workflow"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fffeec7bd9dfa73ffe1db38979cca5716ec6ffd944f03fae65fee81f16082ae"
dependencies = [
"async-trait",
"derive_more 2.0.1",
"derive_setters",
"gh-workflow-macros",
"indexmap 2.11.4",
"merge",
"serde",
"serde_json",
"serde_yaml",
"strum_macros 0.27.2",
]
[[package]]
name = "gh-workflow-macros"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eafb4d2a1005d4ac6d041ce929af10be1de1e1eae478795d9d634b84ccf8191"
dependencies = [
"heck 0.5.0",
"quote",
"syn 2.0.106",
]
[[package]]
name = "gif"
version = "0.13.3"
@@ -9812,6 +9853,28 @@ dependencies = [
"gpui",
]
[[package]]
name = "merge"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9"
dependencies = [
"merge_derive",
"num-traits",
]
[[package]]
name = "merge_derive"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "209d075476da2e63b4b29e72a2ef627b840589588e71400a25e3565c4f849d07"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "metal"
version = "0.29.0"
@@ -12801,6 +12864,30 @@ dependencies = [
"toml_edit 0.23.7",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro-error-attr2"
version = "2.0.0"
@@ -15226,6 +15313,19 @@ dependencies = [
"syn 2.0.106",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.11.4",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "serial2"
version = "0.2.33"
@@ -18397,6 +18497,12 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "untrusted"
version = "0.9.0"
@@ -20806,6 +20912,7 @@ dependencies = [
"cargo_metadata",
"cargo_toml",
"clap",
"gh-workflow",
"indoc",
"toml 0.8.23",
"toml_edit 0.22.27",
@@ -21037,6 +21144,7 @@ dependencies = [
"file_finder",
"fs",
"futures 0.3.31",
"gh-workflow",
"git",
"git_hosting_providers",
"git_ui",

View File

@@ -506,6 +506,7 @@ fork = "0.2.0"
futures = "0.3"
futures-batch = "0.6.1"
futures-lite = "1.13"
gh-workflow = "0.8.0"
git2 = { version = "0.20.1", default-features = false }
globset = "0.4"
handlebars = "4.3"

View File

@@ -165,6 +165,7 @@ zeta.workspace = true
zeta2.workspace = true
zlog.workspace = true
zlog_settings.workspace = true
gh-workflow = "0.8.0"
[target.'cfg(target_os = "windows")'.dependencies]
windows.workspace = true

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eu
set -euxo pipefail
if [[ $# -ne 1 ]]; then
echo "usage: $0 <MAX_SIZE_IN_GB>"
@@ -15,11 +15,11 @@ fi
max_size_gb=$1
current_size=$(du -s target | cut -f1)
current_size_gb=$(expr ${current_size} / 1024 / 1024)
current_size_gb=$(( current_size / 1024 / 1024 ))
echo "target directory size: ${current_size_gb}gb. max size: ${max_size_gb}gb"
if [[ ${current_size_gb} -gt ${max_size_gb} ]]; then
echo "clearing target directory"
rm -rf target
rm -rf target/*
fi

View File

@@ -16,3 +16,4 @@ clap = { workspace = true, features = ["derive"] }
toml.workspace = true
indoc.workspace = true
toml_edit.workspace = true
gh-workflow.workspace = true

View File

@@ -20,6 +20,7 @@ enum CliCommand {
PackageConformity(tasks::package_conformity::PackageConformityArgs),
/// Publishes GPUI and its dependencies to crates.io.
PublishGpui(tasks::publish_gpui::PublishGpuiArgs),
GenerateWorkflow(tasks::generate_workflow::GenerateWorkflowArgs),
}
fn main() -> Result<()> {
@@ -32,5 +33,6 @@ fn main() -> Result<()> {
tasks::package_conformity::run_package_conformity(args)
}
CliCommand::PublishGpui(args) => tasks::publish_gpui::run_publish_gpui(args),
CliCommand::GenerateWorkflow(args) => tasks::generate_workflow::run_generate_workflow(args),
}
}

View File

@@ -1,4 +1,5 @@
pub mod clippy;
pub mod generate_workflow;
pub mod licenses;
pub mod package_conformity;
pub mod publish_gpui;

View File

@@ -0,0 +1,41 @@
use anyhow::Result;
use clap::Parser;
use gh_workflow::*;
#[derive(Parser)]
pub struct GenerateWorkflowArgs {}
pub fn run_generate_workflow(_args: GenerateWorkflowArgs) -> Result<()> {
// Create the "Run tests" composite action workflow
let workflow = Workflow::default().name("Run tests").add_job(
"run_tests",
Job::default()
.add_step(Step::new("Install Rust").run("cargo install cargo-nextest --locked"))
.add_step(
Step::new("Install Node")
.uses(
"actions",
"setup-node",
"49933ea5288caeca8642d1e84afbd3f7d6820020",
)
.add_with(("node-version", "18")),
)
.add_step(
Step::new("Limit target directory size")
.run("script/clear-target-dir-if-larger-than ${{ env.MAX_SIZE }}")
.env(("MAX_SIZE", "${{ runner.os == 'macOS' && 300 || 100 }}")),
)
.add_step(Step::new("Run tests").run(
"cargo nextest run --workspace --no-fail-fast --failure-output immediate-final",
)),
);
// Generate and print the workflow YAML
let yaml = workflow
.to_string()
.map_err(|e| anyhow::anyhow!("{:?}", e))?;
println!("{}", yaml);
Ok(())
}