Skip to content

Restore lib folder #135

Restore lib folder

Restore lib folder #135

Workflow file for this run

# Copyright (C) 2019-2021 Julian Valentin, LTeX Development Community
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: "CI"
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "develop"
workflow_dispatch:
jobs:
buildForVsCode:
name: "CI - Build for VS Code Job"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Node.js"
uses: "actions/setup-node@v4"
- name: "Install Node.js Dependencies"
run: "npm install && npm install -g vsce"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install semver==2.13.0"
- name: "Start X Virtual Frame Buffer"
if: "${{ startsWith(matrix.os, 'ubuntu-') }}"
run: "echo \"DISPLAY=:99.0\" >> $GITHUB_ENV && Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &"
- name: "Build Package with vsce"
run: "vsce package"
- name: "Run ESLint"
run: "npm run lint"
- name: "Run Mocha Tests (Linux)"
if: "${{ startsWith(matrix.os, 'ubuntu-') }}"
env:
LTEX_GITHUB_OAUTH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# to suppress "async hook stack has become corrupted" errors
# (https://github.com/microsoft/vscode/issues/85601)
NODE_OPTIONS: "--no-force-async-hooks-checks"
run: "npm run test"
- name: "Run Mocha Tests (Windows)"
if: "${{ startsWith(matrix.os, 'windows-') }}"
env:
LTEX_GITHUB_OAUTH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# to suppress "async hook stack has become corrupted" errors
# (https://github.com/microsoft/vscode/issues/85601)
NODE_OPTIONS: "--no-force-async-hooks-checks"
# otherwise, git clean fails to remove lib/ with "Invalid argument" errors
run: "npm run test -- --fast"
# buildForCocNvim:
# name: "CI - Build for coc.nvim Job"
# runs-on: "ubuntu-20.04"
# steps:
# - name: "Checkout Repository"
# uses: "actions/checkout@v2"
# - name: "Set up Node.js"
# uses: "actions/setup-node@v1"
# with:
# node-version: "16.11.0"
# - name: "Set up Python"
# uses: "actions/setup-python@v2"
# with:
# python-version: "3.9.0"
# - name: "Install Python Dependencies"
# run: "python -u -m pip install --upgrade pip && pip install semver==2.13.0"
# - name: "Patch for coc.nvim Target"
# run: "python -u tools/patchForTarget.py --target coc.nvim"
# - name: "Install Node.js Dependencies"
# run: "npm install"
# - name: "Compile and Package"
# run: "npm run coc.nvim:prepublish"
# - name: "Run ESLint"
# run: "npm run lint"
validate:
name: "CI - Validate Job"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install jsonschema==3.2.0 xmlschema==1.6.4"
- name: "Validate changelog.xml"
run: "python -u -c 'import xmlschema; xmlschema.XMLSchema(\"schemas/changes-1.0.0.xsd\").validate(\"changelog.xml\")'"
- name: "Validate JSON files"
run: "python -u tools/validateJsonFiles.py"
analyzeCodeQl:
name: "CI - CodeQL Job"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Initialize CodeQL"
uses: "github/codeql-action/init@v3"
with:
languages: "javascript,python"
- name: "Autobuild"
uses: "github/codeql-action/autobuild@v3"
- name: "Perform CodeQL Analysis"
uses: "github/codeql-action/analyze@v3"
deployForVsCode:
name: "CI - Deploy for VS Code Job"
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
needs:
- "buildForVsCode"
# - "buildForCocNvim"
- "validate"
- "analyzeCodeQl"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Node.js"
uses: "actions/setup-node@v4"
- name: "Install Node.js Dependencies"
run: "npm install && npm install -g vsce ovsx"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install semver==2.13.0"
- name: "Set VSCODE_LTEX_VERSION"
run: "echo \"VSCODE_LTEX_VERSION=$(python -u -c \"import json; print(json.load(open('package.json', 'r'))['version'], end='')\")\" >> $GITHUB_ENV"
- name: "Check VSCODE_LTEX_VERSION"
run: "if [[ -z \"$VSCODE_LTEX_VERSION\" ]]; then echo 'Error: VSCODE_LTEX_VERSION not set!'; (exit 1); fi; echo \"VSCODE_LTEX_VERSION set to '$VSCODE_LTEX_VERSION'\""
- name: "Set VSCODE_LTEX_IS_PRERELEASE"
run: "if [[ -z \"$VSCODE_LTEX_VERSION\" ]]; then echo 'Error: VSCODE_LTEX_VERSION not set!'; (exit 1); fi; echo \"VSCODE_LTEX_IS_PRERELEASE=$(python -u -c \"import semver; print('true' if semver.VersionInfo.parse('$VSCODE_LTEX_VERSION').prerelease is not None else 'false', end='')\")\" >> $GITHUB_ENV"
- name: "Check VSCODE_LTEX_IS_PRERELEASE"
run: "if [[ -z \"$VSCODE_LTEX_IS_PRERELEASE\" ]]; then echo 'Error: VSCODE_LTEX_IS_PRERELEASE not set!'; (exit 1); fi; echo \"VSCODE_LTEX_IS_PRERELEASE set to '$VSCODE_LTEX_IS_PRERELEASE'\""
- name: "Set VSCODE_LTEX_CHANGELOG"
run: "if [ \"$VSCODE_LTEX_IS_PRERELEASE\" = \"false\" ]; then echo \"VSCODE_LTEX_CHANGELOG<<EOF\" >> $GITHUB_ENV; python -u tools/convertChangelog.py --xml-file changelog.xml --version latest >> $GITHUB_ENV; echo \"EOF\" >> $GITHUB_ENV; else echo \"VSCODE_LTEX_CHANGELOG=This is a pre-release. Use at your own risk.\" >> $GITHUB_ENV; fi"
- name: "Build Package with vsce"
run: "vsce package"
- name: "Build Offline Packages"
env:
LTEX_GITHUB_OAUTH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: "python -u tools/createOfflinePackages.py"
- name: "Create GitHub Release"
uses: "softprops/action-gh-release@v0.1.8"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
prerelease: "${{ env.VSCODE_LTEX_IS_PRERELEASE }}"
body: "${{ env.VSCODE_LTEX_CHANGELOG }}"
files: "vscode-ltex-plus-${{ env.VSCODE_LTEX_VERSION }}.vsix\nvscode-ltex-plus-${{ env.VSCODE_LTEX_VERSION }}-offline-linux-x64.vsix\nvscode-ltex-plus-${{ env.VSCODE_LTEX_VERSION }}-offline-mac-x64.vsix\nvscode-ltex-plus-${{ env.VSCODE_LTEX_VERSION }}-offline-windows-x64.vsix"
- name: "Publish Package on VS Marketplace"
if: "${{ env.VSCODE_LTEX_IS_PRERELEASE == 'false' }}"
env:
VSCODE_LTEX_VSCE_TOKEN: "${{ secrets.VSCODE_LTEX_VSCE_TOKEN }}"
run: "vsce publish -p \"$VSCODE_LTEX_VSCE_TOKEN\""
# - name: "Publish Package on Open VSX"
# if: "${{ env.VSCODE_LTEX_IS_PRERELEASE == 'false' }}"
# env:
# VSCODE_LTEX_OVSX_TOKEN: "${{ secrets.VSCODE_LTEX_OVSX_TOKEN }}"
# run: "ovsx publish -p \"$VSCODE_LTEX_OVSX_TOKEN\""
# deployForCocNvim:
# name: "CI - Deploy for coc.nvim Job"
# if: "${{ startsWith(github.ref, 'refs/tags/') }}"
# needs:
# - "buildForVsCode"
# - "buildForCocNvim"
# - "validate"
# - "analyzeCodeQl"
# runs-on: "ubuntu-20.04"
# steps:
# - name: "Checkout Repository"
# uses: "actions/checkout@v2"
# - name: "Set up Node.js"
# uses: "actions/setup-node@v1"
# with:
# node-version: "16.11.0"
# registry-url: "https://registry.npmjs.org"
# - name: "Set up Python"
# uses: "actions/setup-python@v2"
# with:
# python-version: "3.9.0"
# - name: "Install Python Dependencies"
# run: "python -u -m pip install --upgrade pip && pip install semver==2.13.0"
# - name: "Patch for coc.nvim Target"
# run: "python -u tools/patchForTarget.py --target coc.nvim"
# - name: "Install Node.js Dependencies"
# run: "npm install"
# - name: "Set VSCODE_LTEX_VERSION"
# run: "echo \"VSCODE_LTEX_VERSION=$(python -u -c \"import json; print(json.load(open('package.json', 'r'))['version'], end='')\")\" >> $GITHUB_ENV"
# - name: "Check VSCODE_LTEX_VERSION"
# run: "if [[ -z \"$VSCODE_LTEX_VERSION\" ]]; then echo 'Error: VSCODE_LTEX_VERSION not set!'; (exit 1); fi; echo \"VSCODE_LTEX_VERSION set to '$VSCODE_LTEX_VERSION'\""
# - name: "Set VSCODE_LTEX_IS_PRERELEASE"
# run: "if [[ -z \"$VSCODE_LTEX_VERSION\" ]]; then echo 'Error: VSCODE_LTEX_VERSION not set!'; (exit 1); fi; echo \"VSCODE_LTEX_IS_PRERELEASE=$(python -u -c \"import semver; print('true' if semver.VersionInfo.parse('$VSCODE_LTEX_VERSION').prerelease is not None else 'false', end='')\")\" >> $GITHUB_ENV"
# - name: "Check VSCODE_LTEX_IS_PRERELEASE"
# run: "if [[ -z \"$VSCODE_LTEX_IS_PRERELEASE\" ]]; then echo 'Error: VSCODE_LTEX_IS_PRERELEASE not set!'; (exit 1); fi; echo \"VSCODE_LTEX_IS_PRERELEASE set to '$VSCODE_LTEX_IS_PRERELEASE'\""
# - name: "Compile and Package"
# run: "npm run coc.nvim:prepublish"
# - name: "Publish on npm (Dry Run)"
# if: "${{ env.VSCODE_LTEX_IS_PRERELEASE == 'true' }}"
# run: "npm publish --dry-run"
# - name: "Publish on npm"
# if: "${{ env.VSCODE_LTEX_IS_PRERELEASE == 'false' }}"
# env:
# NODE_AUTH_TOKEN: "${{ secrets.VSCODE_LTEX_NPM_TOKEN }}"
# run: "npm publish"