From c04f123e44ec49d998ab66b4a5c7216c617f1eec Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 22 Nov 2023 22:25:26 +0100 Subject: [PATCH] ci: Add ci-config.toml in .cargo folder. --- .cargo/ci-config.toml | 12 ++++++++++++ .github/workflows/ci.yml | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .cargo/ci-config.toml diff --git a/.cargo/ci-config.toml b/.cargo/ci-config.toml new file mode 100644 index 0000000000..6dbaf4b446 --- /dev/null +++ b/.cargo/ci-config.toml @@ -0,0 +1,12 @@ +# This config is different from config.toml in this directory, as the latter is recognized by Cargo. +# This file is placed in $HOME/.cargo/config.toml on CI runs. Cargo then merges Zeds .cargo/config.toml with $HOME/.cargo/config.toml +# with preference for settings from Zeds config.toml. +# TL;DR: If a value is set in both ci-config.toml and config.toml, config.toml value takes precedence. +# Arrays are merged together though. See: https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure +# The intent for this file is to configure CI build process with a divergance from Zed developers experience; for example, in this config file +# we use `-D warnings` for rustflags (which makes compilation fail in presence of warnings during build process). Placing that in developers `config.toml` +# would be incovenient. +# We *could* override things like RUSTFLAGS manually by setting them as environment variables, but that is less DRY; worse yet, if you forget to set proper environment variables +# in one spot, that's going to trigger a rebuild of all of the artifacts. Using ci-config.toml we can define these overrides for CI in one spot and not worry about it. +[build] +rustflags = ["-D", "warnings"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 208d538976..ef718a4fa9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,15 +23,15 @@ jobs: - self-hosted - test steps: - - name: Set up default .cargo/config.toml - run: printf "[build]\nrustflags = [\"-D\", \"warnings\"]" > $HOME/.cargo/config.toml - - name: Checkout repo uses: actions/checkout@v3 with: clean: false submodules: "recursive" + - name: Set up default .cargo/config.toml + run: cp ./.cargo/ci-config.toml ~/.cargo/config.toml + - name: Run rustfmt uses: ./.github/actions/check_formatting