Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 80 additions & 59 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: CMake on multiple platforms

on:
push:
branches: [ "main", "master" ]
branches:
- master
- main

pull_request:
branches: [ "master" ]

jobs:

Expand Down Expand Up @@ -33,65 +35,84 @@ jobs:

steps:

- uses: actions/checkout@v4

####################################################
# Ubuntu
####################################################

- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
default-libmysqlclient-dev \
pkg-config

####################################################
# Windows
####################################################

- name: Install MySQL via vcpkg
if: runner.os == 'Windows'
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
./vcpkg/vcpkg install libmysql:x64-windows

- name: Show installed packages
if: runner.os == 'Windows'
run: |
dir vcpkg\installed\x64-windows\share

####################################################
# Configure
####################################################

- name: Configure
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
else
cmake -B build \
###################################################
# Checkout
###################################################

- uses: actions/checkout@v4

###################################################
# Linux dependencies
###################################################

- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
default-libmysqlclient-dev \
pkg-config

###################################################
# Setup compiler (Linux)
###################################################

- name: Set compiler
if: runner.os == 'Linux'
run: |
echo "CC={{ matrix.cc }}" >> {{ matrix.cc }}" >> GITHUB_ENV
echo "CXX={{ matrix.cxx }}" >> {{ matrix.cxx }}" >> GITHUB_ENV

###################################################
# Setup vcpkg (Windows)
###################################################

- name: Setup vcpkg
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v11

###################################################
# Install MySQL (Windows)
###################################################

- name: Install MySQL
if: runner.os == 'Windows'
run: |
vcpkg install libmysql:x64-windows

###################################################
# Configure Linux
###################################################

- name: Configure Linux
if: runner.os == 'Linux'
run: |
cmake \
-B build \
-DCMAKE_BUILD_TYPE=Release
fi
shell: bash

####################################################
# Build
####################################################
###################################################
# Configure Windows
###################################################

- name: Configure Windows
if: runner.os == 'Windows'
run: |
cmake `
-B build `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"

###################################################
# Build
###################################################

- name: Build
run: cmake --build build --config Release
- name: Build
run: cmake --build build --config Release

####################################################
# Test
####################################################
###################################################
# Test
###################################################

- name: Test
run: ctest --test-dir build --build-config Release
- name: Test
run: ctest --test-dir build --build-config Release
Loading