Skip to content

Commit

Permalink
github: test Ninja builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzaQ committed Mar 29, 2023
1 parent a138af5 commit 7ab634b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ on:
jobs:
build-linux:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
generator: ["Unix Makefiles", Ninja]

steps:
# Install latest CMake.
- uses: lukka/get-cmake@latest
Expand All @@ -30,7 +36,7 @@ jobs:
- name: CMake
run: |
mkdir cbuild
cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE
cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -G "${{ matrix.generator }}"
cmake --build cbuild/
- uses: ruby/setup-ruby@v1
Expand All @@ -56,6 +62,12 @@ jobs:
build-windows:
# Because we want to use Visual Studio 16 2019, we need to use the windows-2019 GitHub runner
runs-on: windows-2019

strategy:
fail-fast: false
matrix:
generator: ["Visual Studio 16 2019", Ninja]

steps:
# Install latest CMake.
- uses: lukka/get-cmake@latest
Expand All @@ -64,14 +76,19 @@ jobs:
with:
submodules: recursive

- name: Add cl.exe to PATH
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

- name: CMake
run: |
# make a build directory (note: build is already used by Crashpad)
mkdir cbuild
# run CMake (additional options like -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE are possible)
# it is recommended to specify the compiler version used for the build
cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -G "Visual Studio 16 2019"
cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -G "${{ matrix.generator }}" -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe
cmake --build cbuild/
- uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -101,6 +118,7 @@ jobs:
fail-fast: false
matrix:
arch: [arm64, x86_64]
generator: ["Unix Makefiles", Ninja]

steps:
# Install latest CMake.
Expand All @@ -113,7 +131,7 @@ jobs:
- name: CMake
run: |
mkdir cbuild
cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
cmake -S . -B cbuild/ -DBUILD_EXAMPLES=TRUE -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -G "${{ matrix.generator }}"
cmake --build cbuild/
- uses: ruby/setup-ruby@v1
Expand Down
2 changes: 2 additions & 0 deletions backtrace/save_artifacts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def gather_binaries dir = binary_dir
[ 'handler\Debug\handler.exe', 'bin/handler.exe' ],
[ './client/Release/client.lib', 'bin/client.lib' ],
[ 'handler\Release\handler.exe', 'bin/handler.exe' ],
[ './client/client.lib', 'bin/client.lib' ],
[ 'handler\handler.exe', 'bin/handler.exe' ],
]
Dir.chdir dir do
files.each do |file, name|
Expand Down
6 changes: 5 additions & 1 deletion backtrace/test/crashpad_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ def execute tmp_dir: nil

def handler
if OS.windows?
'handler/Debug/handler.exe'
[
'handler/Debug/handler.exe',
'handler/Release/handler.exe',
'handler/handler.exe',
].find { |f| File.exist? f }
else
'handler/handler'
end
Expand Down
10 changes: 8 additions & 2 deletions backtrace/test/test_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

require_relative 'crashpad_utils'

class TestLinux < Minitest::Test
class TestWindows < Minitest::Test
def test_crashpad_uploads
result = Crashpad::perform_test executable: 'examples/windows/demo/Debug/demo_windows.exe'
exe = if File.exist?("#{__dir__}/../../cbuild/examples/windows/demo/Debug/demo_windows.exe")
'examples/windows/demo/Debug/demo_windows.exe'
else
'examples/windows/demo/demo_windows.exe'
end

result = Crashpad::perform_test executable: exe
assert result
assert result.has_key? :upload

Expand Down

0 comments on commit 7ab634b

Please sign in to comment.