Skip to content

Build and Test

Build and Test #1624

name: Build and Test
on:
# Run a build on Pull Requests
pull_request:
branches: [ main ]
# Run this build every night
schedule:
- cron: "0 0 * * *"
# Run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
windows_vs_build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v2
- name: Build MIDebugEngine
run: |
${{ github.workspace }}/eng/Scripts/CI-Build.cmd -c $env:Configuration -t vs
env:
Configuration: ${{ matrix.configuration }}
- name: Setup VSTest.console.exe
uses: darenm/Setup-VSTest@v1.3
- name: Run VS Extension tests
run: vstest.console.exe ${{ github.workspace }}\bin\${{ matrix.configuration }}\MICoreUnitTests.dll ${{ github.workspace }}\bin\${{ matrix.configuration }}\JDbgUnitTests.dll ${{ github.workspace }}\bin\${{ matrix.configuration }}\SSHDebugTests.dll ${{ github.workspace }}\bin\${{ matrix.configuration }}\MIDebugEngineUnitTests.dll
windows_vscode_build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v2
- name: Build MIDebugEngine
run: |
${{ github.workspace }}/eng/Scripts/CI-Build.cmd -t vscode
- name: Copy Test Configuration
run: |
copy ${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\TestConfigurations\config_msys_gdb.xml ${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\config.xml
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
update: true
install: >-
mingw-w64-x86_64-toolchain
- shell: msys2 {0}
name: Gather c++ toolchain paths
run: |
cygpath -w $(which g++)
g++ --version
cygpath -w $(which gdb)
gdb --version
- shell: msys2 {0}
name: Run tests
run: |
export CppTestsPath=$(cygpath -u "${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\CppTests.dll")
export ResultsPath=$(cygpath -u "${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\results.trx")
dotnet test $CppTestsPath --logger "trx;LogFileName=$ResultsPath"
- name: 'Upload Test Results'
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: win_msys2_x64_results
path: ${{ github.workspace }}\bin\DebugAdapterProtocolTests\Debug\CppTests\results.trx
linux_build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build ${{ github.workspace }}/src/MIDebugEngine-Unix.sln
- run: |
sudo apt update
sudo apt-get install gdb g++ -y
which g++
which gdb
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
# TODO: Try to make core dumps work
# Related CoreDump Tests: https://github.com/microsoft/MIEngine/issues/1170
# echo 1 | sudo tee /proc/sys/kernel/core_uses_pid
# ulimit -S -c unlimited
# sudo sysctl -w kernel.core_pattern=${{ github.workspace }}/core.%e
- run: |
${{ github.workspace }}/eng/Scripts/CI-Build.sh
- run: |
${{ github.workspace }}/eng/Scripts/CI-Test.sh
- name: 'Upload Test Results'
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: linux_x64_results
path: ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/results.trx
osx_build:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build ${{ github.workspace }}/src/MIDebugEngine-Unix.sln
- run: |
${{ github.workspace }}/eng/Scripts/CI-Build.sh
- run: |
${{ github.workspace }}/eng/Scripts/CI-Test.sh
- name: 'Upload Test Results'
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: osx_x64_results
path: ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/results.trx