Skip to content

改善1

改善1 #29

name: MinGW Build and Test
on:
push:
paths-ignore:
- '**/*.md'
- '.gitignore'
- '.editorconfig'
pull_request:
paths-ignore:
- '**/*.md'
- '.gitignore'
- '.editorconfig'
workflow_dispatch:
jobs:
mingw:
runs-on: windows-latest
strategy:
matrix:
configuration: [Debug, Release]
env:
BuildPlatform: MinGW
Configuration: ${{ matrix.configuration }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v6
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-iconv
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
mingw-w64-x86_64-7zip
mingw-w64-x86_64-gdb
- name: Show environment variables for debug
run: env
shell: msys2 {0}
- name: Build with MinGW-w64-gcc
shell: msys2 {0}
run: ./build-gnu.bat ${{ env.BuildPlatform }} ${{ env.Configuration }} --no-test
- name: Run unit tests
id: run_unit_tests
continue-on-error: true
shell: msys2 {0}
run: ./build-gnu.bat ${{ env.BuildPlatform }} ${{ env.Configuration }}
- name: Try gdb backtrace on test failure
if: steps.run_unit_tests.outcome == 'failure' && env.Configuration != 'Release'
continue-on-error: true
shell: msys2 {0}
working-directory: ${{ github.workspace }}/${{ env.BuildPlatform }}/${{ env.Configuration }}
run: |
set -eo pipefail
echo "Run gdb trace for: tests1.exe"
gdb -batch \
-ex "set pagination off" \
-ex "run" \
-ex "bt" \
-ex "bt full" \
-ex "info registers" \
--args ./tests1.exe --gtest_repeat=100 --gtest_throw_on_failure
- name: Mark workflow failed when unit tests fail
if: steps.run_unit_tests.outcome == 'failure' && env.Configuration != 'Release'
shell: msys2 {0}
run: |
echo "Unit tests failed. See the gdb trace above."
exit 1