1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
compiler: [clang, gcc]
protobuf_lib: [protobuf-c, protobuf-cpp]
valgrind: [valgrind,no-valgrind]
exclude:
# this combination hits linking errors: see https://github.com/pganalyze/libpg_query/pull/289
- compiler: clang
protobuf_lib: protobuf-cpp
valgrind: valgrind
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache protobuf library
if: matrix.protobuf_lib == 'protobuf-cpp'
id: cache-protobuf
uses: actions/cache@v4
with:
path: protobuf-25.1
key: ${{ runner.os }}-${{ matrix.compiler }}-protobuf-25.1
- name: Build protobuf library
if: matrix.protobuf_lib == 'protobuf-cpp' && steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch v25.1 https://github.com/protocolbuffers/protobuf.git protobuf-25.1
cd protobuf-25.1
git submodule update --init --recursive
cmake .
cmake --build . --parallel 10
- name: Install protobuf library
if: matrix.protobuf_lib == 'protobuf-cpp'
run: |
cd protobuf-25.1
sudo make install
sudo ldconfig
- name: Install Valgrind
if: matrix.valgrind == 'valgrind'
run: sudo apt update && sudo apt install -y valgrind
- name: Determine make flags
id: make_flags
run: |
if [ "$PROTOBUF_LIB" = protobuf-cpp ]
then
echo "::set-output name=proto_flags::USE_PROTOBUF_CPP=1"
else
echo "::set-output name=proto_flags::"
fi
if [ "$COMPILER" = clang ]
then
echo "::set-output name=compiler_flags::CC=clang CXX=clang"
elif [ "$COMPILER" = gcc ]
then
echo "::set-output name=compiler_flags::CC=gcc CXX=g++"
else
echo "::set-output name=compiler_flags::"
fi
if [ "$VALGRIND" = valgrind ]
then
echo "::set-output name=debug_flags::VALGRIND=1 DEBUG=1"
else
echo "::set-output name=debug_flags::"
fi
env:
PROTOBUF_LIB: ${{ matrix.protobuf_lib }}
COMPILER: ${{ matrix.compiler }}
VALGRIND: ${{ matrix.valgrind }}
- name: Build and run tests
run: make $FLAGS
env:
FLAGS: ${{ format('{0} {1} {2}', steps.make_flags.outputs.proto_flags, steps.make_flags.outputs.compiler_flags, steps.make_flags.outputs.debug_flags) }}
build_macos:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build and run tests
run: make
build_windows_msvc:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
steps:
- name: Configure MSVC developer console
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Check out code
uses: actions/checkout@v4
- name: Build and run tests
run: nmake /F Makefile.msvc
build_windows_msys2:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys: [mingw64, mingw32, ucrt64, clang64]
steps:
- name: Set up MSYS2 and compiler
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
pacboy: >-
toolchain:p
install: >-
make
diffutils
- name: Check out code
uses: actions/checkout@v4
- name: Build and run tests
shell: msys2 {0}
run: |
make
|