mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-12-23 08:47:50 +00:00
199 lines
No EOL
6.6 KiB
YAML
199 lines
No EOL
6.6 KiB
YAML
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
|
|
cache: 'yarn'
|
|
- 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-2019
|
|
rust-target: x86_64-pc-windows-msvc
|
|
platform: win32
|
|
arch: x64
|
|
- 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: ubuntu-latest
|
|
rust-target: x86_64-unknown-linux-gnu
|
|
platform: linux
|
|
arch: x64
|
|
- os: macos-latest
|
|
rust-target: aarch64-apple-darwin
|
|
platform: darwin
|
|
arch: arm64
|
|
name: E2E Tests (${{ matrix.platform }}-${{ matrix.arch }} on ${{ matrix.os }})
|
|
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: 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.rust-target }}-${{ matrix.os }}
|
|
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-vsc-assets:
|
|
needs: [build-binary]
|
|
uses: ./.github/workflows/build-vsc-assets.yml
|
|
|
|
build-vscode:
|
|
needs: [build-binary, build-vsc-assets]
|
|
uses: ./.github/workflows/build-vscode.yml
|
|
|
|
build-vscode-others:
|
|
needs: [build-vsc-assets]
|
|
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
|
|
|