ci: Improve GitHub Action modularity (#18861)
- Closes: https://github.com/zed-industries/zed/issues/19351 - Switch to using the official [typos GitHub Action](https://github.com/crate-ci/typos/blob/master/docs/github-action.md) - Move the typos check into `actions/check_style` - Move Squawk Postgres migration check out of `actions/check_style` file into ci.yml - `actions/check_style` can now be run on stateless/linux runners (previous required self-hosted MacOS runner) - ci.yml: Split old `style` into checks into those that can run statelessly (linux) and everything else into a new `migration` group which benefit from the full git checkout available on the MacOS runners. - ci.yml: Move `Check unused dependencies` from style to `linux_tests` - Add `if: github.repository_owner == 'zed-industries'` to all jobs so they won't try and run on GitHub forks.
This commit is contained in:
parent
65fb2782eb
commit
4ae2f93086
5 changed files with 42 additions and 39 deletions
11
.github/actions/check_style/action.yml
vendored
11
.github/actions/check_style/action.yml
vendored
|
@ -4,12 +4,11 @@ description: "Checks code formatting use cargo fmt"
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check for Typos with Typos-CLI
|
||||||
|
uses: crate-ci/typos@v1.24.6
|
||||||
|
with:
|
||||||
|
config: ./typos.toml
|
||||||
|
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
shell: bash -euxo pipefail {0}
|
shell: bash -euxo pipefail {0}
|
||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
- name: Find modified migrations
|
|
||||||
shell: bash -euxo pipefail {0}
|
|
||||||
run: |
|
|
||||||
export SQUAWK_GITHUB_TOKEN=${{ github.token }}
|
|
||||||
. ./script/squawk
|
|
||||||
|
|
47
.github/workflows/ci.yml
vendored
47
.github/workflows/ci.yml
vendored
|
@ -26,9 +26,10 @@ env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
style:
|
migration_checks:
|
||||||
|
name: Check Postgres and Protobuf migrations, mergability
|
||||||
|
if: github.repository_owner == 'zed-industries'
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
name: Check formatting and spelling
|
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
|
@ -37,25 +38,16 @@ jobs:
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0 # fetch full history
|
||||||
|
|
||||||
- name: Remove untracked files
|
- name: Remove untracked files
|
||||||
run: git clean -df
|
run: git clean -df
|
||||||
|
|
||||||
- name: Check spelling
|
- name: Find modified migrations
|
||||||
run: script/check-spelling
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: |
|
||||||
- name: Run style checks
|
export SQUAWK_GITHUB_TOKEN=${{ github.token }}
|
||||||
uses: ./.github/actions/check_style
|
. ./script/squawk
|
||||||
|
|
||||||
- name: Check unused dependencies
|
|
||||||
uses: bnjbvr/cargo-machete@main
|
|
||||||
|
|
||||||
- name: Check licenses are present
|
|
||||||
run: script/check-licenses
|
|
||||||
|
|
||||||
- name: Check license generation
|
|
||||||
run: script/generate-licenses /tmp/zed_licenses_output
|
|
||||||
|
|
||||||
- name: Ensure fresh merge
|
- name: Ensure fresh merge
|
||||||
shell: bash -euxo pipefail {0}
|
shell: bash -euxo pipefail {0}
|
||||||
|
@ -77,6 +69,19 @@ jobs:
|
||||||
input: "crates/proto/proto/"
|
input: "crates/proto/proto/"
|
||||||
against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
|
against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=${BUF_BASE_BRANCH},subdir=crates/proto/proto/"
|
||||||
|
|
||||||
|
style:
|
||||||
|
timeout-minutes: 60
|
||||||
|
name: Check formatting and spelling
|
||||||
|
if: github.repository_owner == 'zed-industries'
|
||||||
|
runs-on:
|
||||||
|
- buildjet-8vcpu-ubuntu-2204
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||||
|
|
||||||
|
- name: Run style checks
|
||||||
|
uses: ./.github/actions/check_style
|
||||||
|
|
||||||
macos_tests:
|
macos_tests:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
name: (macOS) Run Clippy and tests
|
name: (macOS) Run Clippy and tests
|
||||||
|
@ -92,6 +97,14 @@ jobs:
|
||||||
- name: cargo clippy
|
- name: cargo clippy
|
||||||
run: ./script/clippy
|
run: ./script/clippy
|
||||||
|
|
||||||
|
- name: Check unused dependencies
|
||||||
|
uses: bnjbvr/cargo-machete@main
|
||||||
|
|
||||||
|
- name: Check licenses
|
||||||
|
run: |
|
||||||
|
script/check-licenses
|
||||||
|
script/generate-licenses /tmp/zed_licenses_output
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
uses: ./.github/actions/run_tests
|
uses: ./.github/actions/run_tests
|
||||||
|
|
||||||
|
|
1
.github/workflows/deploy_cloudflare.yml
vendored
1
.github/workflows/deploy_cloudflare.yml
vendored
|
@ -8,6 +8,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
deploy-docs:
|
deploy-docs:
|
||||||
name: Deploy Docs
|
name: Deploy Docs
|
||||||
|
if: github.repository_owner == 'zed-industries'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
8
.github/workflows/docs.yml
vendored
8
.github/workflows/docs.yml
vendored
|
@ -11,6 +11,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
check_formatting:
|
check_formatting:
|
||||||
name: "Check formatting"
|
name: "Check formatting"
|
||||||
|
if: github.repository_owner == 'zed-industries'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -29,5 +30,8 @@ jobs:
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Check spelling
|
- name: Check for Typos with Typos-CLI
|
||||||
run: script/check-spelling docs/
|
uses: crate-ci/typos@v1.24.6
|
||||||
|
with:
|
||||||
|
config: ./typos.toml
|
||||||
|
files: ./docs/
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
TYPOS_CLI_VERSION=1.24.6
|
|
||||||
TARGET_DIR=${1:-""}
|
|
||||||
|
|
||||||
if ! cargo install --list | grep "typos-cli v$TYPOS_CLI_VERSION" > /dev/null; then
|
|
||||||
echo "Installing typos-cli@$TYPOS_CLI_VERSION..."
|
|
||||||
cargo install "typos-cli@$TYPOS_CLI_VERSION"
|
|
||||||
else
|
|
||||||
echo "typos-cli@$TYPOS_CLI_VERSION is already installed."
|
|
||||||
fi
|
|
||||||
typos $TARGET_DIR
|
|
Loading…
Add table
Add a link
Reference in a new issue