mirror of
https://github.com/James-Yu/LaTeX-Workshop.git
synced 2025-01-07 09:47:04 +03:00
Install latexindent in Actions and try a test
This commit is contained in:
parent
c63ff139a0
commit
98e4c8e13f
18
.github/workflows/texlive_on_linux.yml
vendored
18
.github/workflows/texlive_on_linux.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: TeX Live on Linux
|
||||
env:
|
||||
cache-version: v11
|
||||
cache-version: v12
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
@ -38,17 +38,23 @@ jobs:
|
||||
tlmgr update --self
|
||||
tlmgr install collection-latex
|
||||
tlmgr install import subfiles latexmk makeindex
|
||||
tlmgr install chktex lacheck
|
||||
tlmgr install chktex lacheck latexindent
|
||||
if: steps.cache-texlive.outputs.cache-hit != 'true'
|
||||
- name: Download latexindent binary
|
||||
run: |
|
||||
curl -s -O -L http://mirrors.ctan.org/support/latexindent/bin/linux/latexindent
|
||||
mv latexindent /tmp/texlive/bin/x86_64-linux/latexindent-binary
|
||||
chmod +x /tmp/texlive/bin/x86_64-linux/latexindent-binary
|
||||
if: steps.cache-texlive.outputs.cache-hit != 'true'
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: latex -v
|
||||
- run: |
|
||||
which perl
|
||||
perl -v
|
||||
- run: perl -MCwd -e 'print $Cwd::VERSION."\n";'
|
||||
- run: latexmk -v
|
||||
perl -MCwd -e 'print $Cwd::VERSION."\n";'
|
||||
- run: |
|
||||
latex -v
|
||||
latexmk -v
|
||||
- run: |
|
||||
npm ci
|
||||
npm run compile
|
||||
|
17
.github/workflows/texlive_on_mac.yml
vendored
17
.github/workflows/texlive_on_mac.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: TeX Live on macOS
|
||||
env:
|
||||
cache-version: v11
|
||||
cache-version: v12
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
@ -38,17 +38,22 @@ jobs:
|
||||
run: |
|
||||
tlmgr install collection-latex
|
||||
tlmgr install import subfiles latexmk makeindex
|
||||
tlmgr install chktex lacheck
|
||||
tlmgr install chktex lacheck latexindent
|
||||
if: steps.cache-texlive.outputs.cache-hit != 'true'
|
||||
- name: Download latexindent binary
|
||||
run: |
|
||||
curl -s -O -L http://mirrors.ctan.org/support/latexindent/bin/macos/latexindent
|
||||
[ -d /Users/runner/texlive/bin/x86_64-darwin/ ] && mv latexindent /Users/runner/texlive/bin/x86_64-darwin/latexindent-binary && chmod +x /Users/runner/texlive/bin/x86_64-darwin/latexindent-binary || [ -d /Users/runner/texlive/bin/universal-darwin/ ] && mv latexindent /Users/runner/texlive/bin/universal-darwin/latexindent-binary && chmod +x /Users/runner/texlive/bin/universal-darwin/latexindent-binary
|
||||
if: steps.cache-texlive.outputs.cache-hit != 'true'
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: latex -v
|
||||
- run: |
|
||||
which perl
|
||||
perl -v
|
||||
- run: perl -MCwd -e 'print $Cwd::VERSION."\n";'
|
||||
- run: latexmk -v
|
||||
perl -MCwd -e 'print $Cwd::VERSION."\n";'
|
||||
- run: |
|
||||
latex -v
|
||||
latexmk -v
|
||||
- run: |
|
||||
npm ci
|
||||
npm run compile
|
||||
|
19
.github/workflows/texlive_on_win.yml
vendored
19
.github/workflows/texlive_on_win.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: TeX Live on Windows
|
||||
env:
|
||||
cache-version: v11
|
||||
cache-version: v12
|
||||
on: [push]
|
||||
|
||||
permissions:
|
||||
@ -42,15 +42,22 @@ jobs:
|
||||
run: |
|
||||
tlmgr install collection-latex
|
||||
tlmgr install import subfiles latexmk makeindex
|
||||
tlmgr install chktex lacheck
|
||||
tlmgr install chktex lacheck latexindent
|
||||
if: steps.cache-texlive.outputs.cache-hit != 'true'
|
||||
- name: Download latexindent binary
|
||||
run: |
|
||||
curl -s -O -L http://mirrors.ctan.org/support/latexindent/bin/windows/latexindent.exe
|
||||
move "latexindent.exe" "D:\texlive\bin\win32\latexindent-binary.exe"
|
||||
if: steps.cache-texlive.outputs.cache-hit != 'true'
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: latex -v
|
||||
- run: perl -v
|
||||
- run: perl -MCwd -e 'print $Cwd::VERSION."\n";'
|
||||
- run: latexmk -v
|
||||
- run: |
|
||||
perl -v
|
||||
perl -MCwd -e 'print $Cwd::VERSION."\n";'
|
||||
- run: |
|
||||
latex -v
|
||||
latexmk -v
|
||||
- run: |
|
||||
npm ci
|
||||
npm run compile
|
||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -32,7 +32,7 @@
|
||||
"preLaunchTask": "task-watch-all",
|
||||
"env": {
|
||||
"LATEXWORKSHOP_CI": "1",
|
||||
"LATEXWORKSHOP_SUITE": ""
|
||||
"LATEXWORKSHOP_SUITE": "09_formatter"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
4
test/fixtures/armory/formatter/latex_base.tex
vendored
Normal file
4
test/fixtures/armory/formatter/latex_base.tex
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
abc
|
||||
\end{document}
|
46
test/suites/09_formatter.test.ts
Normal file
46
test/suites/09_formatter.test.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import * as vscode from 'vscode'
|
||||
import * as path from 'path'
|
||||
import * as assert from 'assert'
|
||||
import rimraf from 'rimraf'
|
||||
import * as lw from '../../src/lw'
|
||||
import { sleep, runTest, openActive, loadTestFile } from './utils'
|
||||
|
||||
suite('Formatter test suite', () => {
|
||||
|
||||
const suiteName = path.basename(__filename).replace('.test.js', '')
|
||||
let fixture = path.resolve(__dirname, '../../../test/fixtures/testground')
|
||||
const fixtureName = 'testground'
|
||||
|
||||
suiteSetup(() => {
|
||||
fixture = path.resolve(lw.extensionRoot, 'test/fixtures/testground')
|
||||
})
|
||||
|
||||
setup(async () => {
|
||||
await vscode.commands.executeCommand('latex-workshop.activate')
|
||||
await vscode.workspace.getConfiguration('latex-workshop').update('latexindent.path', 'latexindent-binary')
|
||||
})
|
||||
|
||||
teardown(async () => {
|
||||
await vscode.commands.executeCommand('workbench.action.closeAllEditors')
|
||||
lw.manager.rootFile = undefined
|
||||
|
||||
await vscode.workspace.getConfiguration('latex-workshop').update('latexindent.path', undefined)
|
||||
await vscode.workspace.getConfiguration('latex-workshop').update('latexindent.args', undefined)
|
||||
|
||||
if (path.basename(fixture) === 'testground') {
|
||||
rimraf(fixture + '/{*,.vscode/*}', (e) => {if (e) {console.error(e)}})
|
||||
await sleep(500) // Required for pooling
|
||||
}
|
||||
})
|
||||
|
||||
runTest({suiteName, fixtureName, testName: 'test latex formatter with dummy'}, async () => {
|
||||
await loadTestFile(fixture, [
|
||||
{src: 'formatter/latex_base.tex', dst: 'main.tex'}
|
||||
])
|
||||
await openActive(fixture, 'main.tex')
|
||||
const original = vscode.window.activeTextEditor?.document.getText()
|
||||
await vscode.commands.executeCommand('editor.action.formatDocument')
|
||||
const formatted = vscode.window.activeTextEditor?.document.getText()
|
||||
assert.notStrictEqual(original, formatted)
|
||||
})
|
||||
})
|
@ -7,7 +7,7 @@ export function run(): Promise<void> {
|
||||
const mocha = new Mocha({
|
||||
ui: 'tdd',
|
||||
color: true,
|
||||
timeout: 15000,
|
||||
timeout: process.env['LATEXWORKSHOP_CLI'] ? 15000 : 10000,
|
||||
retries: process.env['LATEXWORKSHOP_CLI'] ? 5 : 0
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user