mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-29 19:14:13 +00:00
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/github-script](https://redirect.github.com/actions/github-script) | action | pinDigest | → `f28e40c` | | [actions/setup-python](https://redirect.github.com/actions/setup-python) | action | pinDigest | → `a26af69` | | [namespacelabs/nscloud-cache-action](https://redirect.github.com/namespacelabs/nscloud-cache-action) | action | pinDigest | → `a90bb5d` | | [taiki-e/install-action](https://redirect.github.com/taiki-e/install-action) | action | pinDigest | → `921e2c9` | | [taiki-e/install-action](https://redirect.github.com/taiki-e/install-action) | action | pinDigest | → `b4f2d5c` | | [withastro/automation](https://redirect.github.com/withastro/automation) | action | pinDigest | → `a5bd0c5` | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/15138) for more information. --- ### Configuration 📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone America/New_York, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- Release Notes: - N/A <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My45MS41IiwidXBkYXRlZEluVmVyIjoiNDMuOTEuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Marshall Bowers <git@maxdeviant.com>
224 lines
8.8 KiB
YAML
224 lines
8.8 KiB
YAML
# Generated from xtask::workflows::extension_tests
|
|
# Rebuild with `cargo xtask workflows`.
|
|
name: extension_tests
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUST_BACKTRACE: '1'
|
|
CARGO_INCREMENTAL: '0'
|
|
ZED_EXTENSION_CLI_SHA: 1fa7f1a3ec28ea1eae6db2e937d7a538fb10c0c7
|
|
RUSTUP_TOOLCHAIN: stable
|
|
CARGO_BUILD_TARGET: wasm32-wasip2
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
working-directory:
|
|
description: working-directory
|
|
type: string
|
|
default: .
|
|
jobs:
|
|
orchestrate:
|
|
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
|
|
runs-on: namespace-profile-2x4-ubuntu-2404
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
fetch-depth: ${{ github.ref == 'refs/heads/main' && 2 || 350 }}
|
|
- id: filter
|
|
name: filter
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -z "$GITHUB_BASE_REF" ]; then
|
|
echo "Not in a PR context (i.e., push to main/stable/preview)"
|
|
COMPARE_REV="$(git rev-parse HEAD~1)"
|
|
else
|
|
echo "In a PR context comparing to pull_request.base.ref"
|
|
git fetch origin "$GITHUB_BASE_REF" --depth=350
|
|
COMPARE_REV="$(git merge-base "origin/${GITHUB_BASE_REF}" HEAD)"
|
|
fi
|
|
CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" "$GITHUB_SHA")"
|
|
|
|
# When running from a subdirectory, git diff returns repo-root-relative paths.
|
|
# Filter to only files within the current working directory and strip the prefix.
|
|
REPO_SUBDIR="$(git rev-parse --show-prefix)"
|
|
REPO_SUBDIR="${REPO_SUBDIR%/}"
|
|
if [ -n "$REPO_SUBDIR" ]; then
|
|
CHANGED_FILES="$(echo "$CHANGED_FILES" | grep "^${REPO_SUBDIR}/" | sed "s|^${REPO_SUBDIR}/||" || true)"
|
|
fi
|
|
|
|
check_pattern() {
|
|
local output_name="$1"
|
|
local pattern="$2"
|
|
local grep_arg="$3"
|
|
|
|
echo "$CHANGED_FILES" | grep "$grep_arg" "$pattern" && \
|
|
echo "${output_name}=true" >> "$GITHUB_OUTPUT" || \
|
|
echo "${output_name}=false" >> "$GITHUB_OUTPUT"
|
|
}
|
|
|
|
check_pattern "check_rust" '^(Cargo.lock|Cargo.toml|.*\.rs)$' -qP
|
|
check_pattern "check_extension" '^(extension\.toml|.*\.scm)$' -qP
|
|
outputs:
|
|
check_rust: ${{ steps.filter.outputs.check_rust }}
|
|
check_extension: ${{ steps.filter.outputs.check_extension }}
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|
|
working-directory: ${{ inputs.working-directory }}
|
|
check_rust:
|
|
needs:
|
|
- orchestrate
|
|
if: needs.orchestrate.outputs.check_rust == 'true'
|
|
runs-on: namespace-profile-8x32-ubuntu-2404
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
- name: steps::cache_rust_dependencies_namespace
|
|
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
|
|
with:
|
|
cache: rust
|
|
path: ~/.rustup
|
|
- name: extension_tests::install_rust_target
|
|
run: rustup target add wasm32-wasip2
|
|
- id: get-package-name
|
|
name: extension_tests::get_package_name
|
|
run: |
|
|
PACKAGE_NAME="$(sed -n 's/^name = "\(.*\)"/\1/p' < Cargo.toml | head -1 | tr -d '[:space:]')"
|
|
echo "package_name=${PACKAGE_NAME}" >> "$GITHUB_OUTPUT"
|
|
- name: extension_tests::cargo_fmt_package
|
|
run: cargo fmt -p "$PACKAGE_NAME" -- --check
|
|
env:
|
|
PACKAGE_NAME: ${{ steps.get-package-name.outputs.package_name }}
|
|
- name: extension_tests::run_clippy
|
|
run: cargo clippy -p "$PACKAGE_NAME" --release --all-features -- --deny warnings
|
|
env:
|
|
PACKAGE_NAME: ${{ steps.get-package-name.outputs.package_name }}
|
|
- name: steps::cargo_install_nextest
|
|
uses: taiki-e/install-action@921e2c9f7148d7ba14cd819f417db338f63e733c
|
|
- name: extension_tests::run_nextest
|
|
run: 'cargo nextest run -p "$PACKAGE_NAME" --no-fail-fast --no-tests=warn --target "$(rustc -vV | sed -n ''s|host: ||p'')"'
|
|
env:
|
|
PACKAGE_NAME: ${{ steps.get-package-name.outputs.package_name }}
|
|
NEXTEST_NO_TESTS: warn
|
|
timeout-minutes: 6
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|
|
working-directory: ${{ inputs.working-directory }}
|
|
check_extension:
|
|
needs:
|
|
- orchestrate
|
|
if: needs.orchestrate.outputs.check_extension == 'true'
|
|
runs-on: namespace-profile-8x32-ubuntu-2404
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
fetch-depth: 0
|
|
- id: cache-zed-extension-cli
|
|
name: extension_tests::cache_zed_extension_cli
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
|
|
with:
|
|
path: zed-extension
|
|
key: zed-extension-${{ env.ZED_EXTENSION_CLI_SHA }}
|
|
- name: extension_tests::download_zed_extension_cli
|
|
if: steps.cache-zed-extension-cli.outputs.cache-hit != 'true'
|
|
run: |
|
|
wget --quiet "https://zed-extension-cli.nyc3.digitaloceanspaces.com/$ZED_EXTENSION_CLI_SHA/x86_64-unknown-linux-gnu/zed-extension" -O "$GITHUB_WORKSPACE/zed-extension"
|
|
chmod +x "$GITHUB_WORKSPACE/zed-extension"
|
|
- name: steps::cache_rust_dependencies_namespace
|
|
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
|
|
with:
|
|
cache: rust
|
|
path: ~/.rustup
|
|
- name: extension_tests::check
|
|
run: |
|
|
mkdir -p /tmp/ext-scratch
|
|
mkdir -p /tmp/ext-output
|
|
"$GITHUB_WORKSPACE/zed-extension" --source-dir . --scratch-dir /tmp/ext-scratch --output-dir /tmp/ext-output
|
|
- name: run_tests::fetch_ts_query_ls
|
|
uses: dsaltares/fetch-gh-release-asset@aa37ae5c44d3c9820bc12fe675e8670ecd93bd1c
|
|
with:
|
|
repo: ribru17/ts_query_ls
|
|
version: tags/v3.15.1
|
|
file: ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
|
|
- name: run_tests::run_ts_query_ls
|
|
run: |-
|
|
tar -xf "$GITHUB_WORKSPACE/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz" -C "$GITHUB_WORKSPACE"
|
|
"$GITHUB_WORKSPACE/ts_query_ls" format --check . || {
|
|
echo "Found unformatted queries, please format them with ts_query_ls."
|
|
echo "For easy use, install the Tree-sitter query extension:"
|
|
echo "zed://extension/tree-sitter-query"
|
|
false
|
|
}
|
|
- id: compare-versions-check
|
|
name: extension_bump::compare_versions
|
|
run: |
|
|
CURRENT_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"
|
|
|
|
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
|
|
PR_FORK_POINT="$(git merge-base origin/main HEAD)"
|
|
git checkout "$PR_FORK_POINT"
|
|
else
|
|
git checkout "$(git log -1 --format=%H)"~1
|
|
fi
|
|
|
|
PARENT_COMMIT_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"
|
|
|
|
[[ "$CURRENT_VERSION" == "$PARENT_COMMIT_VERSION" ]] && \
|
|
echo "version_changed=false" >> "$GITHUB_OUTPUT" || \
|
|
echo "version_changed=true" >> "$GITHUB_OUTPUT"
|
|
|
|
echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT"
|
|
- name: extension_tests::verify_version_did_not_change
|
|
run: |
|
|
if [[ "$VERSION_CHANGED" == "true" && "$GITHUB_EVENT_NAME" == "pull_request" && "$PR_USER_LOGIN" != "zed-zippy[bot]" ]] ; then
|
|
echo "Version change detected in your change!"
|
|
echo "Version changes happen in separate PRs and will be performed by the zed-zippy bot"
|
|
exit 42
|
|
fi
|
|
env:
|
|
VERSION_CHANGED: ${{ steps.compare-versions-check.outputs.version_changed }}
|
|
PR_USER_LOGIN: ${{ github.event.pull_request.user.login }}
|
|
timeout-minutes: 6
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|
|
working-directory: ${{ inputs.working-directory }}
|
|
tests_pass:
|
|
needs:
|
|
- orchestrate
|
|
- check_rust
|
|
- check_extension
|
|
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && always()
|
|
runs-on: namespace-profile-2x4-ubuntu-2404
|
|
steps:
|
|
- name: run_tests::tests_pass
|
|
run: |
|
|
set +x
|
|
EXIT_CODE=0
|
|
|
|
check_result() {
|
|
echo "* $1: $2"
|
|
if [[ "$2" != "skipped" && "$2" != "success" ]]; then EXIT_CODE=1; fi
|
|
}
|
|
|
|
check_result "orchestrate" "$RESULT_ORCHESTRATE"
|
|
check_result "check_rust" "$RESULT_CHECK_RUST"
|
|
check_result "check_extension" "$RESULT_CHECK_EXTENSION"
|
|
|
|
exit $EXIT_CODE
|
|
env:
|
|
RESULT_ORCHESTRATE: ${{ needs.orchestrate.result }}
|
|
RESULT_CHECK_RUST: ${{ needs.check_rust.result }}
|
|
RESULT_CHECK_EXTENSION: ${{ needs.check_extension.result }}
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}extension-tests
|
|
cancel-in-progress: true
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|