-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add template gallery as template picker (#52)
* feat: add template gallery as template picker * fix: ci install deps and add regular build checking * fix: ci regular build checking again * fix: stupid matrix
- Loading branch information
1 parent
9b7b4d7
commit c27bf6a
Showing
18 changed files
with
1,479 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ jobs: | |
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 | ||
|
@@ -48,6 +49,7 @@ jobs: | |
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 | ||
|
@@ -64,7 +66,7 @@ jobs: | |
rust-target: aarch64-apple-darwin | ||
platform: darwin | ||
arch: arm64 | ||
|
||
regular_build: 'true' | ||
name: build (${{ matrix.platform }}-${{ matrix.arch }}) | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
|
@@ -73,111 +75,129 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: Enter-tainer/typst-preview | ||
path: external/typst-preview | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Hack typst-preview | ||
run: | | ||
mv src/main.rs src/main.rsx | ||
working-directory: ./external/typst-preview | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Build typst-dom | ||
run: | | ||
yarn | ||
yarn build | ||
working-directory: ./external/typst-preview/addons/typst-dom | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Build frontend | ||
run: yarn | ||
working-directory: ./external/typst-preview/addons/frontend | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Build typst-preview | ||
run: | | ||
yarn | ||
yarn run compile | ||
working-directory: ./external/typst-preview/addons/vscode | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Install deps | ||
run: yarn install | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Build vscode extension | ||
run: | | ||
yarn | ||
yarn run compile | ||
working-directory: ./editors/vscode | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: ${{ matrix.rust-target }} | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
- name: Install llvm | ||
if: matrix.platform == 'linux' | ||
if: matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install llvm | ||
- name: Install AArch64 target toolchain | ||
if: matrix.rust-target == 'aarch64-unknown-linux-gnu' | ||
if: matrix.rust-target == 'aarch64-unknown-linux-gnu' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
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' | ||
if: matrix.rust-target == 'arm-unknown-linux-gnueabihf' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-arm-linux-gnueabihf | ||
- name: Build tinymist binary | ||
shell: pwsh | ||
run: | | ||
cargo build --release -p tinymist --target ${{ matrix.rust-target }} | ||
if: startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true' | ||
- name: Rename debug symbols for windows | ||
if: matrix.platform == 'win32' | ||
if: matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
run: | | ||
cd target/${{ matrix.rust-target }}/release | ||
cp tinymist.pdb tinymist-${{ env.target }}.pdb | ||
- name: Upload split debug symbols for windows | ||
if: matrix.platform == 'win32' | ||
if: matrix.platform == 'win32' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tinymist-${{ env.target }}.pdb | ||
path: target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.pdb | ||
- name: Split debug symbols for linux | ||
if: matrix.platform == 'linux' | ||
if: matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
run: | | ||
cd target/${{ matrix.rust-target }}/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: Upload split debug symbols for linux | ||
if: matrix.platform == 'linux' | ||
if: matrix.platform == 'linux' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tinymist-${{ env.target }}.debug | ||
path: target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.debug | ||
compression-level: 0 | ||
- name: Collect debug symbols for mac | ||
if: matrix.platform == 'darwin' | ||
if: matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
run: | | ||
dsymutil -f "target/${{ matrix.rust-target }}/release/tinymist" | ||
mv "target/${{ matrix.rust-target }}/release/tinymist.dwarf" "target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.dwarf" | ||
- name: Upload split debug symbols for mac | ||
if: matrix.platform == 'darwin' | ||
if: matrix.platform == 'darwin' && (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tinymist-${{ env.target }}.dwarf | ||
path: target/${{ matrix.rust-target }}/release/tinymist-${{ env.target }}.dwarf | ||
- name: Copy binary to output directory | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
shell: pwsh | ||
run: | | ||
cp "target/${{ matrix.rust-target }}/release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "editors/vscode/out/" | ||
cp "target/${{ matrix.rust-target }}/release/tinymist$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "tinymist-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" | ||
- name: Upload binary artifact | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tinymist-${{ env.target }} | ||
path: tinymist-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }} | ||
- name: Package extension | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
shell: pwsh | ||
run: yarn run package -- --target ${{ env.target }} -o tinymist-${{ env.target }}.vsix | ||
working-directory: ./editors/vscode | ||
- name: Upload VSIX artifact | ||
if: (startsWith(github.ref, 'refs/tags/') || matrix.regular_build == 'true') | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tinymist-${{ env.target }}.vsix | ||
|
@@ -186,6 +206,7 @@ jobs: | |
build_alpine: | ||
name: build (x86_64-unknown-linux-musl) | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
container: | ||
image: rust:alpine | ||
volumes: | ||
|
@@ -224,6 +245,8 @@ jobs: | |
yarn | ||
yarn run compile | ||
working-directory: ./external/typst-preview/addons/vscode | ||
- name: Install deps | ||
run: yarn install | ||
- name: Build vscode extension | ||
run: | | ||
yarn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,89 @@ | ||
module.exports = { | ||
env: { | ||
es2021: true, | ||
node: true, | ||
}, | ||
const tsRule = { | ||
files: ['*.ts'], | ||
ignorePatterns: ['esbuild.config.mjs'], | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:@typescript-eslint/strict", | ||
"prettier", | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
], | ||
overrides: [], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
project: "tsconfig.json", | ||
ecmaVersion: 10, | ||
project: ['./tsconfig.lib.json'], | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
modules: true, | ||
}, | ||
}, | ||
plugins: [ | ||
'@typescript-eslint', | ||
// "@angular-eslint/eslint-plugin" | ||
], | ||
rules: { | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], | ||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], | ||
"class-methods-use-this": "off", | ||
"@typescript-eslint/explicit-function-return-type": "error", | ||
"@typescript-eslint/no-explicit-any": "error", | ||
"init-declarations": "off", | ||
"@typescript-eslint/init-declarations": "error", | ||
"no-undef-init": "off", | ||
"@typescript-eslint/strict-boolean-expressions": [ | ||
"error", | ||
{ | ||
allowString: false, | ||
allowNumber: false, | ||
allowNullableObject: false, | ||
allowNullableEnum: false, | ||
}, | ||
], | ||
'@typescript-eslint/indent': [ | ||
'error', | ||
2, | ||
{ | ||
SwitchCase: 1, | ||
}, | ||
], | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ | ||
multiline: { | ||
delimiter: 'semi', | ||
requireLast: true, | ||
}, | ||
singleline: { | ||
delimiter: 'semi', | ||
requireLast: false, | ||
}, | ||
}, | ||
], | ||
semi: [2, 'always'], | ||
'@typescript-eslint/no-inferrable-types': [ | ||
'error', | ||
{ | ||
ignoreParameters: true, | ||
ignoreProperties: true, | ||
}, | ||
], | ||
'@typescript-eslint/ban-ts-comment': 0, | ||
'@typescript-eslint/no-empty-function': 0, | ||
'@typescript-eslint/no-var-requires': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'@typescript-eslint/no-floating-promises': 0, | ||
'@typescript-eslint/no-unsafe-assignment': 0, | ||
'@typescript-eslint/no-unsafe-return': 0, | ||
'@typescript-eslint/no-unsafe-call': 0, | ||
'@typescript-eslint/no-unsafe-member-access': 0, | ||
'@typescript-eslint/unbound-method': 0, | ||
// "@angular-eslint/use-injectable-provided-in": "error", | ||
// "@angular-eslint/no-attribute-decorator": "error" | ||
}, | ||
}; | ||
}; | ||
|
||
// noinspection SpellCheckingInspection | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
node: true, | ||
es6: true, | ||
es2015: true, | ||
es2017: true, | ||
}, | ||
overrides: [ | ||
tsRule, | ||
// { | ||
// "files": ["*.component.html"], | ||
// "parser": "@angular-eslint/template-parser", | ||
// "plugins": ["@angular-eslint/template"], | ||
// "rules": { | ||
// "@angular-eslint/template/banana-in-a-box": "error", | ||
// "@angular-eslint/template/no-negated-async": "error" | ||
// } | ||
// }, | ||
], | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
const path = require('path'); | ||
const fs = require('fs'); | ||
const rimraf = require('rimraf'); | ||
|
||
const vscodeDir = path.join(__dirname, '../'); | ||
const editorToolsDir = path.join(vscodeDir, '../../tools/editor-tools/'); | ||
|
||
rimraf.sync(path.join(vscodeDir, 'out/editor-tools/')); | ||
fs.mkdirSync(path.join(vscodeDir, 'out/editor-tools/'), { recursive: true }); | ||
|
||
function copyDir(src, dest) { | ||
fs.readdirSync(src).forEach((item) => { | ||
const srcPath = path.join(src, item); | ||
const destPath = path.join(dest, item); | ||
if (fs.lstatSync(srcPath).isDirectory()) { | ||
fs.mkdirSync(destPath, | ||
{ recursive: true }); | ||
copyDir(srcPath, destPath); | ||
} | ||
else { | ||
fs.copyFileSync(srcPath, destPath); | ||
} | ||
}); | ||
} | ||
|
||
copyDir(path.join(editorToolsDir, "dist"), path.join(vscodeDir, 'out/editor-tools/')); | ||
|
Oops, something went wrong.