diff --git a/.github/actionlint.yml b/.github/actionlint.yml index 1c931883da4222c92f72a562d3cd58303ee35a06..3d16cf827888ca0bd45ed51bba99a0dbc0a2fbf2 100644 --- a/.github/actionlint.yml +++ b/.github/actionlint.yml @@ -29,6 +29,8 @@ self-hosted-runner: # Namespace Limited Preview - namespace-profile-8x16-ubuntu-2004-arm-m4 - namespace-profile-8x32-ubuntu-2004-arm-m4 + # Namespace mac + - namespace-profile-mac-large # Self Hosted Runners - self-mini-macos - self-32vcpu-windows-2022 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a06febb79970c630ddd4b3a37fe1b48bfda1891..4160d6b68ea34ac769bf39b2626481adf72bd7fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ on: jobs: run_tests_mac: if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -22,10 +22,17 @@ jobs: mkdir -p ./../.cargo cp ./.cargo/ci-config.toml ./../.cargo/config.toml shell: bash -euxo pipefail {0} + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/nscloud-cache-action@v1 + with: + cache: rust + path: ~/.rustup - name: steps::setup_node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: node-version: '20' + - name: steps::cargo_install_nextest + uses: taiki-e/install-action@nextest - name: steps::clear_target_dir_if_large run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} @@ -83,6 +90,14 @@ jobs: rm -rf ./../.cargo shell: bash -euxo pipefail {0} timeout-minutes: 60 + services: + postgres: + image: postgres:15 + env: + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 500ms --health-timeout 5s --health-retries 10 run_tests_windows: if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') runs-on: self-32vcpu-windows-2022 @@ -114,7 +129,7 @@ jobs: timeout-minutes: 60 clippy_mac: if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -324,7 +339,7 @@ jobs: - run_tests_mac - clippy_mac - check_scripts - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: CARGO_INCREMENTAL: 0 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} @@ -371,7 +386,7 @@ jobs: - run_tests_mac - clippy_mac - check_scripts - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: CARGO_INCREMENTAL: 0 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml index 76f0aacc457f4e9f30692220a01cca445c8548e1..2e97fab8e029b7e96fa6a3631c61af3304f21f8b 100644 --- a/.github/workflows/release_nightly.yml +++ b/.github/workflows/release_nightly.yml @@ -13,7 +13,7 @@ on: jobs: check_style: if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -180,7 +180,7 @@ jobs: - check_style - run_tests_windows - clippy_windows - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: CARGO_INCREMENTAL: 0 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} @@ -234,7 +234,7 @@ jobs: - check_style - run_tests_windows - clippy_windows - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: CARGO_INCREMENTAL: 0 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} @@ -425,7 +425,7 @@ jobs: - check_style - run_tests_windows if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} @@ -436,11 +436,10 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: nix_build::build_nix::set_path - run: | - echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH" - echo "/Users/administrator/.nix-profile/bin" >> "$GITHUB_PATH" - shell: bash -euxo pipefail {0} + - name: nix_build::build_nix::install_nix + uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: nix_build::build_nix::cachix_action uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad with: @@ -450,12 +449,6 @@ jobs: - name: nix_build::build_nix::build run: nix build .#default -L --accept-flake-config shell: bash -euxo pipefail {0} - - name: nix_build::build_nix::limit_store - run: |- - if [ "$(du -sm /nix/store | cut -f1)" -gt 50000 ]; then - nix-collect-garbage -d || true - fi - shell: bash -euxo pipefail {0} timeout-minutes: 60 continue-on-error: true update_nightly_tag: diff --git a/.github/workflows/run_bundling.yml b/.github/workflows/run_bundling.yml index c2ae85e336521f85d45e75c3cab92ae26709bc05..87619f7c18589f672dd9f4fc636961d145501350 100644 --- a/.github/workflows/run_bundling.yml +++ b/.github/workflows/run_bundling.yml @@ -100,7 +100,7 @@ jobs: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: CARGO_INCREMENTAL: 0 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} @@ -146,7 +146,7 @@ jobs: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: CARGO_INCREMENTAL: 0 ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index b9c35b7b88b93f85ee7d456b3b127abbbf35065d..efdeaeb99ae6fd7811d97527e86aec0b7fd63431 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -148,7 +148,7 @@ jobs: needs: - orchestrate if: needs.orchestrate.outputs.run_tests == 'true' - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -241,11 +241,19 @@ jobs: rm -rf ./../.cargo shell: bash -euxo pipefail {0} timeout-minutes: 60 + services: + postgres: + image: postgres:15 + env: + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 500ms --health-timeout 5s --health-retries 10 run_tests_mac: needs: - orchestrate if: needs.orchestrate.outputs.run_tests == 'true' - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -256,10 +264,17 @@ jobs: mkdir -p ./../.cargo cp ./.cargo/ci-config.toml ./../.cargo/config.toml shell: bash -euxo pipefail {0} + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/nscloud-cache-action@v1 + with: + cache: rust + path: ~/.rustup - name: steps::setup_node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: node-version: '20' + - name: steps::cargo_install_nextest + uses: taiki-e/install-action@nextest - name: steps::clear_target_dir_if_large run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} @@ -527,7 +542,7 @@ jobs: needs: - orchestrate if: needs.orchestrate.outputs.run_nix == 'true' - runs-on: self-mini-macos + runs-on: namespace-profile-mac-large env: ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} @@ -538,11 +553,10 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: nix_build::build_nix::set_path - run: | - echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH" - echo "/Users/administrator/.nix-profile/bin" >> "$GITHUB_PATH" - shell: bash -euxo pipefail {0} + - name: nix_build::build_nix::install_nix + uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: nix_build::build_nix::cachix_action uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad with: @@ -553,12 +567,6 @@ jobs: - name: nix_build::build_nix::build run: nix build .#debug -L --accept-flake-config shell: bash -euxo pipefail {0} - - name: nix_build::build_nix::limit_store - run: |- - if [ "$(du -sm /nix/store | cut -f1)" -gt 50000 ]; then - nix-collect-garbage -d || true - fi - shell: bash -euxo pipefail {0} timeout-minutes: 60 continue-on-error: true check_postgres_and_protobuf_migrations: diff --git a/Cargo.lock b/Cargo.lock index 03e45342025d36dd006a4e72a03a678d1191aa31..0329e18e32a943736231256a1abb4f92b42e1735 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7079,7 +7079,7 @@ dependencies = [ [[package]] name = "gh-workflow" version = "0.8.0" -source = "git+https://github.com/zed-industries/gh-workflow?rev=09acfdf2bd5c1d6254abefd609c808ff73547b2c#09acfdf2bd5c1d6254abefd609c808ff73547b2c" +source = "git+https://github.com/zed-industries/gh-workflow?rev=c9eac0ed361583e1072860d96776fa52775b82ac#c9eac0ed361583e1072860d96776fa52775b82ac" dependencies = [ "async-trait", "derive_more 2.0.1", @@ -7096,7 +7096,7 @@ dependencies = [ [[package]] name = "gh-workflow-macros" version = "0.8.0" -source = "git+https://github.com/zed-industries/gh-workflow?rev=09acfdf2bd5c1d6254abefd609c808ff73547b2c#09acfdf2bd5c1d6254abefd609c808ff73547b2c" +source = "git+https://github.com/zed-industries/gh-workflow?rev=c9eac0ed361583e1072860d96776fa52775b82ac#c9eac0ed361583e1072860d96776fa52775b82ac" dependencies = [ "heck 0.5.0", "quote", diff --git a/Cargo.toml b/Cargo.toml index d9ee65970f1424f83a68245c14e88b8afc9dc141..6306536e5cd30cc648fa6279462c4c7826aff95c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -528,8 +528,8 @@ fancy-regex = "0.16.0" fork = "0.4.0" futures = "0.3" futures-lite = "1.13" -gh-workflow = { git = "https://github.com/zed-industries/gh-workflow", rev = "09acfdf2bd5c1d6254abefd609c808ff73547b2c" } -git2 = { version = "0.20.1", default-features = false } +gh-workflow = { git = "https://github.com/zed-industries/gh-workflow", rev = "c9eac0ed361583e1072860d96776fa52775b82ac" } +git2 = { version = "0.20.1", default-features = false, features = ["vendored-libgit2"] } globset = "0.4" handlebars = "4.3" heck = "0.5" diff --git a/crates/collab/src/db/tests.rs b/crates/collab/src/db/tests.rs deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/crates/collab/src/db/tests.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/collab/tests/integration/db_tests.rs b/crates/collab/tests/integration/db_tests.rs index 20e3826a74969b077b229c56ba15ff6a4ab797f2..b956c5874b4aaa6aa47f214c4bb591b80c11253c 100644 --- a/crates/collab/tests/integration/db_tests.rs +++ b/crates/collab/tests/integration/db_tests.rs @@ -122,9 +122,13 @@ impl TestDb { #[macro_export] macro_rules! test_both_dbs { ($test_name:ident, $postgres_test_name:ident, $sqlite_test_name:ident) => { - #[cfg(target_os = "macos")] #[gpui::test] async fn $postgres_test_name(cx: &mut gpui::TestAppContext) { + // In CI, only run postgres tests on Linux (where we have the postgres service). + // Locally, always run them (assuming postgres is available). + if std::env::var("CI").is_ok() && !cfg!(target_os = "linux") { + return; + } let test_db = $crate::db_tests::TestDb::postgres(cx.executor().clone()); $test_name(test_db.db()).await; } diff --git a/crates/collab/tests/integration/db_tests/db_tests.rs b/crates/collab/tests/integration/db_tests/db_tests.rs index 05d77b6c109496ce395258d0a704d6cb0fff9d66..0b3de7eea6febf14dcb3ed43eea1973b0361d439 100644 --- a/crates/collab/tests/integration/db_tests/db_tests.rs +++ b/crates/collab/tests/integration/db_tests/db_tests.rs @@ -542,9 +542,13 @@ fn test_fuzzy_like_string() { assert_eq!(Database::fuzzy_like_string(" z "), "%z%"); } -#[cfg(target_os = "macos")] #[gpui::test] async fn test_fuzzy_search_users(cx: &mut gpui::TestAppContext) { + // In CI, only run postgres tests on Linux (where we have the postgres service). + // Locally, always run them (assuming postgres is available). + if std::env::var("CI").is_ok() && !cfg!(target_os = "linux") { + return; + } let test_db = TestDb::postgres(cx.executor()); let db = test_db.db(); for (i, github_login) in [ diff --git a/tooling/xtask/src/tasks/workflows/nix_build.rs b/tooling/xtask/src/tasks/workflows/nix_build.rs index ff98852d191ae8b0edf29c6cdf52985b16034221..21fb8898bb31adcdacd56487e26c592593dbcfce 100644 --- a/tooling/xtask/src/tasks/workflows/nix_build.rs +++ b/tooling/xtask/src/tasks/workflows/nix_build.rs @@ -5,7 +5,6 @@ use crate::tasks::workflows::{ use super::{runners, steps, steps::named, vars}; use gh_workflow::*; -use indoc::indoc; pub(crate) fn build_nix( platform: Platform, @@ -14,16 +13,6 @@ 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 { - 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 { named::uses( "cachix", @@ -55,14 +44,6 @@ pub(crate) fn build_nix( )) } - pub fn limit_store() -> Step { - 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, @@ -86,16 +67,10 @@ pub(crate) fn build_nix( job = job.needs(deps.iter().map(|d| d.name.clone()).collect::>()); } - job = if platform == Platform::Linux { - job.add_step(install_nix()) - .add_step(cachix_action(cachix_filter)) - .add_step(build(&flake_output)) - } else { - job.add_step(set_path()) - .add_step(cachix_action(cachix_filter)) - .add_step(build(&flake_output)) - .add_step(limit_store()) - }; + job = job + .add_step(install_nix()) + .add_step(cachix_action(cachix_filter)) + .add_step(build(&flake_output)); NamedJob { name: format!("build_nix_{platform}_{arch}"), diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs index 7637a7abd1231a92f10cac04abab3d0908552bf2..99d64ae4be819e1ff12fb359182d19735c42f12c 100644 --- a/tooling/xtask/src/tasks/workflows/run_tests.rs +++ b/tooling/xtask/src/tasks/workflows/run_tests.rs @@ -1,5 +1,6 @@ use gh_workflow::{ - Concurrency, Event, Expression, Job, PullRequest, Push, Run, Step, Use, Workflow, + Concurrency, Container, Event, Expression, Job, Port, PullRequest, Push, Run, Step, Use, + Workflow, }; use indexmap::IndexMap; @@ -340,19 +341,35 @@ pub(crate) fn run_platform_tests(platform: Platform) -> NamedJob { name: format!("run_tests_{platform}"), job: release_job(&[]) .runs_on(runner) + .when(platform == Platform::Linux, |job| { + job.add_service( + "postgres", + Container::new("postgres:15") + .add_env(("POSTGRES_HOST_AUTH_METHOD", "trust")) + .ports(vec![Port::Name("5432:5432".into())]) + .options( + "--health-cmd pg_isready \ + --health-interval 500ms \ + --health-timeout 5s \ + --health-retries 10", + ), + ) + }) .add_step(steps::checkout_repo()) .add_step(steps::setup_cargo_config(platform)) - .when(platform == Platform::Linux, |this| { - this.add_step(steps::cache_rust_dependencies_namespace()) - }) + .when( + platform == Platform::Linux || platform == Platform::Mac, + |this| this.add_step(steps::cache_rust_dependencies_namespace()), + ) .when( platform == Platform::Linux, steps::install_linux_dependencies, ) .add_step(steps::setup_node()) - .when(platform == Platform::Linux, |job| { - job.add_step(steps::cargo_install_nextest()) - }) + .when( + platform == Platform::Linux || platform == Platform::Mac, + |job| job.add_step(steps::cargo_install_nextest()), + ) .add_step(steps::clear_target_dir_if_large(platform)) .add_step(steps::cargo_nextest(platform)) .add_step(steps::cleanup_cargo_config(platform)), diff --git a/tooling/xtask/src/tasks/workflows/runners.rs b/tooling/xtask/src/tasks/workflows/runners.rs index 01e79359035380d60033ab2063a9259a730508be..bc4b17aaf69200d86d78dce88faaecfb88f2a51f 100644 --- a/tooling/xtask/src/tasks/workflows/runners.rs +++ b/tooling/xtask/src/tasks/workflows/runners.rs @@ -11,7 +11,7 @@ pub const LINUX_ARM_BUNDLER: Runner = Runner("namespace-profile-8x32-ubuntu-2004 // Larger Ubuntu runner with glibc 2.39 for extension bundling pub const LINUX_LARGE_RAM: Runner = Runner("namespace-profile-8x32-ubuntu-2404"); -pub const MAC_DEFAULT: Runner = Runner("self-mini-macos"); +pub const MAC_DEFAULT: Runner = Runner("namespace-profile-mac-large"); pub const WINDOWS_DEFAULT: Runner = Runner("self-32vcpu-windows-2022"); pub struct Runner(&'static str);