Integrated postgres into our own build pipeline

This commit is contained in:
Dr. Patrick Urbanke
2025-05-20 20:38:11 +02:00
parent 740930ef14
commit 8aa2aabec3
+54 -12
View File
@@ -3,7 +3,23 @@ name: linux-postgres-cxx20
on: [ pull_request, workflow_dispatch ]
jobs:
container-job:
linux:
strategy:
fail-fast: false
matrix:
include:
- compiler: llvm
compiler-version: 16
- compiler: llvm
compiler-version: 18
- compiler: gcc
compiler-version: 11
additional-dep: "g++-11"
- compiler: gcc
compiler-version: 12
- compiler: gcc
compiler-version: 14
name: "${{ github.job }} (${{ matrix.compiler }}-${{ matrix.compiler-version }})"
runs-on: ubuntu-24.04
container: node:20-bookworm-slim
@@ -19,19 +35,45 @@ jobs:
--health-retries 5
steps:
- name: Check out repository code
- name: Checkout
uses: actions/checkout@v4
# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
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.compiler }}-${{ matrix.compiler-version }}"
max-size: "2G"
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install dependencies
run: npm ci
- name: Connect to PostgreSQL
# Runs a script that creates a PostgreSQL table, populates
# the table with data, and then retrieves the data.
run: node client.js
# Environment variables used by the `client.js` script to create a new PostgreSQL table.
run: |
sudo apt update
sudo apt install -y ninja-build ${{ matrix.additional-dep }}
- name: Compile
run: |
if [[ "${{ matrix.compiler }}" == "llvm" ]]; then
export CC=clang-${{ matrix.compiler-version }}
export CXX=clang++-${{ matrix.compiler-version }}
elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then
export CC=gcc-${{ matrix.compiler-version }}
export CXX=g++-${{ matrix.compiler-version }}
fi
sudo ln -s $(which ccache) /usr/local/bin/$CC
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_SQLITE3=OFF
cmake --build build
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
env:
# The hostname used to communicate with the PostgreSQL service container
POSTGRES_HOST: postgres