name: build cv2pdb

on: [push, pull_request]

env:
  # Path to the solution file relative to the root of the project.
  SOLUTION_FILE_PATH: src/cv2pdb.vcxproj

  # Configuration type to build.
  BUILD_CONFIGURATION: Release
  BUILD_PLATFORM: x64
  BUILD_PLATFORM_TOOLSET: v142

jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Add MSBuild to PATH
        uses: microsoft/setup-msbuild@v1.0.2
      - name: Build
        working-directory: ${{env.GITHUB_WORKSPACE}}
        run: msbuild /m /p:PlatformToolset=${{env.BUILD_PLATFORM_TOOLSET}} /p:Platform=${{env.BUILD_PLATFORM}} /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
      - name: Upload bin/
        uses: actions/upload-artifact@v2
        with:
          name: bin
          path: bin

name: build and test cv2pdb

on: [push, pull_request]

env:
  # Path to the solution file relative to the root of the project.
  SOLUTION_FILE_PATH: src/cv2pdb.vcxproj

  # Configuration type to build.
  BUILD_CONFIGURATION: Release
  BUILD_PLATFORM: x64
  BUILD_PLATFORM_TOOLSET: v142

jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Add MSBuild to PATH
        uses: microsoft/setup-msbuild@v1.0.2
      - name: Build
        working-directory: ${{env.GITHUB_WORKSPACE}}
        run: msbuild /m /p:PlatformToolset=${{env.BUILD_PLATFORM_TOOLSET}} /p:Platform=${{env.BUILD_PLATFORM}} /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
      - name: Upload bin/
        uses: actions/upload-artifact@v2
        with:
          name: bin
          path: bin
  test-with-g4w-sdk:
    runs-on: windows-latest
    needs: build
    steps:
      - name: Download bin/
        uses: actions/download-artifact@v2
        with:
          name: bin
          path: bin
      - uses: git-for-windows/setup-git-for-windows-sdk@v1
      - name: verify using Git for Windows' GCC
        shell: bash
        run: |
          set -x &&
          cat >hello.c <<-\EOF &&
          #include <stdio.h>

          int main(int argc, char **argv)
          {
            printf("Hello, world\n");
            return 0;
          }
          EOF

          gcc -g -o hello.exe hello.c &&
          bin/${{env.BUILD_CONFIGURATION}}*/cv2pdb.exe hello.exe world.exe &&
          ls -l hello* world*

Verify in the GitHub workflow that cv2pdb can handle GCC's output
Verify in the GitHub workflow that cv2pdb can handle GCC's output

Git for Windows uses cv2pdb to convert the debugging information
produced by GCC to `.pdb` format, for use with Visual C's tools.

A recent GCC upgrade broke this because the debugging information was
produced in DWARF5 format, and the Git for Windows maintainer had to
scramble to implement (minimal) support for that format.

Let's verify in the GitHub workflow that cv2pdb can handle GCC's output
format, and let's use the very same GCC version that Git for Windows
uses to verify that.

Signed-off-by: Johannes Schindelin <53fb8db7833fca1e1746dd8592f61048d350f64c@gmx.de>
