Delete old ci.yml (#41668)

The new one is much better

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin
2025-10-31 12:58:47 -06:00
committed by GitHub
parent 3a4aba1df2
commit a05358f47f
11 changed files with 161 additions and 1121 deletions
+39 -33
View File
@@ -1,11 +1,13 @@
use gh_workflow::*;
use crate::tasks::workflows::steps::named;
use crate::tasks::workflows::steps::{NamedJob, named};
use super::{runners, steps};
/// Generates the danger.yml workflow
pub fn danger() -> Workflow {
let danger = danger_job();
named::workflow()
.on(
Event::default().pull_request(PullRequest::default().add_branch("main").types([
@@ -15,39 +17,43 @@ pub fn danger() -> Workflow {
PullRequestType::Edited,
])),
)
.add_job(
"danger",
Job::default()
.cond(Expression::new(
"github.repository_owner == 'zed-industries'",
))
.runs_on(runners::LINUX_SMALL)
.add_step(steps::checkout_repo())
.add_step(steps::setup_pnpm())
.add_step(
steps::setup_node()
.add_with(("cache", "pnpm"))
.add_with(("cache-dependency-path", "script/danger/pnpm-lock.yaml")),
)
.add_step(install_deps())
.add_step(run()),
)
.add_job(danger.name, danger.job)
}
pub fn install_deps() -> Step<Run> {
named::bash("pnpm install --dir script/danger")
}
fn danger_job() -> NamedJob {
pub fn install_deps() -> Step<Run> {
named::bash("pnpm install --dir script/danger")
}
pub fn run() -> Step<Run> {
named::bash("pnpm run --dir script/danger danger ci")
// This GitHub token is not used, but the value needs to be here to prevent
// Danger from throwing an error.
.add_env(("GITHUB_TOKEN", "not_a_real_token"))
// All requests are instead proxied through an instance of
// https://github.com/maxdeviant/danger-proxy that allows Danger to securely
// authenticate with GitHub while still being able to run on PRs from forks.
.add_env((
"DANGER_GITHUB_API_BASE_URL",
"https://danger-proxy.fly.dev/github",
))
pub fn run() -> Step<Run> {
named::bash("pnpm run --dir script/danger danger ci")
// This GitHub token is not used, but the value needs to be here to prevent
// Danger from throwing an error.
.add_env(("GITHUB_TOKEN", "not_a_real_token"))
// All requests are instead proxied through an instance of
// https://github.com/maxdeviant/danger-proxy that allows Danger to securely
// authenticate with GitHub while still being able to run on PRs from forks.
.add_env((
"DANGER_GITHUB_API_BASE_URL",
"https://danger-proxy.fly.dev/github",
))
}
NamedJob {
name: "danger".to_string(),
job: Job::default()
.cond(Expression::new(
"github.repository_owner == 'zed-industries'",
))
.runs_on(runners::LINUX_SMALL)
.add_step(steps::checkout_repo())
.add_step(steps::setup_pnpm())
.add_step(
steps::setup_node()
.add_with(("cache", "pnpm"))
.add_with(("cache-dependency-path", "script/danger/pnpm-lock.yaml")),
)
.add_step(install_deps())
.add_step(run()),
}
}
+49 -49
View File
@@ -14,6 +14,55 @@ pub(crate) fn build_nix(
cachix_filter: Option<&str>,
deps: &[&NamedJob],
) -> NamedJob {
// on our macs we manually install nix. for some reason the cachix action is running
// under a non-login /bin/bash shell which doesn't source the proper script to add the
// nix profile to PATH, so we manually add them here
pub fn set_path() -> Step<Run> {
named::bash(indoc! {r#"
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
echo "/Users/administrator/.nix-profile/bin" >> "$GITHUB_PATH"
"#})
}
pub fn install_nix() -> Step<Use> {
named::uses(
"cachix",
"install-nix-action",
"02a151ada4993995686f9ed4f1be7cfbb229e56f", // v31
)
.add_with(("github_access_token", vars::GITHUB_TOKEN))
}
pub fn cachix_action(cachix_filter: Option<&str>) -> Step<Use> {
let mut step = named::uses(
"cachix",
"cachix-action",
"0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad", // v16
)
.add_with(("name", "zed"))
.add_with(("authToken", vars::CACHIX_AUTH_TOKEN))
.add_with(("cachixArgs", "-v"));
if let Some(cachix_filter) = cachix_filter {
step = step.add_with(("pushFilter", cachix_filter));
}
step
}
pub fn build(flake_output: &str) -> Step<Run> {
named::bash(&format!(
"nix build .#{} -L --accept-flake-config",
flake_output
))
}
pub fn limit_store() -> Step<Run> {
named::bash(indoc! {r#"
if [ "$(du -sm /nix/store | cut -f1)" -gt 50000 ]; then
nix-collect-garbage -d || true
fi"#
})
}
let runner = match platform {
Platform::Windows => unimplemented!(),
Platform::Linux => runners::LINUX_X86_BUNDLER,
@@ -55,52 +104,3 @@ pub(crate) fn build_nix(
job,
}
}
// on our macs we manually install nix. for some reason the cachix action is running
// under a non-login /bin/bash shell which doesn't source the proper script to add the
// nix profile to PATH, so we manually add them here
pub fn set_path() -> Step<Run> {
named::bash(indoc! {r#"
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
echo "/Users/administrator/.nix-profile/bin" >> "$GITHUB_PATH"
"#})
}
pub fn install_nix() -> Step<Use> {
named::uses(
"cachix",
"install-nix-action",
"02a151ada4993995686f9ed4f1be7cfbb229e56f", // v31
)
.add_with(("github_access_token", vars::GITHUB_TOKEN))
}
pub fn cachix_action(cachix_filter: Option<&str>) -> Step<Use> {
let mut step = named::uses(
"cachix",
"cachix-action",
"0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad", // v16
)
.add_with(("name", "zed"))
.add_with(("authToken", vars::CACHIX_AUTH_TOKEN))
.add_with(("cachixArgs", "-v"));
if let Some(cachix_filter) = cachix_filter {
step = step.add_with(("pushFilter", cachix_filter));
}
step
}
pub fn build(flake_output: &str) -> Step<Run> {
named::bash(&format!(
"nix build .#{} -L --accept-flake-config",
flake_output
))
}
pub fn limit_store() -> Step<Run> {
named::bash(indoc! {r#"
if [ "$(du -sm /nix/store | cut -f1)" -gt 50000 ]; then
nix-collect-garbage -d || true
fi"#
})
}
+21 -21
View File
@@ -45,7 +45,28 @@ pub(crate) fn release() -> Workflow {
.add_job(auto_release_preview.name, auto_release_preview.job)
}
struct ReleaseBundleJobs {
linux_arm64: NamedJob,
linux_x86_64: NamedJob,
mac_arm64: NamedJob,
mac_x86_64: NamedJob,
windows_arm64: NamedJob,
windows_x86_64: NamedJob,
}
fn auto_release_preview(deps: &[&NamedJob; 1]) -> NamedJob {
fn create_sentry_release() -> Step<Use> {
named::uses(
"getsentry",
"action-release",
"526942b68292201ac6bbb99b9a0747d4abee354c", // v3
)
.add_env(("SENTRY_ORG", "zed-dev"))
.add_env(("SENTRY_PROJECT", "zed"))
.add_env(("SENTRY_AUTH_TOKEN", "${{ secrets.SENTRY_AUTH_TOKEN }}"))
.add_with(("environment", "production"))
}
named::job(
dependant_job(deps)
.runs_on(runners::LINUX_SMALL)
@@ -66,27 +87,6 @@ fn auto_release_preview(deps: &[&NamedJob; 1]) -> NamedJob {
)
}
fn create_sentry_release() -> Step<Use> {
named::uses(
"getsentry",
"action-release",
"526942b68292201ac6bbb99b9a0747d4abee354c", // v3
)
.add_env(("SENTRY_ORG", "zed-dev"))
.add_env(("SENTRY_PROJECT", "zed"))
.add_env(("SENTRY_AUTH_TOKEN", "${{ secrets.SENTRY_AUTH_TOKEN }}"))
.add_with(("environment", "production"))
}
struct ReleaseBundleJobs {
linux_arm64: NamedJob,
linux_x86_64: NamedJob,
mac_arm64: NamedJob,
mac_x86_64: NamedJob,
windows_arm64: NamedJob,
windows_x86_64: NamedJob,
}
fn upload_release_assets(deps: &[&NamedJob], bundle_jobs: &ReleaseBundleJobs) -> NamedJob {
fn download_workflow_artifacts() -> Step<Use> {
named::uses(
@@ -1,6 +1,6 @@
use crate::tasks::workflows::{
nix_build::build_nix,
run_bundling::bundle_mac,
run_bundling::{bundle_mac, bundle_windows},
run_tests::run_platform_tests,
runners::{Arch, Platform},
steps::NamedJob,
@@ -135,7 +135,6 @@ fn bundle_linux_nightly(arch: Arch, deps: &[&NamedJob]) -> NamedJob {
.runs_on(arch.linux_bundler())
.add_step(steps::checkout_repo())
.add_step(steps::setup_sentry())
.add_step(add_rust_to_path())
.add_step(steps::script("./script/linux"));
// todo(ci) can we do this on arm too?
@@ -163,12 +162,37 @@ fn bundle_windows_nightly(arch: Arch, deps: &[&NamedJob]) -> NamedJob {
.add_step(steps::checkout_repo())
.add_step(steps::setup_sentry())
.add_step(set_release_channel_to_nightly(platform))
.add_step(build_zed_installer(arch))
.add_step(upload_zed_nightly_windows(arch)),
.add_step(bundle_windows(arch))
.add_step(upload_zed_nightly(platform, arch)),
}
}
fn update_nightly_tag_job(deps: &[&NamedJob]) -> NamedJob {
fn update_nightly_tag() -> Step<Run> {
named::bash(indoc::indoc! {r#"
if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
echo "Nightly tag already points to current commit. Skipping tagging."
exit 0
fi
git config user.name github-actions
git config user.email github-actions@github.com
git tag -f nightly
git push origin nightly --force
"#})
}
fn create_sentry_release() -> Step<Use> {
named::uses(
"getsentry",
"action-release",
"526942b68292201ac6bbb99b9a0747d4abee354c", // v3
)
.add_env(("SENTRY_ORG", "zed-dev"))
.add_env(("SENTRY_PROJECT", "zed"))
.add_env(("SENTRY_AUTH_TOKEN", vars::SENTRY_AUTH_TOKEN))
.add_with(("environment", "production"))
}
NamedJob {
name: "update_nightly_tag".to_owned(),
job: steps::release_job(deps)
@@ -197,10 +221,6 @@ fn set_release_channel_to_nightly(platform: Platform) -> Step<Run> {
}
}
fn add_rust_to_path() -> Step<Run> {
named::bash(r#"echo "$HOME/.cargo/bin" >> "$GITHUB_PATH""#)
}
fn upload_zed_nightly(platform: Platform, arch: Arch) -> Step<Run> {
match platform {
Platform::Linux => named::bash(&format!("script/upload-nightly linux-targz {arch}")),
@@ -214,44 +234,3 @@ fn upload_zed_nightly(platform: Platform, arch: Arch) -> Step<Run> {
}
}
}
fn build_zed_installer(arch: Arch) -> Step<Run> {
let cmd = match arch {
Arch::X86_64 => "script/bundle-windows.ps1 -Architecture x86_64",
Arch::ARM64 => "script/bundle-windows.ps1 -Architecture aarch64",
};
named::pwsh(cmd).working_directory("${{ env.ZED_WORKSPACE }}")
}
fn upload_zed_nightly_windows(arch: Arch) -> Step<Run> {
let cmd = match arch {
Arch::X86_64 => "script/upload-nightly.ps1 -Architecture x86_64",
Arch::ARM64 => "script/upload-nightly.ps1 -Architecture aarch64",
};
named::pwsh(cmd).working_directory("${{ env.ZED_WORKSPACE }}")
}
fn update_nightly_tag() -> Step<Run> {
named::bash(indoc::indoc! {r#"
if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
echo "Nightly tag already points to current commit. Skipping tagging."
exit 0
fi
git config user.name github-actions
git config user.email github-actions@github.com
git tag -f nightly
git push origin nightly --force
"#})
}
fn create_sentry_release() -> Step<Use> {
named::uses(
"getsentry",
"action-release",
"526942b68292201ac6bbb99b9a0747d4abee354c", // v3
)
.add_env(("SENTRY_ORG", "zed-dev"))
.add_env(("SENTRY_PROJECT", "zed"))
.add_env(("SENTRY_AUTH_TOKEN", vars::SENTRY_AUTH_TOKEN))
.add_with(("environment", "production"))
}
@@ -144,7 +144,7 @@ pub(crate) fn bundle_windows_job(arch: runners::Arch, deps: &[&NamedJob]) -> Job
)
}
fn bundle_windows(arch: runners::Arch) -> Step<Run> {
pub fn bundle_windows(arch: runners::Arch) -> Step<Run> {
let step = match arch {
runners::Arch::X86_64 => named::pwsh("script/bundle-windows.ps1 -Architecture x86_64"),
runners::Arch::ARM64 => named::pwsh("script/bundle-windows.ps1 -Architecture aarch64"),