Skip to content

Commit

Permalink
Feat: Support running under Node.js (#111)
Browse files Browse the repository at this point in the history
Signed-off-by: Slavomir Kucera <[email protected]>
  • Loading branch information
slavek-kucera authored Apr 6, 2021
1 parent 8d70f11 commit dc0c47b
Show file tree
Hide file tree
Showing 135 changed files with 3,189 additions and 1,269 deletions.
138 changes: 99 additions & 39 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,108 +26,168 @@ on:
- development

jobs:
win-server:
win-server-build:
name: Windows language server
runs-on: windows-2019

steps:
- uses: actions/checkout@v1
- name: Configure
shell: cmd
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ../
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VSIX=Off ../
- name: Build
shell: cmd
run: cd build && cmake --build . --parallel --config Release
- name: Server Test
shell: cmd
run: cd build\bin && library_test.exe && server_test.exe
- name: Extension Test
shell: cmd
run: npm --prefix .\clients\vscode-hlasmplugin run test
- name: Extension Test Insiders
shell: cmd
run: npm --prefix .\clients\vscode-hlasmplugin run test:insiders
- name: Actions artifact
uses: actions/upload-artifact@v1
with:
name: language_server_win
name: language_server_win32
path: build/bin/language_server.exe

linux-server:
linux-server-build:
name: Linux language server
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: sudo apt-get update && sudo apt-get install uuid-dev g++-8 ninja-build
run: sudo apt-get update && sudo apt-get install -y uuid-dev ninja-build
- name: Configure
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ../
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DBUILD_VSIX=Off ../
- name: Build
run: cd build && cmake --build .
- name: Server Test
run: cd build/bin && ./server_test && ./library_test
- name: Extension Test
uses: GabrielBB/[email protected]
with:
run: npm --prefix clients/vscode-hlasmplugin run test
- name: Extension Test Insiders
uses: GabrielBB/[email protected]
with:
run: npm --prefix clients/vscode-hlasmplugin run test:insiders
- name: Actions artifact
uses: actions/upload-artifact@v1
with:
name: language_server_linux
path: build/bin/language_server

macos-server:
wasm-server-build:
name: WASM language server
runs-on: ubuntu-20.04
container: emscripten/emsdk:2.0.12

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: sudo apt-get update && sudo apt-get install -y ninja-build maven
- name: Configure
run: >
mkdir build && cd build && emcmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCOVER_TESTS=Off
-DWITH_LIBCXX=Off -DWITH_STATIC_CRT=Off -DCMAKE_EXE_LINKER_FLAGS="-s NODERAWFS=1"
-DCMAKE_CXX_FLAGS="-s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=8 -s TOTAL_MEMORY=268435456 -s PROXY_TO_PTHREAD=1 -fexceptions -s NODERAWFS=1 -s EXIT_RUNTIME=1 --bind"
-DCMAKE_CROSSCOMPILING_EMULATOR="node;--experimental-wasm-threads;--experimental-wasm-bulk-memory"
-Dgtest_disable_pthreads=On -DBUILD_VSIX=Off ../
- name: Build
run: cd build && cmake --build .
- name: Server Test
run: cd build/bin && node --experimental-wasm-threads --experimental-wasm-bulk-memory ./server_test.js && node --experimental-wasm-threads --experimental-wasm-bulk-memory ./library_test.js
- name: Actions artifact
uses: actions/upload-artifact@v2
with:
name: language_server_wasm
path: build/bin/language_server.*

macos-server-build:
name: MacOS language server
runs-on: macos-10.15

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: |
brew install ninja llvm@8
export PATH=~/usr/local/opt/llvm\@8/bin:$PATH
run: brew install ninja
- name: Configure
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_PATH=/usr/local/opt/llvm\@8 ../
run: >
mkdir build && cd build && cmake -G Ninja
-DCMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++
-DLLVM_PATH=$(brew --prefix llvm) -DBUILD_VSIX=Off ../
- name: Build
run: cd build && cmake --build . -- -v
- name: Server Test
run: cd build/bin && ./server_test && ./library_test
- name: Extension Test
run: npm --prefix clients/vscode-hlasmplugin run test
# Remove the insiders test until it is clear where is the problem with freezing of the test
# - name: Extension Test Insiders
# run: npm --prefix clients/vscode-hlasmplugin run test:insiders
- name: Actions artifact
uses: actions/upload-artifact@v1
with:
name: language_server_macos
name: language_server_darwin
path: build/bin/language_server

test-matrix:
name: Test
runs-on: ${{ matrix.os }}
needs: [win-server-build, linux-server-build, wasm-server-build, macos-server-build]
strategy:
matrix:
include:
- os: ubuntu-20.04
native: linux
chmod: true
- os: windows-2019
native: win32
chmod: false
- os: macos-10.15
native: darwin
chmod: true

steps:
- uses: actions/checkout@v1
- name: Download native language server
uses: actions/download-artifact@v1
with:
name: language_server_${{ matrix.native }}
path: clients/vscode-hlasmplugin/bin/${{ matrix.native }}/
- name: Run chmod
if: ${{ matrix.chmod }}
run: chmod +x clients/vscode-hlasmplugin/bin/${{ matrix.native }}/language_server
- name: Download wasm language server
uses: actions/download-artifact@v1
with:
name: language_server_wasm
path: clients/vscode-hlasmplugin/bin/wasm/
- name: NPM CI
run: npm --prefix clients/vscode-hlasmplugin ci
- name: Extension Test
uses: GabrielBB/[email protected]
with:
run: npm --prefix clients/vscode-hlasmplugin run test
- name: Extension Test WASM
uses: GabrielBB/[email protected]
with:
run: npm --prefix clients/vscode-hlasmplugin run test:wasm
- name: Extension Test Insiders
uses: GabrielBB/[email protected]
with:
run: npm --prefix clients/vscode-hlasmplugin run test:insiders

VSIX:
runs-on: ubuntu-18.04
needs: [win-server, linux-server, macos-server]
runs-on: ubuntu-20.04
needs: [test-matrix]

steps:
- uses: actions/checkout@v1
- name: Download windows language server
uses: actions/download-artifact@v1
with:
name: language_server_win
name: language_server_win32
path: clients/vscode-hlasmplugin/bin/win32/
- name: Download linux language server
uses: actions/download-artifact@v1
with:
name: language_server_linux
path: clients/vscode-hlasmplugin/bin/linux/
- name: Download wasm language server
uses: actions/download-artifact@v1
with:
name: language_server_wasm
path: clients/vscode-hlasmplugin/bin/wasm/
- name: Download MacOS language server
uses: actions/download-artifact@v1
with:
name: language_server_macos
name: language_server_darwin
path: clients/vscode-hlasmplugin/bin/darwin/
- name: Set executable flag
run: |
Expand All @@ -154,7 +214,7 @@ jobs:

alpine-VSIX:
name: Alpine VSIX
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
container:
image: alpine:3.10

Expand Down Expand Up @@ -191,7 +251,7 @@ jobs:

release:
name: Release VSIXs
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release'))
needs: [alpine-VSIX, VSIX]

Expand Down Expand Up @@ -265,7 +325,7 @@ jobs:

theia-test:
name: Theia Integration Test
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
needs: alpine-VSIX
strategy:
matrix:
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/Check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,42 @@ on:
jobs:
clang-asan:
name: Clang ASAN, UBSAN
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-8-dev libc++abi-8-dev
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-10-dev libc++abi-10-dev
- name: Configure
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined" ../
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined" ../
- name: Build
run: cd build && cmake --build .
- name: Test
run: cd build/bin && ./server_test && ./library_test

clang-tsan:
name: Clang TSAN
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-8-dev libc++abi-8-dev
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-10-dev libc++abi-10-dev
- name: Configure
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS="-fsanitize=thread" ../
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_CXX_FLAGS="-fsanitize=thread" ../
- name: Build
run: cd build && cmake --build .
- name: Test
run: cd build/bin && ./server_test && ./library_test

clang-format-check:
name: Code format
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
sudo apt-get update
sudo apt-get install -y clang-format-10
run: sudo apt-get install -y clang-format-10
- name: Run clang-format
run: clang-format-10 -style=file -n $(find . -name \*.h -print -o -name \*.cpp -print) 2>&1 | tee clang-format-output.txt
- name: Upload clang-format-output.txt
Expand All @@ -83,7 +79,7 @@ jobs:
license-headers:
name: License headers check
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Check license headers
Expand All @@ -93,7 +89,7 @@ jobs:
pr-base-check:
name: Master PR check
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request'
steps:
- name: Check, whether PR to master is from a release branch
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/Sonarcloud-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ on:
jobs:
sonarcloud-build:
name: SonarCloud build
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Get version
run: echo "VERSION=$(node -e "console.log(require('./clients/vscode-hlasmplugin/package.json').version)")" >> $GITHUB_ENV
- name: Requirements install
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-8-dev libc++abi-8-dev
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-10-dev libc++abi-10-dev
- name: Configure
run: >
mkdir build && cd build &&
cmake -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=clang-8
-DCMAKE_CXX_COMPILER=clang++-8
-DCMAKE_C_COMPILER=clang-10
-DCMAKE_CXX_COMPILER=clang++-10
-DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping"
../
- name: Sonar build wrapper download
Expand All @@ -61,9 +61,9 @@ jobs:
with:
run: npm --prefix clients/vscode-hlasmplugin test
- name: Merge raw profiles
run: cd build/bin && llvm-profdata-8 merge -o hlasm_profile library.rawprof server.rawprof
run: cd build/bin && llvm-profdata-10 merge -o hlasm_profile library.rawprof server.rawprof
- name: Generate lcov coverage
run: cd build/bin && llvm-cov-8 show -instr-profile hlasm_profile library_test -object server_test > ../coverage.txt
run: cd build/bin && llvm-cov-10 show -instr-profile hlasm_profile library_test -object server_test > ../coverage.txt
- name: Pull request event info
if: github.event_name == 'pull_request'
run: |
Expand Down
Loading

0 comments on commit dc0c47b

Please sign in to comment.