Skip to content

Add grpc channel arguments about keepalive #122

Add grpc channel arguments about keepalive

Add grpc channel arguments about keepalive #122

Workflow file for this run

name: CI
on:
push:
branches: [main, testing]
pull_request:
branches: [main]
env:
LD_LIBRARY_PATH: "/usr/local/lib:$LD_LIBRARY_PATH"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
ghc: ['9.2.8']
cabal: ['3.8']
grpc: ['v1.54.2']
os: [ubuntu-latest] # TODO: macOS-latest
name: ghc-${{ matrix.ghc }} cabal-${{ matrix.cabal }} grpc-${{ matrix.grpc }} on ${{ matrix.os }}
env:
GRPC_RELEASE_DIR: /opt/grpc-${{ matrix.grpc }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Haskell caches
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1-
- name: Grpc caches
uses: actions/cache@v3
with:
path: |
/opt/grpc-${{ matrix.grpc }}
key: ${{ runner.os }}-grpc-${{ matrix.grpc }}
restore-keys: |
${{ runner.os }}-grpc
- name: Check grpc caches
run: |
if [ -e "$GRPC_RELEASE_DIR/lib/libgrpc++.so" ]; then
echo '::set-output name=INSTALLED::yes'
else
# empty release dir
mkdir -p $GRPC_RELEASE_DIR && rm -rf $GRPC_RELEASE_DIR/*
SRC_DIR=$(mktemp -d)
cd $SRC_DIR && \
git init && git remote add origin https://github.com/grpc/grpc.git && \
git fetch --depth 1 origin ${{ matrix.grpc }} && \
git checkout FETCH_HEAD && \
git submodule update --init --recursive --depth 1
echo "::set-output name=INSTALLED::no"
echo "::set-output name=SRC_DIR::${SRC_DIR}"
fi
id: check-grpc-installed
- name: Install build deps on linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y \
gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 20
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 20
- name: (TODO) Install build deps on osx
if: runner.os == 'macOS'
run: echo "TODO"
- name: Build grpc on linux
if: runner.os == 'Linux'
run: |
if [ "${{ steps.check-grpc-installed.outputs.INSTALLED }}" == "yes" ]; then
echo "Use cached grpc: $GRPC_RELEASE_DIR"
else
sudo apt-get update
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y \
build-essential autoconf libtool libssl-dev pkg-config cmake
cd ${{ steps.check-grpc-installed.outputs.SRC_DIR }} && \
cmake -DCMAKE_INSTALL_PREFIX=$GRPC_RELEASE_DIR \
-DgRPC_BUILD_TESTS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DgRPC_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release \
-DgRPC_SSL_PROVIDER=package \
. && \
make -j $(nproc) && \
sudo make install -j $(nproc)
fi
- name: (TODO) Build grpc on osx
if: runner.os == 'macOS'
run: |
brew install autoconf libtool [email protected] pkg-config cmake shtool
- name: Setup grpc
run: |
sudo mkdir -p /usr/local/{bin,lib,include}
sudo ln -s $(realpath $GRPC_RELEASE_DIR/bin)/* /usr/local/bin/
sudo ln -s $(realpath $GRPC_RELEASE_DIR/lib)/* /usr/local/lib/
sudo ln -s $(realpath $GRPC_RELEASE_DIR/include)/* /usr/local/include/
- name: Setup Haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Update system PATH
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- name: generate example grpc c++ files
run: make -f example/Makefile
- name: sdist
run: |
mkdir -p $HOME/sdist
cabal sdist all --output-dir $HOME/sdist
- name: unpack
run: |
rm -rf $GITHUB_WORKSPACE/*
find $HOME/sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE -xzvf {} \;
cd $GITHUB_WORKSPACE && \
echo "packages:" > cabal.project && \
find . -maxdepth 4 -type f -name "*.cabal" -exec echo " {}" \; >> cabal.project
- name: build
run: |
cabal install proto-lens-protoc # hs-grpc-example requires this
cabal build all --upgrade-dependencies --enable-tests --enable-benchmarks
- name: test
run: cabal test all --test-show-details=always
# Unfortunately, there is no `cabal check all`
- name: check
run: |
for f in $(cat cabal.project |grep "\.cabal$"); do
bash -c "cd $(dirname $f) && cabal check"
done
- name: haddock
run: cabal haddock all