ci: Put docs-only conditionals on each step (#22261)

This PR is a follow up to #22254 with a different approach.

We need to put the conditional on each step in order to skip them, as I
couldn't see any other way of bailing out of the pipeline early based on
a condition.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-12-19 14:46:10 -05:00 committed by GitHub
parent 6231072d85
commit 9782abf3c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,36 +116,36 @@ jobs:
with: with:
clean: false clean: false
- name: Skip for docs-only changes
if: needs.check_docs_only.outputs.docs_only == 'true'
run: |
echo "Skipping for docs-only changes"
exit 0
- name: cargo clippy - name: cargo clippy
if: needs.check_docs_only.outputs.docs_only == 'false'
run: ./script/clippy run: ./script/clippy
- name: Check unused dependencies - name: Check unused dependencies
if: needs.check_docs_only.outputs.docs_only == 'false'
uses: bnjbvr/cargo-machete@main uses: bnjbvr/cargo-machete@main
- name: Check licenses - name: Check licenses
if: needs.check_docs_only.outputs.docs_only == 'false'
run: | run: |
script/check-licenses script/check-licenses
script/generate-licenses /tmp/zed_licenses_output script/generate-licenses /tmp/zed_licenses_output
- name: Check for new vulnerable dependencies - name: Check for new vulnerable dependencies
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request' && needs.check_docs_only.outputs.docs_only == 'false'
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4 uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4
with: with:
license-check: false license-check: false
- name: Run tests - name: Run tests
if: needs.check_docs_only.outputs.docs_only == 'false'
uses: ./.github/actions/run_tests uses: ./.github/actions/run_tests
- name: Build collab - name: Build collab
if: needs.check_docs_only.outputs.docs_only == 'false'
run: cargo build -p collab run: cargo build -p collab
- name: Build other binaries and features - name: Build other binaries and features
if: needs.check_docs_only.outputs.docs_only == 'false'
run: | run: |
cargo build --workspace --bins --all-features cargo build --workspace --bins --all-features
cargo check -p gpui --features "macos-blade" cargo check -p gpui --features "macos-blade"
@ -169,28 +169,27 @@ jobs:
with: with:
clean: false clean: false
- name: Skip for docs-only changes
if: needs.check_docs_only.outputs.docs_only == 'true'
run: |
echo "Skipping for docs-only changes"
exit 0
- name: Cache dependencies - name: Cache dependencies
if: needs.check_docs_only.outputs.docs_only == 'false'
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "buildjet" cache-provider: "buildjet"
- name: Install Linux dependencies - name: Install Linux dependencies
if: needs.check_docs_only.outputs.docs_only == 'false'
run: ./script/linux run: ./script/linux
- name: cargo clippy - name: cargo clippy
if: needs.check_docs_only.outputs.docs_only == 'false'
run: ./script/clippy run: ./script/clippy
- name: Run tests - name: Run tests
if: needs.check_docs_only.outputs.docs_only == 'false'
uses: ./.github/actions/run_tests uses: ./.github/actions/run_tests
- name: Build other binaries and features - name: Build other binaries and features
if: needs.check_docs_only.outputs.docs_only == 'false'
run: | run: |
cargo build -p zed cargo build -p zed
cargo check -p workspace cargo check -p workspace
@ -211,22 +210,19 @@ jobs:
with: with:
clean: false clean: false
- name: Skip for docs-only changes
if: needs.check_docs_only.outputs.docs_only == 'true'
run: |
echo "Skipping for docs-only changes"
exit 0
- name: Cache dependencies - name: Cache dependencies
if: needs.check_docs_only.outputs.docs_only == 'false'
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "buildjet" cache-provider: "buildjet"
- name: Install Clang & Mold - name: Install Clang & Mold
if: needs.check_docs_only.outputs.docs_only == 'false'
run: ./script/remote-server && ./script/install-mold 2.34.0 run: ./script/remote-server && ./script/install-mold 2.34.0
- name: Build Remote Server - name: Build Remote Server
if: needs.check_docs_only.outputs.docs_only == 'false'
run: cargo build -p remote_server run: cargo build -p remote_server
# todo(windows): Actually run the tests # todo(windows): Actually run the tests
@ -245,23 +241,20 @@ jobs:
with: with:
clean: false clean: false
- name: Skip for docs-only changes
if: needs.check_docs_only.outputs.docs_only == 'true'
run: |
echo "Skipping for docs-only changes"
exit 0
- name: Cache dependencies - name: Cache dependencies
if: needs.check_docs_only.outputs.docs_only == 'false'
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "github" cache-provider: "github"
- name: cargo clippy - name: cargo clippy
if: needs.check_docs_only.outputs.docs_only == 'false'
# Windows can't run shell scripts, so we need to use `cargo xtask`. # Windows can't run shell scripts, so we need to use `cargo xtask`.
run: cargo xtask clippy run: cargo xtask clippy
- name: Build Zed - name: Build Zed
if: needs.check_docs_only.outputs.docs_only == 'false'
run: cargo build run: cargo build
bundle-mac: bundle-mac: