diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 0000000..5a24dea --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,42 @@ +name: Build Linux + +on: + workflow_call: + inputs: + cc: + required: false + type: string + default: gcc + cxx: + required: false + type: string + default: g++ + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + env: + CC: ${{ inputs.cc }} + CXX: ${{ inputs.cxx }} + steps: + - uses: actions/checkout@v5 + + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev ninja-build clang + + - name: Configure CMake + run: | + cmake -B Build/ubuntu -G Ninja \ + -D CMAKE_BUILD_TYPE=RelWithDebInfo \ + -D CMAKE_C_COMPILER=${{ inputs.cc }} \ + -D CMAKE_CXX_COMPILER=${{ inputs.cxx }} + + - name: Build + run: ninja -C Build/ubuntu + + - name: Run Tests + working-directory: Build/ubuntu/Tests + run: ./UrlLibTests diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 0000000..0659f0c --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,32 @@ +name: Build macOS + +on: + workflow_call: + inputs: + xcode-version: + required: true + type: string + runs-on: + required: false + type: string + default: macos-latest + +jobs: + build: + runs-on: ${{ inputs.runs-on }} + timeout-minutes: 15 + steps: + - uses: actions/checkout@v5 + + - name: Select Xcode ${{ inputs.xcode-version }} + run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer + + - name: Configure CMake + run: cmake -B Build/macOS -G Xcode + + - name: Build + run: cmake --build Build/macOS --target UrlLibTests --config RelWithDebInfo + + - name: Run Tests + working-directory: Build/macOS/Tests/RelWithDebInfo + run: ./UrlLibTests diff --git a/.github/workflows/build-win32.yml b/.github/workflows/build-win32.yml new file mode 100644 index 0000000..b96cbf6 --- /dev/null +++ b/.github/workflows/build-win32.yml @@ -0,0 +1,52 @@ +name: Build Win32 + +on: + workflow_call: + inputs: + platform: + required: true + type: string + +jobs: + build: + runs-on: windows-2022 + timeout-minutes: 15 + steps: + - uses: actions/checkout@v5 + + - name: Configure CMake + run: cmake -B Build/Win32 -A ${{ inputs.platform }} + + - name: Build Solution + run: cmake --build Build/Win32 --config RelWithDebInfo -- /m + + - name: Enable Crash Dumps + shell: cmd + run: | + rem WER does not reliably create a custom DumpFolder at crash time; make sure it + rem exists before the registry points at it. + if not exist "%RUNNER_TEMP%\Dumps" mkdir "%RUNNER_TEMP%\Dumps" + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /v DumpType /t REG_DWORD /d 2 /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /v DumpCount /t REG_DWORD /d 1 /f + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /v DumpFolder /t REG_SZ /d "%RUNNER_TEMP%\Dumps" /f + + - name: Run Tests + shell: cmd + working-directory: Build/Win32/Tests/RelWithDebInfo + run: UrlLibTests.exe + + - name: Stage Test App for Crash Dumps + if: failure() + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path "$env:RUNNER_TEMP\Dumps" | Out-Null + Copy-Item -Path "Build\Win32\Tests\RelWithDebInfo\UrlLibTests.*" -Destination "$env:RUNNER_TEMP\Dumps\" -ErrorAction SilentlyContinue + + - name: Upload Crash Dumps + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.platform }}-crash-dumps + path: ${{ runner.temp }}/Dumps/ + if-no-files-found: ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..25b2e33 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + # ── Win32 ───────────────────────────────────────────────────── + Win32_x64: + uses: ./.github/workflows/build-win32.yml + with: + platform: x64 + + # ── macOS ───────────────────────────────────────────────────── + macOS_Xcode164: + uses: ./.github/workflows/build-macos.yml + with: + xcode-version: '16.4' + runs-on: macos-latest + + # ── Linux ───────────────────────────────────────────────────── + Ubuntu_gcc: + uses: ./.github/workflows/build-linux.yml + + Ubuntu_clang: + uses: ./.github/workflows/build-linux.yml + with: + cc: clang + cxx: clang++