Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The package-local backend must start without a separately installed CRT.
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

[target.aarch64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

# The bundled musl targets use Rust's linker, including for local cross-builds.
[target.x86_64-unknown-linux-musl]
linker = "rust-lld"

[target.aarch64-unknown-linux-musl]
linker = "rust-lld"
23 changes: 13 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ permissions:

jobs:
package:
uses: ./.github/workflows/package.yml

verify-store:
needs: package
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Build all 6 platform archives
run: node scripts/package.mjs
- name: Verify release archives
- uses: actions/download-artifact@v4
with:
pattern: python-support-archive-*
merge-multiple: true
path: dist
- name: Verify six release archives
env:
LITHE_EXPECT_ALL_ARCHIVES: "1"
run: node --test --test-timeout=60000 scripts/package/*.test.mjs
- name: Validate against Lithe Store rules
run: |
Expand All @@ -37,12 +46,6 @@ jobs:
}
process.exit(failed ? 1 : 0);
"
- name: Upload built platform archives
uses: actions/upload-artifact@v4
with:
name: python-support-archives
path: dist/python-support-*.zip
if-no-files-found: error

commands:
needs: package
Expand Down Expand Up @@ -72,7 +75,7 @@ jobs:
run: python -m pip install --disable-pip-version-check pytest
- uses: actions/download-artifact@v4
with:
name: python-support-archives
name: python-support-archive-${{ matrix.platform }}
path: dist
- name: Unpack Windows archive under a path with spaces
if: runner.os == 'Windows'
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Package Python Support

on:
workflow_call:
inputs:
tag:
type: string
required: false

permissions:
contents: read

jobs:
package:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
platform: darwin-arm64
target: aarch64-apple-darwin
- os: macos-15-intel
platform: darwin-x64
target: x86_64-apple-darwin
- os: ubuntu-latest
platform: linux-x64
target: x86_64-unknown-linux-musl
- os: ubuntu-24.04-arm
platform: linux-arm64
target: aarch64-unknown-linux-musl
- os: windows-latest
platform: windows-x64
target: x86_64-pc-windows-msvc
- os: windows-11-arm
platform: windows-arm64
target: aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Configure Rust
shell: bash
env:
TARGET: ${{ matrix.target }}
run: |
rustup toolchain install 1.87 --profile minimal --target "$TARGET"
rustup override set 1.87
- name: Test backend
run: cargo test --locked --manifest-path backend/Cargo.toml
- name: Assemble plugin archive
shell: bash
env:
PLATFORM: ${{ matrix.platform }}
TAG: ${{ inputs.tag }}
run: |
args=(--platform "$PLATFORM")
if [[ -n "$TAG" ]]; then
args+=(--expect-tag "$TAG")
fi
node scripts/package.mjs "${args[@]}"
- name: Verify archive
run: node --test --test-timeout=60000 scripts/package/archives.test.mjs
- uses: actions/upload-artifact@v4
with:
name: python-support-archive-${{ matrix.platform }}
path: dist/python-support-*-${{ matrix.platform }}.zip
if-no-files-found: error
86 changes: 48 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,86 @@
name: Release

# Push a tag v<version> matching plugin.json to publish a GitHub Release.
# Lithe Store's tracker picks up stable releases and opens index pull requests.
# Tags listed in PRERELEASE_TAGS below are published as pre-releases, which the
# tracker skips until a compatible Lithe desktop release is out.
# Lithe Store automatically tracks stable releases of eligible plugins.
on:
push:
tags: ["v*"]

permissions:
contents: write
contents: read

jobs:
release:
check:
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 5
outputs:
exists: ${{ steps.release.outputs.exists }}
steps:
- name: Check whether release already exists
id: check
- name: Check whether the release already exists
id: release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "Release $GITHUB_REF_NAME already exists; skipping workflow build."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

package:
needs: check
if: needs.check.outputs.exists == 'false'
uses: ./.github/workflows/package.yml
with:
tag: ${{ github.ref_name }}

release:
needs: [check, package]
if: needs.check.outputs.exists == 'false'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v4
if: steps.check.outputs.exists != 'true'
- uses: actions/setup-node@v4
if: steps.check.outputs.exists != 'true'
with:
node-version: 22
- name: Build 6 platform archives
if: steps.check.outputs.exists != 'true'
run: |
set -o pipefail
node scripts/package.mjs --expect-tag "$GITHUB_REF_NAME" | tee "$RUNNER_TEMP/checksums.txt"
- name: Verify release archives
if: steps.check.outputs.exists != 'true'
- uses: actions/download-artifact@v4
with:
pattern: python-support-archive-*
merge-multiple: true
path: dist
- name: Verify the six release archives
env:
LITHE_EXPECT_ALL_ARCHIVES: "1"
run: node --test --test-timeout=60000 scripts/package/*.test.mjs
- name: Publish GitHub Release
if: steps.check.outputs.exists != 'true'
env:
GH_TOKEN: ${{ github.token }}
PRERELEASE_TAGS: v0.1.0 v0.1.1
# v1.0.0 requires a host that advertises toolchainProviders 0 and buildSystems 1.
PRERELEASE_TAGS: v0.1.0 v0.1.1 v1.0.0
run: |
prerelease=false
release_flags=()
installation='Lithe Store 会在收录后提供此版本。打开 设置 → 插件 → 插件市场,搜索 Python Support。'
for tag in $PRERELEASE_TAGS; do
if [[ "$tag" == "$GITHUB_REF_NAME" ]]; then prerelease=true; fi
if [[ "$tag" == "$GITHUB_REF_NAME" ]]; then
release_flags+=(--prerelease)
installation='下载对应平台的 ZIP。打开 设置 → 插件 → 从文件安装…,核对 SHA-256 后确认。'
break
fi
done
notes="docs/releases/$GITHUB_REF_NAME.md"
test -s "$notes"
{
echo "兼容性:按插件契约 v0(schemaVersion 0、pluginAPIVersion 0)构建,需要支持声明式插件契约 v0 与项目内工具环境(.venv)信任解析的新版 Lithe 桌面端(desktop-v* 预发布)。"
cat "$notes"
echo
if [[ -s "docs/releases/$GITHUB_REF_NAME.md" ]]; then
cat "docs/releases/$GITHUB_REF_NAME.md"
echo
fi
if [[ "$prerelease" == true ]]; then
echo "安装:预发布版本,Lithe Store 自动追踪会跳过。下载对应平台的 ZIP,在 设置 → 插件 中点击 从文件安装…,选中 ZIP 后核对 SHA-256 并确认。"
else
echo "安装:Lithe Store(https://github.com/Lithe-IDEA/Lithe-store)收录后,可在 设置 → 插件 → 插件市场 中搜索 Python Support 并安装。"
fi
echo "$installation"
echo
echo 'SHA-256'
echo
echo "SHA-256:"
echo '```'
sed 's#^dist/##' "$RUNNER_TEMP/checksums.txt"
(cd dist && sha256sum ./*.zip)
echo '```'
} > "$RUNNER_TEMP/notes.md"
release_flags=()
if [[ "$prerelease" == true ]]; then
release_flags+=(--prerelease)
fi
gh release create "$GITHUB_REF_NAME" dist/*.zip --title "Python Support $GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/notes.md" "${release_flags[@]}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
dist/
**/__pycache__/
*.py[cod]

/backend/target/
Loading
Loading