extension_ci: Add initial support for extensions in a subdirectory (#51173)

This wil help with releases for extensions living this repository, which
will become more relevant once agent provider extensions are back on the
table.

Release Notes:

- N/A
This commit is contained in:
Finn Evers authored and GitHub committed 2026-03-13 13:40:45 +01:00
1 parent 46f16c7502
commit 7d566e0600
9 files changed
+278 -90

No files matched your search

+41 -6
View File
@@ -17,6 +17,10 @@ on:
description: force-bump
required: true
type: boolean
working-directory:
description: working-directory
type: string
default: .
secrets:
app-id:
description: The app ID used to create the PR
@@ -42,8 +46,6 @@ jobs:
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
PR_FORK_POINT="$(git merge-base origin/main HEAD)"
git checkout "$PR_FORK_POINT"
elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; then
git checkout "$BRANCH_PARENT_SHA"
else
git checkout "$(git log -1 --format=%H)"~1
fi
@@ -59,6 +61,10 @@ jobs:
version_changed: ${{ steps.compare-versions-check.outputs.version_changed }}
current_version: ${{ steps.compare-versions-check.outputs.current_version }}
timeout-minutes: 1
defaults:
run:
shell: bash -euxo pipefail {0}
working-directory: ${{ inputs.working-directory }}
bump_extension_version:
needs:
- check_version_changed
@@ -98,18 +104,35 @@ jobs:
fi
NEW_VERSION="$(sed -n 's/^version = \"\(.*\)\"/\1/p' < extension.toml | tr -d '[:space:]')"
EXTENSION_ID="$(sed -n 's/^id = "\(.*\)"/\1/p' < extension.toml | head -1 | tr -d '[:space:]')"
EXTENSION_NAME="$(sed -n 's/^name = "\(.*\)"/\1/p' < extension.toml | head -1 | tr -d '[:space:]')"
if [[ "$WORKING_DIR" == "." || -z "$WORKING_DIR" ]]; then
{
echo "title=Bump version to ${NEW_VERSION}";
echo "body=This PR bumps the version of this extension to v${NEW_VERSION}";
echo "branch_name=zed-zippy-autobump";
} >> "$GITHUB_OUTPUT"
else
{
echo "title=${EXTENSION_ID}: Bump to v${NEW_VERSION}";
echo "body=This PR bumps the version of the ${EXTENSION_NAME} extension to v${NEW_VERSION}";
echo "branch_name=zed-zippy-${EXTENSION_ID}-autobump";
} >> "$GITHUB_OUTPUT"
fi
echo "new_version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
env:
OLD_VERSION: ${{ needs.check_version_changed.outputs.current_version }}
BUMP_TYPE: ${{ inputs.bump-type }}
WORKING_DIR: ${{ inputs.working-directory }}
- name: extension_bump::create_pull_request
uses: peter-evans/create-pull-request@v7
with:
title: Bump version to ${{ steps.bump-version.outputs.new_version }}
body: This PR bumps the version of this extension to v${{ steps.bump-version.outputs.new_version }}
commit-message: Bump version to v${{ steps.bump-version.outputs.new_version }}
branch: zed-zippy-autobump
title: ${{ steps.bump-version.outputs.title }}
body: ${{ steps.bump-version.outputs.body }}
commit-message: ${{ steps.bump-version.outputs.title }}
branch: ${{ steps.bump-version.outputs.branch_name }}
committer: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
base: main
delete-branch: true
@@ -117,6 +140,10 @@ jobs:
sign-commits: true
assignees: ${{ github.actor }}
timeout-minutes: 3
defaults:
run:
shell: bash -euxo pipefail {0}
working-directory: ${{ inputs.working-directory }}
create_version_label:
needs:
- check_version_changed
@@ -145,6 +172,10 @@ jobs:
})
github-token: ${{ steps.generate-token.outputs.token }}
timeout-minutes: 1
defaults:
run:
shell: bash -euxo pipefail {0}
working-directory: ${{ inputs.working-directory }}
trigger_release:
needs:
- check_version_changed
@@ -178,6 +209,10 @@ jobs:
tag: v${{ needs.check_version_changed.outputs.current_version }}
env:
COMMITTER_TOKEN: ${{ steps.generate-token.outputs.token }}
defaults:
run:
shell: bash -euxo pipefail {0}
working-directory: ${{ inputs.working-directory }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
cancel-in-progress: true
+50 -13
View File
@@ -9,7 +9,12 @@ env:
RUSTUP_TOOLCHAIN: stable
CARGO_BUILD_TARGET: wasm32-wasip2
on:
workflow_call: {}
workflow_call:
inputs:
working-directory:
description: working-directory
type: string
default: .
jobs:
orchestrate:
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
@@ -34,6 +39,14 @@ jobs:
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"
@@ -49,6 +62,10 @@ jobs:
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
@@ -66,17 +83,31 @@ jobs:
path: ~/.rustup
- name: extension_tests::install_rust_target
run: rustup target add wasm32-wasip2
- name: steps::cargo_fmt
run: cargo fmt --all -- --check
- 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 --release --all-features -- --deny warnings
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@nextest
- name: steps::cargo_nextest
run: 'cargo nextest run --workspace --no-fail-fast --no-tests=warn --target "$(rustc -vV | sed -n ''s|host: ||p'')"'
- 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
@@ -97,8 +128,8 @@ jobs:
- 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"
chmod +x zed-extension
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@v1
with:
@@ -108,7 +139,7 @@ jobs:
run: |
mkdir -p /tmp/ext-scratch
mkdir -p /tmp/ext-output
./zed-extension --source-dir . --scratch-dir /tmp/ext-scratch --output-dir /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:
@@ -117,8 +148,8 @@ jobs:
file: ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
- name: run_tests::run_ts_query_ls
run: |-
tar -xf ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
./ts_query_ls format --check . || {
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"
@@ -132,8 +163,6 @@ jobs:
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
PR_FORK_POINT="$(git merge-base origin/main HEAD)"
git checkout "$PR_FORK_POINT"
elif BRANCH_PARENT_SHA="$(git merge-base origin/main origin/zed-zippy-autobump)"; then
git checkout "$BRANCH_PARENT_SHA"
else
git checkout "$(git log -1 --format=%H)"~1
fi
@@ -156,6 +185,10 @@ jobs:
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
@@ -183,6 +216,10 @@ jobs:
RESULT_ORCHESTRATE: ${{ needs.orchestrate.result }}
RESULT_CHECK_RUST: ${{ needs.check_rust.result }}
RESULT_CHECK_EXTENSION: ${{ needs.check_extension.result }}
defaults:
run:
shell: bash -euxo pipefail {0}
working-directory: ${{ inputs.working-directory }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
cancel-in-progress: true
+2 -2
View File
@@ -147,8 +147,8 @@ jobs:
file: ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
- name: run_tests::run_ts_query_ls
run: |-
tar -xf ts_query_ls-x86_64-unknown-linux-gnu.tar.gz
./ts_query_ls format --check . || {
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"