CI: use global config toml (#3384)

It looks like we should keep RUSTFLAGS consistent in CI if possible;
some commands augmented RUSTFLAGS with "-D warnings" which overrode
`.cargo/config.toml`, causing unnecessary rebuilds even for non-bundling
runs. Tl;dr: for the last few days our average CI time spiked
significantly.
There are several solutions:
- We can place `-D warnings` in our `.cargo/config.toml`. That's not a
good solution, because then you wouldn't ever be able to build Zed with
warnings locally. A true PITA!
- We can place another config.toml somewhere in the search path
(https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure)
and rely on the merging of properties. That way we can avoid having `-D
warnings` on developer machines while being able to override CI
behaviour at will.

This PR implements the latter approach by creating the new config file
manually. Ideally we should have it a a separate file in repository
that's moved into $HOME/.cargo on each CI run. Maybe we should even
place it somewhere more local to the checked out Zed version, as placing
it in a global spot is kinda bad too - what if we start building
multiple cargo projects on our CI machines?

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2023-11-22 15:25:43 +01:00 committed by GitHub
commit ce3acf17cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -19,16 +19,12 @@ runs:
- name: Limit target directory size - name: Limit target directory size
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
run: script/clear-target-dir-if-larger-than 70 run: script/clear-target-dir-if-larger-than 100
- name: Run check - name: Run check
env:
RUSTFLAGS: -D warnings
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
run: cargo check --tests --workspace run: cargo check --tests --workspace
- name: Run tests - name: Run tests
env:
RUSTFLAGS: -D warnings
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
run: cargo nextest run --workspace --no-fail-fast run: cargo nextest run --workspace --no-fail-fast

View File

@ -23,6 +23,9 @@ jobs:
- self-hosted - self-hosted
- test - test
steps: steps:
- name: Set up default .cargo/config.toml
run: printf "[build]\nrustflags = [\"-D\", \"warnings\"]" > $HOME/.cargo/config.toml
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -87,7 +90,7 @@ jobs:
submodules: "recursive" submodules: "recursive"
- name: Limit target directory size - name: Limit target directory size
run: script/clear-target-dir-if-larger-than 70 run: script/clear-target-dir-if-larger-than 100
- name: Determine version and release channel - name: Determine version and release channel
if: ${{ startsWith(github.ref, 'refs/tags/v') }} if: ${{ startsWith(github.ref, 'refs/tags/v') }}

View File

@ -79,7 +79,7 @@ jobs:
submodules: "recursive" submodules: "recursive"
- name: Limit target directory size - name: Limit target directory size
run: script/clear-target-dir-if-larger-than 70 run: script/clear-target-dir-if-larger-than 100
- name: Set release channel to nightly - name: Set release channel to nightly
run: | run: |