Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

refactor: open in browser in vscode so it works for remote #250

refactor: open in browser in vscode so it works for remote

refactor: open in browser in vscode so it works for remote #250

Workflow file for this run

# stolen from https://github.com/nvarner/typst-lsp/blob/master/.github/workflows/release.yml
name: CI
on:
push:
pull_request:
workflow_dispatch:
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
platform: win32
arch: x64
- os: windows-latest
rust-target: i686-pc-windows-msvc
platform: win32
arch: ia32
- 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
- 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-11
rust-target: x86_64-apple-darwin
platform: darwin
arch: x64
- os: macos-11
rust-target: aarch64-apple-darwin
platform: darwin
arch: arm64
name: build (${{ matrix.platform }}-${{ matrix.arch }})
runs-on: ${{ matrix.os }}
env:
target: ${{ matrix.platform }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn
working-directory: ./addons/frontend
- run: |
yarn
yarn run compile
working-directory: ./addons/vscode
- name: rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target }}
- name: Install AArch64 target toolchain
if: matrix.rust-target == 'aarch64-unknown-linux-gnu'
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'
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- shell: pwsh
run: |
cargo build --release -p typst-preview --target ${{ matrix.rust-target }}
cp "target/${{ matrix.rust-target }}/release/typst-preview$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "addons/vscode/out/"
cp "target/${{ matrix.rust-target }}/release/typst-preview$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "typst-preview-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )"
- shell: pwsh
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
working-directory: ./addons/vscode
- uses: actions/upload-artifact@v2
with:
name: typst-preview-${{ env.target }}.vsix
path: addons/vscode/typst-preview-${{ env.target }}.vsix
- uses: actions/upload-artifact@v2
with:
name: typst-preview-${{ env.target }}
path: typst-preview-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}
build_alpine:
name: build (x86_64-unknown-linux-musl)
runs-on: ubuntu-latest
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: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
steps:
- name: Install dependencies
run: apk add --no-cache git clang lld musl-dev nodejs npm yarn
- name: Checkout repository
uses: actions/checkout@v3
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- run: yarn
working-directory: ./addons/frontend
- run: |
yarn
yarn run compile
working-directory: ./addons/vscode
- name: build server binary
run: |
cargo build --release -p typst-preview --target $RUST_TARGET
mkdir -p addons/vscode/out
cp "target/$RUST_TARGET/release/typst-preview" "addons/vscode/out/"
cp "target/$RUST_TARGET/release/typst-preview" "typst-preview-alpine-x64"
- name: package extension
run: yarn run package -- --target ${{ env.target }} -o typst-preview-${{ env.target }}.vsix
working-directory: ./addons/vscode
- uses: actions/upload-artifact@v2
with:
name: typst-preview-${{ env.target }}.vsix
path: addons/vscode/typst-preview-${{ env.target }}.vsix
- uses: actions/upload-artifact@v2
with:
name: typst-preview-${{ env.target }}
path: typst-preview-${{ env.target }}
release:
runs-on: ubuntu-latest
needs: [build, build_alpine]
if: success() && startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
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]
if: success() && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
- name: Deploy to VS Code Marketplace
run: npx vsce publish --packagePath $(find . -type f -iname '*.vsix')
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
- name: Deploy to OpenVSX
run: npx ovsx publish --packagePath $(find . -type f -iname '*.vsix')
env:
OVSX_PAT: ${{ secrets.OPENVSX_ACCESS_TOKEN }}