Use prebuilt protoc #444
Workflow file for this run
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: Install protobuf library | |
if: matrix.protobuf_lib == 'protobuf-cpp' | |
run: | | |
wget https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip | |
unzip protoc-25.1-linux-x86_64.zip -d protoc-25.1 | |
cp -r protoc-25.1/bin/* /usr/local/bin/ | |
cp -r protoc-25.1/include/* /usr/local/include/ | |
- 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) }} |