Skip to content

Commit

Permalink
ci: Support Windows and Linux on ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera authored Mar 8, 2024
1 parent 8b10e58 commit 5aaf7b9
Show file tree
Hide file tree
Showing 21 changed files with 231 additions and 64 deletions.
87 changes: 72 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,52 @@ jobs:
./hlasm_utils_test
working-directory: build/bin

aarch64-linux-musl:
name: Build Linux ARM64 toolchain
runs-on: ubuntu-22.04
container: alpine:3.19
steps:
- uses: actions/checkout@v4
- name: Install TAR
run: apk add tar
- uses: actions/cache@v4
id: cache
with:
path: toolchain.tar.gz
key: ${{ hashFiles('scripts/toolchain.linux_arm64.sh') }}
lookup-only: true
- name: Build image
if: steps.cache.outputs.cache-hit != 'true'
run: ./scripts/toolchain.linux_arm64.sh

build-matrix:
name: Build
runs-on: ${{ matrix.os }}
needs: [generate_grammar]
needs: [generate_grammar, aarch64-linux-musl]
strategy:
matrix:
include:
- os: ubuntu-22.04
native: linux
native: linux_x64
container: alpine:3.16
dbg-strip: objcopy --only-keep-debug language_server language_server.dbg && objcopy --strip-unneeded language_server && objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
- os: ubuntu-22.04
native: linux_arm64
container: alpine:3.19
dbg-strip: aarch64-linux-musl-objcopy --only-keep-debug language_server language_server.dbg && aarch64-linux-musl-objcopy --strip-unneeded language_server && aarch64-linux-musl-objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
- os: ubuntu-22.04
native: wasm
container: emscripten/emsdk:3.1.46
artifacts-ext: .*
- os: windows-2022
native: win32
native: win32_x64
artifacts-ext: .exe
- os: windows-2022
native: win32_arm64
artifacts-ext: .exe
skip-test: true
- os: macos-13
native: darwin_x64
- os: macos-14
Expand All @@ -191,13 +218,26 @@ jobs:
path: build/generated_parser
- name: Requirements install
run: if [ -f ./scripts/prereq.${{ matrix.native }}.sh ]; then ./scripts/prereq.${{ matrix.native }}.sh; fi
- name: Download toolchain
if: ${{ hashFiles(format('scripts/toolchain.{0}.sh', matrix.native)) != '' }}
uses: actions/cache/restore@v4
with:
path: toolchain.tar.gz
key: ${{ hashFiles(format('scripts/toolchain.{0}.sh', matrix.native)) }}
fail-on-cache-miss: true
- name: Extract toolchain
if: ${{ hashFiles(format('scripts/toolchain.{0}.sh', matrix.native)) != '' }}
run: |
tar xzf toolchain.tar.gz
echo "$PWD/toolchain/bin" >> $GITHUB_PATH
- name: Configure
run: ../scripts/config.${{ matrix.native }}.sh
working-directory: build
- name: Build
run: cmake --build . $([ -f ../scripts/build-extra.${{ matrix.native }}.conf ] && cat ../scripts/build-extra.${{ matrix.native }}.conf || true)
working-directory: build
- name: Server Test
if: ${{ !matrix.skip-test }}
run: |
if [ -f ../../scripts/test-runner.${{ matrix.native }}.sh ]; then
../../scripts/test-runner.${{ matrix.native }}.sh ./library_test
Expand Down Expand Up @@ -234,19 +274,22 @@ jobs:
matrix:
include:
- os: ubuntu-20.04
native: linux
native: linux_x64
chmod: true
- os: windows-2019
native: win32
native: win32_x64
chmod: false
- os: macos-11
native: darwin_x64
chmod: true
- os: ubuntu-22.04
native: linux
native: linux_x64
chmod: true
- os: ubuntu-22.04
native: linux_arm64
chmod: true
- os: windows-2022
native: win32
native: win32_x64
chmod: false
- os: macos-12
native: darwin_x64
Expand All @@ -259,7 +302,7 @@ jobs:
chmod: true

env:
XVFB: ${{ matrix.native == 'linux' && 'xvfb-run -a' || '' }}
XVFB: ${{ startsWith(matrix.native, 'linux') && 'xvfb-run -a' || '' }}
defaults:
run:
working-directory: ${{ env.CLIENT_DIR }}
Expand All @@ -278,6 +321,9 @@ jobs:
- name: Set executable flag
if: ${{ matrix.chmod }}
run: chmod +x bin/${{ matrix.native }}/language_server
- name: Setup emulation
if: ${{ hashFiles(format('scripts/emulation.{0}.sh', matrix.native)) != '' }}
run: ../../scripts/emulation.${{ matrix.native }}.sh
- name: NPM CI
run: npm ci
- name: Extension Test
Expand Down Expand Up @@ -330,16 +376,26 @@ jobs:
needs: [build-matrix, release-info]
steps:
- uses: actions/checkout@v4
- name: Download windows language server
- name: Download windows language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_win32_x64
path: ${{ env.CLIENT_DIR }}/bin/win32_x64/
- name: Download windows language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_win32_arm64
path: ${{ env.CLIENT_DIR }}/bin/win32_arm64/
- name: Download linux language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_win32
path: ${{ env.CLIENT_DIR }}/bin/win32/
- name: Download linux language server
name: language_server_linux_x64
path: ${{ env.CLIENT_DIR }}/bin/linux_x64/
- name: Download linux language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_linux
path: ${{ env.CLIENT_DIR }}/bin/linux/
name: language_server_linux_arm64
path: ${{ env.CLIENT_DIR }}/bin/linux_arm64/
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
Expand All @@ -363,7 +419,8 @@ jobs:
run: |
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_arm64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_arm64/language_server
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/Sonarcloud-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++-15
-DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation"
-DWITH_LIBCXX=Off
-DLANGUAGE_SERVER_BIN_SUBDIR=linux_x64
../
- name: Sonar build wrapper download
run: >
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ option(BUILD_VSIX "When disabled, the VS Code client is not built and it is not
option(BUILD_FUZZER "Enable building of the fuzzer. Tested with clang and libstdc++ (enable with -DWITH_LIBCXX=Off)" Off)

set(USE_PRE_GENERATED_GRAMMAR "" CACHE PATH "Directory with pre-generated grammar files")
set(LANGUAGE_SERVER_BIN_SUBDIR "" CACHE STRING "Subdirectory for the language server binary in the client project")

if(BUILD_SHARED_LIBS AND WITH_STATIC_CRT AND MSVC)
message(WARNING "Building shared libraries with static CRT!")
Expand Down
106 changes: 74 additions & 32 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"name": "CMAKE_VS_JUST_MY_CODE_DEBUGGING",
"value": "On",
"type": "BOOL"
},
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "win32_x64",
"type": "STRING"
}
]
},
Expand All @@ -28,7 +33,13 @@
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "win32_x64",
"type": "STRING"
}
]
},
{
"name": "x64-Release-Profile",
Expand All @@ -40,7 +51,13 @@
"cmakeCommandArgs": "-DCMAKE_EXE_LINKER_FLAGS=\"/PROFILE\" -DCMAKE_EXPORT_COMPILE_COMMANDS=1",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "win32_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-GNU-Release",
Expand All @@ -55,7 +72,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-Clang-Release",
Expand All @@ -70,7 +93,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-Clang-Debug-ASAN",
Expand All @@ -85,7 +114,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-Clang-Release-ASAN",
Expand All @@ -100,7 +135,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-Clang-Release-TSAN",
Expand All @@ -115,7 +156,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-Clang-Debug-TSAN",
Expand All @@ -130,7 +177,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "WSL-Clang-Fuzzer",
Expand All @@ -145,7 +198,13 @@
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
"variables": [
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
]
},
{
"name": "x64-Debug-ASAN",
Expand All @@ -162,31 +221,14 @@
"name": "CMAKE_VS_JUST_MY_CODE_DEBUGGING",
"value": "On",
"type": "BOOL"
},
{
"name": "LANGUAGE_SERVER_BIN_SUBDIR",
"value": "linux_x64",
"type": "STRING"
}
],
"addressSanitizerEnabled": true
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
}
}
15 changes: 8 additions & 7 deletions clients/vscode-hlasmplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ else()
endif()

set(BIN_EXTRAS "")
if(EMSCRIPTEN)
if(NOT "${LANGUAGE_SERVER_BIN_SUBDIR}" STREQUAL "")
set(BIN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/bin/${LANGUAGE_SERVER_BIN_SUBDIR}/")
elseif(EMSCRIPTEN)
set(BIN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/bin/wasm/")
list(APPEND BIN_EXTRAS "$<TARGET_FILE_DIR:language_server>/language_server.js" "$<TARGET_FILE_DIR:language_server>/language_server.worker.js" "$<TARGET_FILE_DIR:language_server>/language_server.wasm")
elseif(WIN32)
set(BIN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/bin/win32/")
elseif(APPLE)
set(BIN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/bin/darwin/")
else()
set(BIN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/bin/linux/")
message(FATAL_ERROR "LANGUAGE_SERVER_BIN_SUBDIR was not specified and could not have been guessed")
endif()

if(EMSCRIPTEN)
list(APPEND BIN_EXTRAS "$<TARGET_FILE_DIR:language_server>/language_server.js" "$<TARGET_FILE_DIR:language_server>/language_server.worker.js" "$<TARGET_FILE_DIR:language_server>/language_server.wasm")
endif()


Expand Down
Loading

0 comments on commit 5aaf7b9

Please sign in to comment.