Add option to automatically try all parse modes #439
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
compiler: [clang, gcc] | |
protobuf_lib: [protobuf-c, protobuf-cpp] | |
valgrind: [valgrind,no-valgrind] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Cache protobuf library | |
if: matrix.protobuf_lib == 'protobuf-cpp' | |
id: cache-protobuf | |
uses: actions/cache@v1 | |
with: | |
path: protobuf-3.14.0 | |
key: ${{ runner.os }}-protobuf-cpp-3.14.0 | |
- name: Build protobuf library | |
if: matrix.protobuf_lib == 'protobuf-cpp' && steps.cache-protobuf.outputs.cache-hit != 'true' | |
run: | | |
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-cpp-3.14.0.tar.gz | |
tar -xf protobuf-cpp-3.14.0.tar.gz | |
cd protobuf-3.14.0 | |
./configure | |
make | |
- name: Install protobuf library | |
if: matrix.protobuf_lib == 'protobuf-cpp' | |
run: | | |
cd protobuf-3.14.0 | |
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) }} |