diff --git a/.github/workflows/build-vscode-main.yml b/.github/workflows/build-vscode-main.yml new file mode 100644 index 00000000..860c4ced --- /dev/null +++ b/.github/workflows/build-vscode-main.yml @@ -0,0 +1,181 @@ +name: tinymist::build::vscode::main +on: + workflow_call: + +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 + cache: 'yarn' + if: (fromJson(env.isRelease) || fromJson(env.isNightly)) + - name: Install deps + run: yarn install + 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: Download VSC Assets + uses: actions/download-artifact@v4 + with: + name: vscode-artifacts-tinymist + path: editors/vscode/out + if: (fromJson(env.isRelease) || fromJson(env.isNightly)) + - name: Download VSC Assets (L10n) + uses: actions/download-artifact@v4 + with: + name: vscode-artifacts-tinymist-l10n + path: editors/vscode + if: (fromJson(env.isRelease) || fromJson(env.isNightly)) + - name: Download VSC Assets (Preview) + uses: actions/download-artifact@v4 + with: + name: vscode-artifacts-typst-preview + path: contrib/typst-preview/editors/vscode/out + if: (fromJson(env.isRelease) || fromJson(env.isNightly)) + + - 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: 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: 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: 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 + + - 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 Tinymist Testing log + if: ${{ always() && ((fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isTest))}} + uses: actions/upload-artifact@v4 + with: + name: tinymist-lsp-tests.${{ env.target }}.log + path: editors/vscode/e2e-workspaces/simple-docs/tinymist-lsp.log + + # 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 diff --git a/.github/workflows/build-vscode.yml b/.github/workflows/build-vscode.yml index 1fa5096f..92c65329 100644 --- a/.github/workflows/build-vscode.yml +++ b/.github/workflows/build-vscode.yml @@ -1,182 +1,91 @@ - name: tinymist::build::vscode on: workflow_call: + secrets: + VSCODE_MARKETPLACE_TOKEN: + required: true + OPENVSX_ACCESS_TOKEN: + required: true + +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' }} + build-vsc-assets: + uses: ./.github/workflows/build-vsc-assets.yml + + build-vscode-main: + needs: [build-vsc-assets] + uses: ./.github/workflows/build-vscode-main.yml + + build-vscode-others: + needs: [build-vsc-assets] + uses: ./.github/workflows/build-vscode-others.yml + + release: + needs: [build-vscode-main, build-vscode-others] # , announce + runs-on: ubuntu-latest + if: success() && startsWith(github.ref, 'refs/tags/') + permissions: + contents: write 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)) + - uses: actions/download-artifact@v4 + with: + path: artifacts + pattern: '{tinymist,typst-preview}-*' + - 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: + needs: [build-vscode-main, build-vscode-others] # , announce + 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/checkout@v4 + with: + submodules: recursive + - uses: actions/download-artifact@v4 - name: Install Node.js uses: actions/setup-node@v4 with: node-version: 22 cache: 'yarn' - if: (fromJson(env.isRelease) || fromJson(env.isNightly)) - name: Install deps run: yarn install - 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: Download VSC Assets - uses: actions/download-artifact@v4 - with: - name: vscode-artifacts-tinymist - path: editors/vscode/out - if: (fromJson(env.isRelease) || fromJson(env.isNightly)) - - name: Download VSC Assets (L10n) - uses: actions/download-artifact@v4 - with: - name: vscode-artifacts-tinymist-l10n - path: editors/vscode - if: (fromJson(env.isRelease) || fromJson(env.isNightly)) - - name: Download VSC Assets (Preview) - uses: actions/download-artifact@v4 - with: - name: vscode-artifacts-typst-preview - path: contrib/typst-preview/editors/vscode/out - if: (fromJson(env.isRelease) || fromJson(env.isNightly)) - - - 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: Package typst-preview extension + - name: Deploy to VS Code Marketplace 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 + 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: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix - working-directory: ./editors/vscode - - name: Package typst-preview extension (Nightly) + 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: 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) + 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: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix --pre-release - working-directory: ./editors/vscode - - - 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: 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 - - - 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 Tinymist Testing log - if: ${{ always() && ((fromJson(env.isRelease) || fromJson(env.isNightly)) && fromJson(env.isTest))}} - uses: actions/upload-artifact@v4 - with: - name: tinymist-lsp-tests.${{ env.target }}.log - path: editors/vscode/e2e-workspaces/simple-docs/tinymist-lsp.log - - # 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 + run: npx ovsx publish --packagePath $(find . -type f -iname 'tinymist-*.vsix') --skip-duplicate --pre-release + env: + OVSX_PAT: ${{ secrets.OPENVSX_ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci-check-e2e.yml b/.github/workflows/ci-check-e2e.yml new file mode 100644 index 00000000..40eaf4b6 --- /dev/null +++ b/.github/workflows/ci-check-e2e.yml @@ -0,0 +1,59 @@ +name: tinymist::check-e2e +on: + workflow_call: + +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: + checks-e2e: + strategy: + matrix: + include: + - os: windows-2022 + 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20103846..3c297c8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,57 +101,6 @@ jobs: - name: Test tinymist run: cargo test --workspace -- --skip=e2e - checks-e2e: - needs: [build-binary] - strategy: - matrix: - include: - - os: windows-2022 - 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: @@ -170,33 +119,12 @@ jobs: # with: # tag: ${{ needs.prepare-build.outputs.tag }} - build-binary: + build: needs: [prepare-build] # , announce permissions: contents: write uses: ./.github/workflows/release.yml + secrets: inherit with: tag: ${{ (startsWith(github.ref, 'refs/tags/') && 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 - secrets: - VSCODE_MARKETPLACE_TOKEN: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} - OPENVSX_ACCESS_TOKEN: ${{ secrets.OPENVSX_ACCESS_TOKEN }} - \ No newline at end of file diff --git a/.github/workflows/publish-vscode.yml b/.github/workflows/publish-vscode.yml deleted file mode 100644 index 68abe6fb..00000000 --- a/.github/workflows/publish-vscode.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: tinymist::vscode::pubish -on: - workflow_call: - secrets: - VSCODE_MARKETPLACE_TOKEN: - required: true - OPENVSX_ACCESS_TOKEN: - required: true - -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 - pattern: '{tinymist,typst-preview}-*' - - 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/checkout@v4 - with: - submodules: recursive - - uses: actions/download-artifact@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'yarn' - - 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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e960d70..e53f9f9c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -236,14 +236,36 @@ jobs: path: | ${{ steps.cargo-dist.outputs.paths }} ${{ env.BUILD_MANIFEST_NAME }} + + custom-build-vscode: + needs: + - plan + - build-local-artifacts + uses: ./.github/workflows/build-vscode.yml + with: + plan: ${{ needs.plan.outputs.val }} + secrets: inherit + permissions: + "contents": "write" + + custom-ci-check-e2e: + needs: + - plan + - build-local-artifacts + uses: ./.github/workflows/ci-check-e2e.yml + with: + plan: ${{ needs.plan.outputs.val }} + secrets: inherit # Determines if we should publish/announce host: needs: - plan - build-local-artifacts - build-global-artifacts + - custom-build-vscode + - custom-ci-check-e2e # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine) - 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') }} + if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.custom-build-vscode.result == 'skipped' || needs.custom-build-vscode.result == 'success') && (needs.custom-ci-check-e2e.result == 'skipped' || needs.custom-ci-check-e2e.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: "ubuntu-22.04" diff --git a/dist-workspace.toml b/dist-workspace.toml index 697e94cc..90666127 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -62,6 +62,9 @@ install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"] # Whether to cache builds cache-builds = true +global-artifacts-jobs = ["./build-vscode", "./ci-check-e2e"] +github-custom-job-permissions = { "build-vscode" = { contents = "write" } } + [dist.min-glibc-version] # Override glibc version for specific target triplets. aarch64-unknown-linux-gnu = "2.28"