Added a GitHub Actions pipeline for macOS (#7)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-05-22 21:33:11 +02:00
committed by GitHub
parent c51f1c9c33
commit 684bc1e273
7 changed files with 112 additions and 27 deletions

View File

@@ -1,11 +1,6 @@
name: linux-postgres-cxx20
on:
pull_request:
types: [opened, synchronize, reopened, closed]
push:
branches:
- master
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

View File

@@ -1,11 +1,6 @@
name: linux-sqlite-cxx20
on:
pull_request:
types: [opened, synchronize, reopened, closed]
push:
branches:
- master
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
@@ -65,7 +60,7 @@ jobs:
sudo ln -s $(which ccache) /usr/local/bin/$CXX
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build
cmake --build build -j4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure

View File

@@ -0,0 +1,52 @@
name: macos-postgres-cxx20
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
macos-clang:
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "macos-13"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: "${{ github.job }}-${{ matrix.os }}"
max-size: "2G"
create-symlink: true
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install ninja
run: brew install ninja autoconf bison flex
if: matrix.os == 'macos-latest'
- name: Compile
env:
CC: clang
CXX: clang++
run: |
if [[ "${{ matrix.os == 'macos-latest' }}" == "true" ]]; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
export CMAKE_GENERATOR=Ninja
fi
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_SQLITE3=OFF -DSQLGEN_BUILD_DRY_TESTS_ONLY=ON
cmake --build build -j 4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure

View File

@@ -0,0 +1,52 @@
name: macos-sqlite-cxx20
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
macos-clang:
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "macos-13"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: "${{ github.job }}-${{ matrix.os }}"
max-size: "2G"
create-symlink: true
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install ninja
run: brew install ninja
if: matrix.os == 'macos-latest'
- name: Compile
env:
CC: clang
CXX: clang++
run: |
if [[ "${{ matrix.os == 'macos-latest' }}" == "true" ]]; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
export CMAKE_GENERATOR=Ninja
fi
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build -j 4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure

View File

@@ -1,11 +1,6 @@
name: windows-postgres-cxx20
on:
pull_request:
types: [opened, synchronize, reopened, closed]
push:
branches:
- master
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

View File

@@ -1,11 +1,6 @@
name: windows-sqlite-cxx20
on:
pull_request:
types: [opened, synchronize, reopened, closed]
push:
branches:
- master
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

View File

@@ -23,9 +23,10 @@ sqlgen is a modern, type-safe ORM and SQL query generator for C++20, inspired by
### Installation
1. Install required dependencies (skip this step on Windows):
1. Make sure you have the required dependencies installed (skip this step on Windows):
```bash
sudo apt-get install autoconf bison flex
sudo apt-get install autoconf bison flex # Linux (Ubuntu, Debian, ...)
brew install autoconf bison flex # macOS
```
2. Set up vcpkg: