Skip to content

Commit

Permalink
Merge pull request #113 from WissenIstNacht/client-update
Browse files Browse the repository at this point in the history
Client update to connect to ViperServer's language server
  • Loading branch information
ArquintL committed Oct 3, 2022
2 parents cce3748 + f2cd2f8 commit 41fae85
Show file tree
Hide file tree
Showing 86 changed files with 14,344 additions and 29,215 deletions.
81 changes: 62 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ on:
# note that release-candidate builds are treated like 'stable' builds for now except that there is no deployment to the marketplaces in the end.
# in the future, this should be changed such that release-candidates result in a prerelease (like nightly builds).

# the following env variables configure the behavior of this workflow
# in particular, they control whether Viper-IDE is tested against certain ViperTools and a ViperServer JAR on push and pull requests
# this is particularly useful during debugging / testing as a new Viper-IDE release is not necessary for every change to the ViperServer JAR
env:
TEST_LOCAL_ON_PUSH_PR: false
# note that the following URL is extended with `/${{ matrix.viper-tools-zip-file }}` in the 'build-and-test' job:
TEST_LOCAL_ON_PUSH_PR_VIPERTOOLS_URL: https://github.com/viperproject/viper-ide/releases/download/v-2022-09-21-1611
# the following URL is not extended and downloading the destination is expected to return the viperserver.jar:
TEST_LOCAL_ON_PUSH_PR_VIPERSERVER_URL: https://polybox.ethz.ch/index.php/s/54sDcqHDJHelKBY/download

jobs:
create-viper-tools:
if: github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -143,10 +153,10 @@ jobs:
# tests should not be stopped when they fail on one of the OSes:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest] # [macos-latest, ubuntu-latest, windows-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
# - os: macos-latest
# viper-tools-zip-file: "ViperToolsMac.zip"
- os: macos-latest
viper-tools-zip-file: "ViperToolsMac.zip"
- os: ubuntu-latest
viper-tools-zip-file: "ViperToolsLinux.zip"
- os: windows-latest
Expand Down Expand Up @@ -182,9 +192,6 @@ jobs:
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- run: npm ci --cache ../client/.npm --prefer-offline # server uses same cache as the client
working-directory: server

- run: npm ci --cache .npm --prefer-offline
working-directory: client

Expand All @@ -193,40 +200,55 @@ jobs:
# nightly ViperTool releases. Any change to the Viper-IDE have ensure compatability
# - before releasing Viper-IDE together with some ViperTools, Viper-IDE has to be tested against the latest stable and
# nightly ViperTool releases AND the ViperTools that should be released.
- name: Download ViperTools to test against
- name: Download ViperTools to test against (only downloading previously created ViperTools)
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
uses: actions/download-artifact@v2
with:
name: ViperTools
path: client/ViperTools

- name: Setup ViperTools folder
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: mkdir -p client/ViperTools

- name: Download ViperTools to test against (only downloading ViperTools for PUSH and PR operations if configured accordingly)
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: curl --fail --silent --show-error -L ${{ env.TEST_LOCAL_ON_PUSH_PR_VIPERTOOLS_URL }}/${{ matrix.viper-tools-zip-file }} --output ${{ matrix.viper-tools-zip-file }}
working-directory: client/ViperTools

- name: Unzip ViperTools (non-windows)
if: ${{ !startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ !startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: unzip ${{ matrix.viper-tools-zip-file }} -d ExtractedTools
working-directory: client/ViperTools

- name: Unzip ViperTools (windows)
if: ${{ startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: powershell Expand-Archive -LiteralPath ${{ matrix.viper-tools-zip-file }} -DestinationPath ExtractedTools
working-directory: client/ViperTools

- name: Download ViperServer JAR (only downloading ViperTools for PUSH and PR operations if configured accordingly)
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: curl --fail --silent --show-error -L ${{ env.TEST_LOCAL_ON_PUSH_PR_VIPERSERVER_URL }} --output viperserver.jar
working-directory: client/ViperTools/ExtractedTools/backends

- name: Create path to extracted tools (non-windows)
if: ${{ !startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ !startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: |
echo "EXTRACTED_TOOLS_PATH=${{ github.workspace }}/client/ViperTools/ExtractedTools" >> $GITHUB_ENV
shell: bash

- name: Create path to extracted tools (windows)
if: ${{ startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
# replace all backslashes by double backslashes to properly escape them in the resulting JSON
run: |
PATH='EXTRACTED_TOOLS_PATH=${{ github.workspace }}\client\ViperTools\ExtractedTools'
echo ${PATH//'\'/'\\'} >> $GITHUB_ENV
shell: bash

- name: Create an additional test config
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success') }}
run: |
mkdir -p client/src/test/data/settings
echo '{
"viperSettings.buildVersion": "Local",
"viperSettings.paths": {
Expand All @@ -236,12 +258,13 @@ jobs:
"linux": "${{ env.EXTRACTED_TOOLS_PATH }}",
"mac": "${{ env.EXTRACTED_TOOLS_PATH }}"
}
}
},
"viperserver.trace.server": "verbose"
}' > client/src/test/data/settings/ci_local.json
shell: bash

- name: Get config content
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success') }}
run: cat client/src/test/data/settings/ci_local.json
shell: bash

Expand Down Expand Up @@ -281,10 +304,19 @@ jobs:
run: npx vsce ls
working-directory: client

- name: Package Viper-IDE extension (ubuntu only)
if: startsWith(matrix.os, 'ubuntu')
# note that baseContentUrl has to be manually provided as vsce does not know that it is run in the client subfolder:
run: npm run package -- --baseContentUrl https://github.com/viperproject/viper-ide/raw/master/client --out viper-ide.vsix
# use vsce to package the extension into a vsix file.
# sets a special field in package.json to indicate that the package is not a pre-release (it's one
# by default)
- name: Package Viper-IDE extension (ubuntu & stable release only)
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.type == 'stable' }}
run: |
npm pkg set viper.prerelease=false --json
npm run package -- --out viper-ide.vsix
working-directory: client

- name: Package Viper-IDE extension (ubuntu & non-stable release only)
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.type != 'stable' }}
run: npm run package -- --out viper-ide.vsix --pre-release
working-directory: client

- name: Upload packaged Viper-IDE (ubuntu-only)
Expand Down Expand Up @@ -449,7 +481,7 @@ jobs:
echo "LAST_PUBLISHED_VERSION=$LAST_PUBLISHED_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
# only publish 'stable' releases not release-candidates
# publish 'stable' releases (release-candidates will be released as pre-releases below)
- name: Publish the extension to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v0
if: ${{ github.event.inputs.type == 'stable' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
Expand All @@ -467,3 +499,14 @@ jobs:
registryUrl: https://open-vsx.org
extensionFile: client/viper-ide.vsix
packagePath: ''

# publish 'rc' releases as pre-releases
- name: Publish the extension to Visual Studio Marketplace (as pre-release)
uses: HaaLeo/publish-vscode-extension@v0
if: ${{ github.event.inputs.type == 'rc' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
with:
pat: ${{ secrets.VSCE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: client/viper-ide.vsix
packagePath: ''
preRelease: true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules/
^.*\.log$
re:(?x) (^|.*\/) (?!webpack\.config) ([^\/]+)\.js $
/out/
/.vscode-test/

syntax:glob
.DS_Store
7 changes: 0 additions & 7 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
/node_modules/
^.*\.log$
re:(?x) (^|.*\/) (?!webpack\.config) ([^\/]+)\.js $
/out/
/.vscode-test/

syntax:glob
.DS_Store
27 changes: 25 additions & 2 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": ["webpack.config.js"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-require-imports": [ // disallow `require`
"error"
]
],
"@typescript-eslint/explicit-function-return-type": [ // require a return type for functions
"error", { "allowExpressions": true }
],
"@typescript-eslint/no-misused-promises": [ // disallow promises in place where they are unexpected and thus not handled
"error"
],
"@typescript-eslint/no-floating-promises": [ // enforce that promises get handled
"error"
],
"@typescript-eslint/no-empty-function": [
"warn", { "allow": ["arrowFunctions"] }
],
"@typescript-eslint/no-inferrable-types": [
"error", { "ignoreParameters": true, "ignoreProperties": true }
],
"no-inner-declarations": "off"
}
}
6 changes: 4 additions & 2 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.DS_Store
dist/
server/
node_modules/
out/
.vscode-test/
npm-debug.log
languageServerExample.log
logger.log
viperserver.log
12 changes: 5 additions & 7 deletions client/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
"--extensionDevelopmentPath=${workspaceRoot}" /*,
"--profile-temp",
"--disable-extensions",
"${workspaceRoot}/src/test/data" */
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/**/*.js"],
"preLaunchTask": {
Expand All @@ -18,18 +20,14 @@
}
},
{
"name": "Test (Startup)",
"name": "Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/dist/test"
],
"env": {
"VIPER_IDE_TEST_SUITE": "${workspaceRoot}/dist/test/startup.test.js"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/test/**/*.js"],
"preLaunchTask": {
Expand Down
8 changes: 3 additions & 5 deletions client/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
".vscode-test": true
},

//workplace settings
"typescript.implementationsCodeLens.enabled": true,
"typescript.tsc.autoDetect": "off"

//"files.trimTrailingWhitespace": true,
//"editor.rulers": [80, 100],
//"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
"typescript.tsc.autoDetect": "off",
"window.title": "${dirty}${activeEditorShort}${separator}$Viper IDE$"
}
Loading

0 comments on commit 41fae85

Please sign in to comment.