feat(ci): vscode extensions use binaries built by cargo-dist (#1560)

* build: rename filename of vscode workflow

* build: archive

* dev: permissions

* fix: cache name

* fix: ci file name

* edit

* edit2

* fix: release crates rule

* fix: announce permission

* fix: publish permission

* fix: errors

* fix: ???

* fix: cargo test

* chore: rename

* feat: upgrade ubuntu version

* feat: upgrade cargo-dist

* feat: upgrade cargo-dist

* feat: pr run with tag be `''`

* feat: upload

* feat: upgrade cargo-dist??

* feat: fix workflow

* fix: announce deps

* fix: permission

* fix: dir to download

* fix: unpack

* fix: unpack 2

* fix: list command

* fix: executable name

* fix: executable name 2

* fix: executable name 3

* fix: executable name 4

* fix: remove the macos e2e test challenge

* fix: prebuilt location

* fix: compile arguments
This commit is contained in:
Myriad-Dreamin 2025-03-27 04:20:58 +08:00 committed by GitHub
parent 41f8881e8e
commit c234e86070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 692 additions and 565 deletions

View file

@ -1,5 +1,11 @@
name: tinymist::announce
on:
workflow_call:
inputs:
tag:
description: Release Tag
required: true
type: string
workflow_dispatch:
inputs:
tag:
@ -14,7 +20,7 @@ env:
jobs:
build:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
steps:
- uses: actions/checkout@v4
with:
@ -23,12 +29,7 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.28.0-tinymist.2/cargo-dist-installer.sh | sh"
- name: Cache dist
uses: actions/upload-artifact@v4
with:
name: cargo-dist-cache
path: ~/.cargo/bin/dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.28.0-tinymist.8/cargo-dist-installer.sh | sh"
- name: Install parse changelog
uses: taiki-e/install-action@parse-changelog
- name: Install Node.js

View file

@ -0,0 +1,150 @@
name: tinymist::build::vscode::others
on:
workflow_call:
workflow_dispatch:
env:
RUSTFLAGS: '-Dwarnings'
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
build_alpine:
name: build extension (alpine-x64)
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
container:
image: rust:alpine
volumes:
- /usr/local/cargo/registry:/usr/local/cargo/registry
env:
target: alpine-x64
RUST_TARGET: x86_64-unknown-linux-musl
RUSTFLAGS: "-Dwarnings -C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
isRelease: ${{ (startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))) }}
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))))) }}
steps:
- name: Install dependencies
run: apk add --no-cache git clang lld musl-dev nodejs npm yarn binutils
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run rust-cache
uses: Swatinem/rust-cache@v2
- name: Install deps
run: yarn install
- name: Build typst-preview vscode extension
run: |
yarn
yarn run compile
working-directory: ./contrib/typst-preview/editors/vscode
- name: Build tinymist vscode extension
run: |
yarn
yarn run compile
working-directory: ./editors/vscode
- name: Build tinymist binary
run: |
cargo build --profile=gh-release -p tinymist --target $RUST_TARGET
- name: Split debug symbols
run: |
cd target/$RUST_TARGET/gh-release
objcopy --compress-debug-sections --only-keep-debug "tinymist" "tinymist-${{ env.target }}.debug"
objcopy --strip-debug --add-gnu-debuglink="tinymist-${{ env.target }}.debug" "tinymist"
- name: Upload split debug symbols
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.debug
path: target/${{ env.RUST_TARGET }}/gh-release/tinymist-${{ env.target }}.debug
- name: Copy binary to output directory
run: |
mkdir -p editors/vscode/out
cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "editors/vscode/out/"
cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "contrib/typst-preview/editors/vscode/out/"
cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "tinymist-${{ env.target }}"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}
path: tinymist-${{ env.target }}
- name: Package typst-preview extension
if: fromJson(env.isRelease)
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package extension
if: fromJson(env.isRelease)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
working-directory: ./editors/vscode
- name: Package typst-preview extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix --pre-release
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release
working-directory: ./editors/vscode
- name: Upload typst-preview VSIX artifact
uses: actions/upload-artifact@v4
with:
name: typst-preview-${{ env.target }}.vsix
path: contrib/typst-preview/editors/vscode/typst-preview-${{ env.target }}.vsix
- name: Upload tinymist VSIX artifact
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.vsix
path: editors/vscode/tinymist-${{ env.target }}.vsix
build_web:
name: build extension (web)
runs-on: ubuntu-latest
env:
target: web
RUST_TARGET: wasm32-unknown-unknown
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))))) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: "v0.13.1"
- name: Run rust-cache
uses: Swatinem/rust-cache@v2
- name: Install deps
run: yarn install
- name: Build tinymist vscode extension
run: |
yarn
yarn run compile:web
working-directory: ./editors/vscode
- name: Build tinymist library
run: yarn build
working-directory: ./crates/tinymist-core
- name: Pack tinymist npm library
run: |
npm pack > package-name
mv $(cat package-name) tinymist-${{ env.target }}.tar.gz
working-directory: ./crates/tinymist-core
- name: Upload tinymist npm library
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}-npm
path: crates/tinymist-core/tinymist-${{ env.target }}.tar.gz
- name: Package extension
if: '!fromJson(env.isNightly)'
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
working-directory: ./editors/vscode
- name: Package extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release
working-directory: ./editors/vscode
- name: Upload tinymist VSIX artifact
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.vsix
path: editors/vscode/tinymist-${{ env.target }}.vsix

228
.github/workflows/build-vscode.yml vendored Normal file
View file

@ -0,0 +1,228 @@
name: tinymist::build::vscode::others
on:
workflow_call:
workflow_dispatch:
env:
RUSTFLAGS: '-Dwarnings'
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
platform: win32
arch: x64
regular_build: 'true'
- os: windows-latest
rust-target: aarch64-pc-windows-msvc
platform: win32
arch: arm64
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-gnu
platform: linux
arch: x64
regular_build: 'true'
- os: ubuntu-22.04
rust-target: aarch64-unknown-linux-gnu
platform: linux
arch: arm64
- os: ubuntu-22.04
rust-target: arm-unknown-linux-gnueabihf
platform: linux
arch: armhf
- os: macos-13
rust-target: x86_64-apple-darwin
platform: darwin
arch: x64
- os: macos-13
rust-target: aarch64-apple-darwin
platform: darwin
arch: arm64
regular_build: 'true'
name: build (${{ matrix.platform }}-${{ matrix.arch }})
runs-on: ${{ matrix.os }}
env:
target: ${{ matrix.platform }}-${{ matrix.arch }}
isRelease: ${{ (startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))) }}
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8'))))) || (!startsWith(github.ref, 'refs/tags/') && matrix.regular_build == 'true')) }}
isTest: ${{ matrix.rust-target == 'x86_64-unknown-linux-gnu' || matrix.rust-target == 'x86_64-pc-windows-msvc' }}
isUniversal: ${{ matrix.rust-target == 'x86_64-unknown-linux-gnu' }}
steps:
- name: "Print Env"
run: |
echo "Running on ${{ matrix.os }}"
echo "Target: ${{ env.target }}"
echo "Is Release: ${{ fromJson(env.isRelease) }}"
echo "Is Nightly: ${{ fromJson(env.isNightly) }}"
echo "Is Test: ${{ fromJson(env.isTest) }}"
echo "Is Universal (No Server): ${{ fromJson(env.isUniversal) }}"
- uses: actions/checkout@v4
with:
submodules: recursive
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Install deps
run: yarn install
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build typst-preview vscode extension
run: |
yarn
yarn run compile
working-directory: ./contrib/typst-preview/editors/vscode
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build tinymist vscode extension
run: |
yarn
yarn run compile
working-directory: ./editors/vscode
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
# https://github.com/dtolnay/rust-toolchain/issues/133
# https://github.com/rust-lang/rustup/issues/3635
# Only needed if your action will run two or more rust
# commands concurrently, otherwise rustup will lazily
# install your rust-toolchain.toml when needed:
- name: 'Install from rust-toolchain.toml'
run: |
rustup show
rustup target add ${{ matrix.rust-target }}
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Install llvm
if: matrix.platform == 'linux' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
sudo apt-get update
sudo apt-get install llvm
- name: Install AArch64 target toolchain
if: matrix.rust-target == 'aarch64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install ARM target toolchain
if: matrix.rust-target == 'arm-unknown-linux-gnueabihf' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- name: Run rust-cache
uses: Swatinem/rust-cache@v2
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Download tinymist binary artifact
uses: actions/download-artifact@v4
with:
name: artifacts-build-local-${{ matrix.rust-target }}
path: prebuilts
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Unzip tinymist binary artifact (Windows)
run: 7z x -y -oprebuilts prebuilts/tinymist-${{ matrix.rust-target }}.zip
if: matrix.platform == 'win32' && (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Unzip tinymist binary artifact (Linux)
run: |
tar -xvf prebuilts/tinymist-${{ matrix.rust-target }}.tar.gz -C prebuilts
mv prebuilts/tinymist-${{ matrix.rust-target }}/tinymist prebuilts/tinymist
if: matrix.platform != 'win32' && (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: List files
run: ls -l prebuilts
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
# todo: pdf documentation for all platforms
- name: Download font assets
# use fonts in stable releases
run: |
mkdir -p assets/fonts/
curl -L https://github.com/Myriad-Dreamin/shiroa/releases/download/v0.1.2/font-assets.tar.gz | tar -xvz -C assets/fonts
curl -L https://github.com/Myriad-Dreamin/shiroa/releases/download/v0.1.0/charter-font-assets.tar.gz | tar -xvz -C assets/fonts
curl -L https://github.com/Myriad-Dreamin/shiroa/releases/download/v0.1.5/source-han-serif-font-assets.tar.gz | tar -xvz -C assets/fonts
if: matrix.rust-target == 'x86_64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build PDF Documentation
run: |
prebuilts/tinymist${{ ( matrix.platform == 'win32' ) && '.exe' || '' }} compile --font-path assets/fonts --root . docs/tinymist/ebook.typ
cp docs/tinymist/ebook.pdf tinymist-docs.pdf
mkdir -p contrib/html/editors/vscode/out/ editors/vscode/out/
cp tinymist-docs.pdf editors/vscode/out/tinymist-docs.pdf
cp tinymist-docs.pdf contrib/html/editors/vscode/out/tinymist-docs.pdf
if: matrix.rust-target == 'x86_64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Upload PDF Documentation
if: matrix.rust-target == 'x86_64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-docs.pdf
path: tinymist-docs.pdf
- name: Copy binary to output directory
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
cp "prebuilts/tinymist${{ ( matrix.platform == 'win32' ) && '.exe' || '' }}" "editors/vscode/out/"
cp "prebuilts/tinymist${{ ( matrix.platform == 'win32' ) && '.exe' || '' }}" "contrib/typst-preview/editors/vscode/out/"
cp "prebuilts/tinymist${{ ( matrix.platform == 'win32' ) && '.exe' || '' }}" "tinymist-${{ env.target }}${{ ( matrix.platform == 'win32' ) && '.exe' || '' }}"
- name: Upload binary artifact
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}
path: tinymist-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}
- name: Package typst-preview extension
if: fromJson(env.isRelease)
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package tinymist extension
if: fromJson(env.isRelease)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
working-directory: ./editors/vscode
- name: Package typst-preview extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix --pre-release
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package tinymist extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release
working-directory: ./editors/vscode
- name: Test tinymist extension
uses: coactions/setup-xvfb@v1
with:
run: yarn test
working-directory: ./editors/vscode
if: (fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isTest)
- name: Upload typst-preview VSIX artifact
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: typst-preview-${{ env.target }}.vsix
path: contrib/typst-preview/editors/vscode/typst-preview-${{ env.target }}.vsix
- name: Upload VSIX artifact
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.vsix
path: editors/vscode/tinymist-${{ env.target }}.vsix
# The universal target doesn't bundle the binary. Users of that must install
# tinymist by themselves.
- name: Remove server binary
if: fromJson(env.isUniversal)
run: rm "editors/vscode/out/tinymist"
- name: Package extension (Universal)
if: fromJson(env.isRelease) && fromJson(env.isUniversal)
run: yarn run package -- -o tinymist-universal.vsix
working-directory: ./editors/vscode
- name: Package extension (Universal, Nightly)
if: fromJson(env.isNightly) && fromJson(env.isUniversal)
run: yarn run package -- -o tinymist-universal.vsix --pre-release
working-directory: ./editors/vscode
- name: Upload tinymist VSIX artifact (Universal)
if: (fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isUniversal)
uses: actions/upload-artifact@v4
with:
name: tinymist-universal.vsix
path: editors/vscode/tinymist-universal.vsix
- name: Upload Tinymist Testing log
if: always()
uses: actions/upload-artifact@v4
with:
name: tinymist-lsp-tests.${{ env.target }}.log
path: editors/vscode/e2e-workspaces/simple-docs/tinymist-lsp.log

187
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,187 @@
name: tinymist::ci
on:
push:
branches:
- main
- 'nightly/*'
tags:
- "*"
pull_request:
types: [opened, synchronize]
branches:
- main
- 'nightly/*'
workflow_dispatch:
env:
RUSTFLAGS: '-Dwarnings'
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
pre_build:
permissions:
actions: write
contents: read
name: Duplicate Actions Detection
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: "true"
checks-linux:
name: Check Clippy, Formatting, Completion, Documentation, and Tests (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://github.com/dtolnay/rust-toolchain/issues/133
# https://github.com/rust-lang/rustup/issues/3635
# Only needed if your action will run two or more rust
# commands concurrently, otherwise rustup will lazily
# install your rust-toolchain.toml when needed:
- name: 'Install from rust-toolchain.toml'
run: rustup show
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install deps
run: yarn install
- uses: Swatinem/rust-cache@v2
- name: Check and build assets
run: |
yarn build:preview
yarn build:l10n
- run: cargo clippy --workspace --all-targets
- run: scripts/feature-testing.sh
- run: cargo fmt --check --all
- run: cargo doc --workspace --no-deps
- name: Generate completions
run: |
mkdir -p completions/{zsh,bash,fish/vendor_completions.d,elvish/lib,nushell/vendor/autoload,powershell}/
cargo run -p tinymist -- completion zsh > completions/zsh/_tinymist
cargo run -p tinymist -- completion bash > completions/bash/tinymist
cargo run -p tinymist -- completion fish > completions/fish/vendor_completions.d/tinymist.fish
cargo run -p tinymist -- completion elvish > completions/elvish/lib/tinymist.elv
cargo run -p tinymist -- completion nushell > completions/nushell/vendor/autoload/tinymist.nu
cargo run -p tinymist -- completion powershell > completions/powershell/tinymist.ps1
- name: upload completions
uses: actions/upload-artifact@v4
with:
name: tinymist-completion-scripts
path: completions
- name: Test tinymist
run: cargo test --workspace -- --skip=e2e
checks-windows:
name: Check Minimum Rust version and Tests (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install deps
run: yarn install
- name: Check Rust Version
run: yarn check-msrv
- uses: dtolnay/rust-toolchain@1.83.0 # check-min-version
- uses: Swatinem/rust-cache@v2
- name: Check and build assets
run: |
yarn build:preview
yarn build:l10n
- run: cargo check --workspace
- name: Test tinymist
run: cargo test --workspace -- --skip=e2e
checks-e2e:
needs: [build-binary]
strategy:
matrix:
include:
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
platform: win32
arch: x64
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-gnu
platform: linux
arch: x64
# - os: macos-13
# rust-target: aarch64-apple-darwin
# platform: darwin
# arch: arm64
name: E2E Tests (${{ matrix.platform }}-${{ matrix.arch }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Download tinymist binary artifact
uses: actions/download-artifact@v4
with:
name: artifacts-build-local-${{ matrix.rust-target }}
path: editors/vscode/out
- name: Unzip tinymist binary artifact (Windows)
run: 7z x -y -oeditors/vscode/out editors/vscode/out/tinymist-${{ matrix.rust-target }}.zip
if: matrix.platform == 'win32'
- name: Unzip tinymist binary artifact (Linux)
run: |
tar -xvf editors/vscode/out/tinymist-${{ matrix.rust-target }}.tar.gz -C editors/vscode/out
mv editors/vscode/out/tinymist-${{ matrix.rust-target }}/tinymist editors/vscode/out/tinymist
if: matrix.platform != 'win32'
- name: List files
run: ls -l editors/vscode/out
- name: Test Tinymist (E2E)
run: cargo test -p tests -- e2e
- name: Upload Tinymist E2E Test Snapshot
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-snapshot-${{ matrix.platform }}-${{ matrix.arch }}
path: target/e2e
prepare-build:
runs-on: "ubuntu-latest"
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- id: tag # get the tag after the `refs/tags/` prefix
run:
echo "tag=${{ github.ref }}" | sed 's/refs\/tags\///' >> "$GITHUB_OUTPUT"
# announce:
# needs: [prepare-build]
# permissions:
# contents: write
# uses: ./.github/workflows/announce.yml
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
# with:
# tag: ${{ fromJson(needs.prepare-build.outputs.tag) }}
build-binary:
needs: [prepare-build] # , announce
permissions:
contents: write
uses: ./.github/workflows/release.yml
with:
tag: ${{ (startsWith(github.ref, 'refs/tags/') && fromJson(needs.prepare-build.outputs.tag)) || '' }}
targets: ${{ (!startsWith(github.ref, 'refs/tags/') && 'aarch64-apple-darwin,x86_64-pc-windows-msvc,x86_64-unknown-linux-gnu') || 'all' }}
build-vscode:
needs: [build-binary]
uses: ./.github/workflows/build-vscode.yml
build-vscode-others:
uses: ./.github/workflows/build-vscode-others.yml
publish-vscode:
needs: [build-vscode, build-vscode-others] # , announce
permissions:
contents: write
uses: ./.github/workflows/publish-vscode.yml

69
.github/workflows/publish-vscode.yml vendored Normal file
View file

@ -0,0 +1,69 @@
name: tinymist::vscode::pubish
on:
workflow_call:
workflow_dispatch:
env:
RUSTFLAGS: '-Dwarnings'
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
release:
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "artifacts/*/*"
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
publish:
runs-on: ubuntu-latest
env:
isRelease: ${{ (startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))) }}
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))))) }}
if: success() && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'rc')
steps:
- uses: actions/download-artifact@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install deps
run: yarn install
- name: Deploy to VS Code Marketplace
if: fromJson(env.isRelease)
run: npx @vscode/vsce publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
- name: Deploy to OpenVSX
if: fromJson(env.isRelease)
run: npx ovsx publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate
env:
OVSX_PAT: ${{ secrets.OPENVSX_ACCESS_TOKEN }}
- name: Deploy to VS Code Marketplace (Nightly)
if: fromJson(env.isNightly)
run: npx @vscode/vsce publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate --pre-release
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
- name: Deploy to OpenVSX (Nightly)
if: fromJson(env.isNightly)
run: npx ovsx publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate --pre-release
env:
OVSX_PAT: ${{ secrets.OPENVSX_ACCESS_TOKEN }}

View file

@ -9,7 +9,7 @@ jobs:
publish-crates:
name: build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
steps:

View file

@ -1,5 +1,8 @@
name: tinymist::crates::publish
on:
push:
tags:
- "*"
workflow_dispatch:
env:

View file

@ -1,548 +0,0 @@
# stolen from https://github.com/nvarner/tinymist/blob/master/.github/workflows/release.yml
name: tinymist::ci
on:
push:
branches:
- main
- 'nightly/*'
tags:
- "*"
pull_request:
types: [opened, synchronize]
branches:
- main
- 'nightly/*'
workflow_dispatch:
env:
RUSTFLAGS: '-Dwarnings'
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
jobs:
pre_build:
permissions:
actions: write
contents: read
name: Duplicate Actions Detection
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: "true"
checks:
name: Check clippy, formatting, completion, and documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://github.com/dtolnay/rust-toolchain/issues/133
# https://github.com/rust-lang/rustup/issues/3635
# Only needed if your action will run two or more rust
# commands concurrently, otherwise rustup will lazily
# install your rust-toolchain.toml when needed:
- name: 'Install from rust-toolchain.toml'
run: rustup show
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install deps
run: yarn install
- uses: Swatinem/rust-cache@v2
- name: Check and build assets
run: |
yarn build:preview
yarn build:l10n
- run: cargo clippy --workspace --all-targets
- run: scripts/feature-testing.sh
- run: cargo fmt --check --all
- run: cargo doc --workspace --no-deps
- name: Generate completions
run: |
mkdir -p completions/{zsh,bash,fish/vendor_completions.d,elvish/lib,nushell/vendor/autoload,powershell}/
cargo run -p tinymist -- completion zsh > completions/zsh/_tinymist
cargo run -p tinymist -- completion bash > completions/bash/tinymist
cargo run -p tinymist -- completion fish > completions/fish/vendor_completions.d/tinymist.fish
cargo run -p tinymist -- completion elvish > completions/elvish/lib/tinymist.elv
cargo run -p tinymist -- completion nushell > completions/nushell/vendor/autoload/tinymist.nu
cargo run -p tinymist -- completion powershell > completions/powershell/tinymist.ps1
- name: upload completions
uses: actions/upload-artifact@v4
with:
name: tinymist-completion-scripts
path: completions
min-version:
name: Check Minimum Rust version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Check Rust Version
run: yarn check-msrv
- uses: dtolnay/rust-toolchain@1.83.0 # check-min-version
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace
build:
strategy:
matrix:
include:
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
platform: win32
arch: x64
regular_build: 'true'
- os: windows-latest
rust-target: aarch64-pc-windows-msvc
platform: win32
arch: arm64
- os: ubuntu-20.04
rust-target: x86_64-unknown-linux-gnu
platform: linux
arch: x64
regular_build: 'true'
- os: ubuntu-20.04
rust-target: aarch64-unknown-linux-gnu
platform: linux
arch: arm64
- os: ubuntu-20.04
rust-target: arm-unknown-linux-gnueabihf
platform: linux
arch: armhf
- os: macos-13
rust-target: x86_64-apple-darwin
platform: darwin
arch: x64
- os: macos-13
rust-target: aarch64-apple-darwin
platform: darwin
arch: arm64
regular_build: 'true'
name: build (${{ matrix.platform }}-${{ matrix.arch }})
runs-on: ${{ matrix.os }}
env:
target: ${{ matrix.platform }}-${{ matrix.arch }}
isRelease: ${{ (startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))) }}
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8'))))) || (!startsWith(github.ref, 'refs/tags/') && matrix.regular_build == 'true')) }}
isTest: ${{ matrix.rust-target == 'x86_64-unknown-linux-gnu' || matrix.rust-target == 'x86_64-pc-windows-msvc' }}
isUniversal: ${{ matrix.rust-target == 'x86_64-unknown-linux-gnu' }}
steps:
- name: "Print Env"
run: |
echo "Running on ${{ matrix.os }}"
echo "Target: ${{ env.target }}"
echo "Is Release: ${{ fromJson(env.isRelease) }}"
echo "Is Nightly: ${{ fromJson(env.isNightly) }}"
echo "Is Test: ${{ fromJson(env.isTest) }}"
echo "Is Universal (No Server): ${{ fromJson(env.isUniversal) }}"
- uses: actions/checkout@v4
with:
submodules: recursive
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Install deps
run: yarn install
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build typst-preview vscode extension
run: |
yarn
yarn run compile
working-directory: ./contrib/typst-preview/editors/vscode
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build tinymist vscode extension
run: |
yarn
yarn run compile
working-directory: ./editors/vscode
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
# https://github.com/dtolnay/rust-toolchain/issues/133
# https://github.com/rust-lang/rustup/issues/3635
# Only needed if your action will run two or more rust
# commands concurrently, otherwise rustup will lazily
# install your rust-toolchain.toml when needed:
- name: 'Install from rust-toolchain.toml'
run: |
rustup show
rustup target add ${{ matrix.rust-target }}
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Install llvm
if: matrix.platform == 'linux' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
sudo apt-get update
sudo apt-get install llvm
- name: Install AArch64 target toolchain
if: matrix.rust-target == 'aarch64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install ARM target toolchain
if: matrix.rust-target == 'arm-unknown-linux-gnueabihf' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- name: Run rust-cache
uses: Swatinem/rust-cache@v2
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build tinymist binary
shell: pwsh
run: |
cargo build --profile=gh-release -p tinymist --target ${{ matrix.rust-target }}
if: startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true'
# todo: pdf documentation for all platforms
- name: Download font assets
# use fonts in stable releases
run: |
mkdir -p assets/fonts/
curl -L https://github.com/Myriad-Dreamin/shiroa/releases/download/v0.1.2/font-assets.tar.gz | tar -xvz -C assets/fonts
curl -L https://github.com/Myriad-Dreamin/shiroa/releases/download/v0.1.0/charter-font-assets.tar.gz | tar -xvz -C assets/fonts
curl -L https://github.com/Myriad-Dreamin/shiroa/releases/download/v0.1.5/source-han-serif-font-assets.tar.gz | tar -xvz -C assets/fonts
if: matrix.rust-target == 'x86_64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Build PDF Documentation
run: |
cargo run --profile=gh-release -p tinymist --target ${{ matrix.rust-target }} -- compile --font-path assets/fonts --root . docs/tinymist/ebook.typ
cp docs/tinymist/ebook.pdf tinymist-docs.pdf
mkdir -p contrib/html/editors/vscode/out/ editors/vscode/out/
cp tinymist-docs.pdf editors/vscode/out/tinymist-docs.pdf
cp tinymist-docs.pdf contrib/html/editors/vscode/out/tinymist-docs.pdf
if: matrix.rust-target == 'x86_64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
- name: Upload PDF Documentation
if: matrix.rust-target == 'x86_64-unknown-linux-gnu' && (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-docs.pdf
path: tinymist-docs.pdf
- name: Rename debug symbols for windows
if: matrix.platform == 'win32' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
cd target/${{ matrix.rust-target }}/gh-release
cp tinymist.pdb tinymist-${{ env.target }}.pdb
- name: Split debug symbols for linux
if: matrix.platform == 'linux' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
cd target/${{ matrix.rust-target }}/gh-release
llvm-objcopy --compress-debug-sections --only-keep-debug "tinymist" "tinymist-${{ env.target }}.debug"
llvm-objcopy --strip-debug --add-gnu-debuglink="tinymist-${{ env.target }}.debug" "tinymist"
- name: Collect debug symbols for mac
if: matrix.platform == 'darwin' && (fromJson(env.isRelease) || fromJson(env.isNightly))
run: |
dsymutil -f "target/${{ matrix.rust-target }}/gh-release/tinymist"
mv "target/${{ matrix.rust-target }}/gh-release/tinymist.dwarf" "target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.dwarf"
- name: Copy binary to output directory
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
shell: pwsh
run: |
cp "target/${{ matrix.rust-target }}/gh-release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "editors/vscode/out/"
cp "target/${{ matrix.rust-target }}/gh-release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "contrib/typst-preview/editors/vscode/out/"
cp "target/${{ matrix.rust-target }}/gh-release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "tinymist-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )"
- name: Test tinymist
run: |
cargo test --profile=gh-release --workspace --target ${{ matrix.rust-target }}
if: (fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isTest)
- name: Upload split debug symbols for windows
if: matrix.platform == 'win32' && (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.pdb
path: target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.pdb
- name: Upload split debug symbols for linux
if: matrix.platform == 'linux' && (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.debug
path: target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.debug
compression-level: 0
- name: Upload split debug symbols for mac
if: matrix.platform == 'darwin' && (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.dwarf
path: target/${{ matrix.rust-target }}/gh-release/tinymist-${{ env.target }}.dwarf
- name: Upload binary artifact
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}
path: tinymist-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}
- name: Package typst-preview extension
if: fromJson(env.isRelease)
shell: pwsh
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package tinymist extension
if: fromJson(env.isRelease)
shell: pwsh
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
working-directory: ./editors/vscode
- name: Package typst-preview extension (Nightly)
if: fromJson(env.isNightly)
shell: pwsh
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix --pre-release
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package tinymist extension (Nightly)
if: fromJson(env.isNightly)
shell: pwsh
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release
working-directory: ./editors/vscode
- name: Test tinymist extension
uses: coactions/setup-xvfb@v1
with:
run: yarn test
working-directory: ./editors/vscode
if: (fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isTest)
- name: Upload typst-preview VSIX artifact
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: typst-preview-${{ env.target }}.vsix
path: contrib/typst-preview/editors/vscode/typst-preview-${{ env.target }}.vsix
- name: Upload VSIX artifact
if: (fromJson(env.isRelease) || fromJson(env.isNightly))
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.vsix
path: editors/vscode/tinymist-${{ env.target }}.vsix
# The universal target doesn't bundle the binary. Users of that must install
# tinymist by themselves.
- name: Remove server binary
if: fromJson(env.isUniversal)
run: rm "editors/vscode/out/tinymist"
- name: Package extension (Universal)
if: fromJson(env.isRelease) && fromJson(env.isUniversal)
run: yarn run package -- -o tinymist-universal.vsix
working-directory: ./editors/vscode
- name: Package extension (Universal, Nightly)
if: fromJson(env.isNightly) && fromJson(env.isUniversal)
run: yarn run package -- -o tinymist-universal.vsix --pre-release
working-directory: ./editors/vscode
- name: Upload tinymist VSIX artifact (Universal)
if: (fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isUniversal)
uses: actions/upload-artifact@v4
with:
name: tinymist-universal.vsix
path: editors/vscode/tinymist-universal.vsix
- name: Upload Tinymist E2E Test Snapshot
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-snapshot-${{ env.target }}
path: target/e2e
- name: Upload Tinymist Testing log
if: always()
uses: actions/upload-artifact@v4
with:
name: tinymist-lsp-tests.${{ env.target }}.log
path: editors/vscode/e2e-workspaces/simple-docs/tinymist-lsp.log
build_alpine:
name: build (alpine-x64)
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
container:
image: rust:alpine
volumes:
- /usr/local/cargo/registry:/usr/local/cargo/registry
env:
target: alpine-x64
RUST_TARGET: x86_64-unknown-linux-musl
RUSTFLAGS: "-Dwarnings -C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
isRelease: ${{ (startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))) }}
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8'))))) || (!startsWith(github.ref, 'refs/tags/') && matrix.regular_build == 'true')) }}
steps:
- name: Install dependencies
run: apk add --no-cache git clang lld musl-dev nodejs npm yarn binutils
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run rust-cache
uses: Swatinem/rust-cache@v2
- name: Install deps
run: yarn install
- name: Build typst-preview vscode extension
run: |
yarn
yarn run compile
working-directory: ./contrib/typst-preview/editors/vscode
- name: Build tinymist vscode extension
run: |
yarn
yarn run compile
working-directory: ./editors/vscode
- name: Build tinymist binary
run: |
cargo build --profile=gh-release -p tinymist --target $RUST_TARGET
- name: Split debug symbols
run: |
cd target/$RUST_TARGET/gh-release
objcopy --compress-debug-sections --only-keep-debug "tinymist" "tinymist-${{ env.target }}.debug"
objcopy --strip-debug --add-gnu-debuglink="tinymist-${{ env.target }}.debug" "tinymist"
- name: Upload split debug symbols
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.debug
path: target/${{ env.RUST_TARGET }}/gh-release/tinymist-${{ env.target }}.debug
- name: Copy binary to output directory
run: |
mkdir -p editors/vscode/out
cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "editors/vscode/out/"
cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "contrib/typst-preview/editors/vscode/out/"
cp "target/${{ env.RUST_TARGET }}/gh-release/tinymist" "tinymist-${{ env.target }}"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}
path: tinymist-${{ env.target }}
- name: Package typst-preview extension
if: fromJson(env.isRelease)
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package extension
if: fromJson(env.isRelease)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
working-directory: ./editors/vscode
- name: Package typst-preview extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix --pre-release
working-directory: ./contrib/typst-preview/editors/vscode
- name: Package extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release
working-directory: ./editors/vscode
- name: Upload typst-preview VSIX artifact
uses: actions/upload-artifact@v4
with:
name: typst-preview-${{ env.target }}.vsix
path: contrib/typst-preview/editors/vscode/typst-preview-${{ env.target }}.vsix
- name: Upload tinymist VSIX artifact
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.vsix
path: editors/vscode/tinymist-${{ env.target }}.vsix
build_web:
name: build (web)
runs-on: ubuntu-latest
env:
target: web
RUST_TARGET: wasm32-unknown-unknown
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8'))))) || (!startsWith(github.ref, 'refs/tags/') && matrix.regular_build == 'true')) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: "v0.13.1"
- name: Run rust-cache
uses: Swatinem/rust-cache@v2
- name: Install deps
run: yarn install
- name: Build tinymist vscode extension
run: |
yarn
yarn run compile:web
working-directory: ./editors/vscode
- name: Build tinymist library
run: yarn build
working-directory: ./crates/tinymist-core
- name: Pack tinymist npm library
run: |
npm pack > package-name
mv $(cat package-name) tinymist-${{ env.target }}.tar.gz
working-directory: ./crates/tinymist-core
- name: Upload tinymist npm library
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}-npm
path: crates/tinymist-core/tinymist-${{ env.target }}.tar.gz
- name: Package extension
if: '!fromJson(env.isNightly)'
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix
working-directory: ./editors/vscode
- name: Package extension (Nightly)
if: fromJson(env.isNightly)
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release
working-directory: ./editors/vscode
- name: Upload tinymist VSIX artifact
uses: actions/upload-artifact@v4
with:
name: tinymist-${{ env.target }}.vsix
path: editors/vscode/tinymist-${{ env.target }}.vsix
release:
runs-on: ubuntu-latest
needs: [build, build_alpine]
if: success() && startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "artifacts/*/*"
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
publish:
runs-on: ubuntu-latest
needs: [build]
env:
isRelease: ${{ (startsWith(github.ref, 'refs/tags/') && (!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8')))) }}
isNightly: ${{ ((startsWith(github.ref, 'refs/tags/') && !((!contains(github.ref, 'rc') && (endsWith(github.ref, '0') || endsWith(github.ref, '2') || endsWith(github.ref, '4') || endsWith(github.ref, '6') || endsWith(github.ref, '8'))))) || (!startsWith(github.ref, 'refs/tags/') && matrix.regular_build == 'true')) }}
if: success() && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'rc')
steps:
- uses: actions/download-artifact@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install deps
run: yarn install
- name: Deploy to VS Code Marketplace
if: fromJson(env.isRelease)
run: npx @vscode/vsce publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
- name: Deploy to OpenVSX
if: fromJson(env.isRelease)
run: npx ovsx publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate
env:
OVSX_PAT: ${{ secrets.OPENVSX_ACCESS_TOKEN }}
- name: Deploy to VS Code Marketplace (Nightly)
if: fromJson(env.isNightly)
run: npx @vscode/vsce publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate --pre-release
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
- name: Deploy to OpenVSX (Nightly)
if: fromJson(env.isNightly)
run: npx ovsx publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate --pre-release
env:
OVSX_PAT: ${{ secrets.OPENVSX_ACCESS_TOKEN }}

View file

@ -39,6 +39,18 @@ permissions:
# If there's a prerelease-style suffix to the version, then the release(s)
# will be marked as a prerelease.
on:
workflow_call:
inputs:
tag:
description: Release Tag
required: true
default: dry-run
type: string
targets:
description: Targets to build
required: true
default: all
type: string
workflow_dispatch:
inputs:
tag:
@ -46,11 +58,16 @@ on:
required: true
default: dry-run
type: string
targets:
description: Targets to build
required: true
default: all
type: string
jobs:
# Run 'dist plan' (or host) to determine what tasks we need to do
plan:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
outputs:
val: ${{ steps.plan.outputs.manifest }}
tag: ${{ (inputs.tag != 'dry-run' && inputs.tag) || '' }}
@ -66,7 +83,7 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.28.0-tinymist.2/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.28.0-tinymist.8/cargo-dist-installer.sh | sh"
- name: Cache dist
uses: actions/upload-artifact@v4
with:
@ -95,7 +112,7 @@ jobs:
# Let the initial task tell us to not run (currently very blunt)
needs:
- plan
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') || inputs.tag == 'dry-run' }}
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || (fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') || (inputs.targets == 'all' || contains(inputs.targets, join(fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.targets, '')))) || inputs.tag == 'dry-run' }}
strategy:
fail-fast: false
# Target platforms/runners are computed by dist in create-release.
@ -128,6 +145,10 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- uses: swatinem/rust-cache@v2
with:
key: ${{ join(matrix.targets, '-') }}
cache-provider: ${{ matrix.cache_provider }}
- name: Install dist
run: ${{ matrix.install_dist.run }}
# Get the dist-manifest
@ -171,7 +192,7 @@ jobs:
needs:
- plan
- build-local-artifacts
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
@ -221,7 +242,7 @@ jobs:
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
outputs:
val: ${{ steps.host.outputs.manifest }}
steps:
@ -283,7 +304,7 @@ jobs:
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' }}
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:

View file

@ -4,9 +4,9 @@ members = ["cargo:."]
# Config for 'dist'
[dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.28.0-tinymist.2"
cargo-dist-version = "0.28.0-tinymist.8"
# A URL to use to install `cargo-dist` (with the installer script)
cargo-dist-url-override = "https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.28.0-tinymist.2"
cargo-dist-url-override = "https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.28.0-tinymist.8"
# CI backends to support
ci = "github"
# The installers to generate for each app
@ -17,6 +17,7 @@ windows-archive = ".zip"
unix-archive = ".tar.gz"
# Target platforms to build apps for (Rust target-triple syntax)
# These targets are determined based on the awesome ruff project...
# region: targets
targets = [
"aarch64-apple-darwin",
"aarch64-pc-windows-msvc",
@ -39,6 +40,7 @@ targets = [
"loongarch64-unknown-linux-gnu",
"loongarch64-unknown-linux-musl",
]
# region end: targets
# Whether to auto-include files like READMEs, LICENSEs, and CHANGELOGs (default true)
auto-includes = false
# Whether dist should create a Github Release or use an existing draft
@ -51,6 +53,20 @@ dispatch-releases = true
install-updater = false
# Path that installers should place binaries in
install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"]
# Whether to cache builds
cache-builds = true
[dist.github-custom-runners]
global = "ubuntu-22.04"
aarch64-pc-windows-msvc = "windows-latest"
aarch64-unknown-linux-gnu = "ubuntu-22.04"
aarch64-unknown-linux-musl = "ubuntu-22.04"
arm-unknown-linux-musleabihf = "ubuntu-22.04"
armv7-unknown-linux-gnueabihf = "ubuntu-22.04"
armv7-unknown-linux-musleabihf = "ubuntu-22.04"
x86_64-unknown-linux-gnu = "ubuntu-22.04"
x86_64-unknown-linux-musl = "ubuntu-22.04"
# riscv64gc-unknown-linux-gnu = "ubuntu-22.04"
riscv64gc-unknown-linux-musl = "ubuntu-22.04"
loongarch64-unknown-linux-gnu = "ubuntu-22.04"
loongarch64-unknown-linux-musl = "ubuntu-22.04"

View file

@ -1,6 +1,6 @@
import fs from "fs";
const ciFile = fs.readFileSync(".github/workflows/release-vscode.yml", "utf-8");
const ciFile = fs.readFileSync(".github/workflows/ci.yml", "utf-8");
const toolchainRe = (forWhat) =>
new RegExp(/dtolnay\/rust-toolchain@(\d+\.\d+\.\d+)/.source + `\\s*#\\s*${forWhat}`);