Skip to content

Commit a5a67c9

Browse files
authored
Add GitHub Actions CI (Win32, macOS, Linux) (#32)
1 parent e86ffb3 commit a5a67c9

4 files changed

Lines changed: 157 additions & 0 deletions

File tree

.github/workflows/build-linux.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Linux
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cc:
7+
required: false
8+
type: string
9+
default: gcc
10+
cxx:
11+
required: false
12+
type: string
13+
default: g++
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
19+
env:
20+
CC: ${{ inputs.cc }}
21+
CXX: ${{ inputs.cxx }}
22+
steps:
23+
- uses: actions/checkout@v5
24+
25+
- name: Install packages
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y libcurl4-openssl-dev ninja-build clang
29+
30+
- name: Configure CMake
31+
run: |
32+
cmake -B Build/ubuntu -G Ninja \
33+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
34+
-D CMAKE_C_COMPILER=${{ inputs.cc }} \
35+
-D CMAKE_CXX_COMPILER=${{ inputs.cxx }}
36+
37+
- name: Build
38+
run: ninja -C Build/ubuntu
39+
40+
- name: Run Tests
41+
working-directory: Build/ubuntu/Tests
42+
run: ./UrlLibTests

.github/workflows/build-macos.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build macOS
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
xcode-version:
7+
required: true
8+
type: string
9+
runs-on:
10+
required: false
11+
type: string
12+
default: macos-latest
13+
14+
jobs:
15+
build:
16+
runs-on: ${{ inputs.runs-on }}
17+
timeout-minutes: 15
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Select Xcode ${{ inputs.xcode-version }}
22+
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer
23+
24+
- name: Configure CMake
25+
run: cmake -B Build/macOS -G Xcode
26+
27+
- name: Build
28+
run: cmake --build Build/macOS --target UrlLibTests --config RelWithDebInfo
29+
30+
- name: Run Tests
31+
working-directory: Build/macOS/Tests/RelWithDebInfo
32+
run: ./UrlLibTests

.github/workflows/build-win32.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build Win32
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
build:
12+
runs-on: windows-2022
13+
timeout-minutes: 15
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- name: Configure CMake
18+
run: cmake -B Build/Win32 -A ${{ inputs.platform }}
19+
20+
- name: Build Solution
21+
run: cmake --build Build/Win32 --config RelWithDebInfo -- /m
22+
23+
- name: Enable Crash Dumps
24+
shell: cmd
25+
run: |
26+
rem WER does not reliably create a custom DumpFolder at crash time; make sure it
27+
rem exists before the registry points at it.
28+
if not exist "%RUNNER_TEMP%\Dumps" mkdir "%RUNNER_TEMP%\Dumps"
29+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /f
30+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /v DumpType /t REG_DWORD /d 2 /f
31+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /v DumpCount /t REG_DWORD /d 1 /f
32+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\UrlLibTests.exe" /v DumpFolder /t REG_SZ /d "%RUNNER_TEMP%\Dumps" /f
33+
34+
- name: Run Tests
35+
shell: cmd
36+
working-directory: Build/Win32/Tests/RelWithDebInfo
37+
run: UrlLibTests.exe
38+
39+
- name: Stage Test App for Crash Dumps
40+
if: failure()
41+
shell: powershell
42+
run: |
43+
New-Item -ItemType Directory -Force -Path "$env:RUNNER_TEMP\Dumps" | Out-Null
44+
Copy-Item -Path "Build\Win32\Tests\RelWithDebInfo\UrlLibTests.*" -Destination "$env:RUNNER_TEMP\Dumps\" -ErrorAction SilentlyContinue
45+
46+
- name: Upload Crash Dumps
47+
if: failure()
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: ${{ inputs.platform }}-crash-dumps
51+
path: ${{ runner.temp }}/Dumps/
52+
if-no-files-found: ignore

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
# ── Win32 ─────────────────────────────────────────────────────
11+
Win32_x64:
12+
uses: ./.github/workflows/build-win32.yml
13+
with:
14+
platform: x64
15+
16+
# ── macOS ─────────────────────────────────────────────────────
17+
macOS_Xcode164:
18+
uses: ./.github/workflows/build-macos.yml
19+
with:
20+
xcode-version: '16.4'
21+
runs-on: macos-latest
22+
23+
# ── Linux ─────────────────────────────────────────────────────
24+
Ubuntu_gcc:
25+
uses: ./.github/workflows/build-linux.yml
26+
27+
Ubuntu_clang:
28+
uses: ./.github/workflows/build-linux.yml
29+
with:
30+
cc: clang
31+
cxx: clang++

0 commit comments

Comments
 (0)