Lib #59
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: Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/**' | ||
- 'examples/**' | ||
- 'CMakeLists.txt' | ||
- '.github/workflows/test.yml' | ||
pull_request: | ||
paths: | ||
- 'src/**' | ||
- 'examples/**' | ||
- 'CMakeLists.txt' | ||
- '.github/workflows/test.yml' | ||
workflow_dispatch: | ||
jobs: | ||
Brotli: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Cache | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: brotli/brotli-install | ||
key: libbrotli | ||
# if cache exists, done job | ||
- name: Check Cache Hit | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
run: exit 0 | ||
- name: Install Devtools | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y git cmake clang | ||
- name: Checkout Brotli | ||
run: | | ||
cd ~ | ||
git clone https://github.com/google/brotli | ||
cd brotli | ||
git checkout v1.0.9 | ||
mkdir build && cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./brotli-install .. | ||
make -j2 | ||
make install | ||
- name: Cache Brotli | ||
uses: actions/cache@v2 | ||
with: | ||
path: brotli/brotli-install | ||
key: libbrotli | ||
Test: | ||
runs-on: ubuntu-latest | ||
depends-on: Brotli | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Setup Clang | ||
uses: egor-tensin/setup-clang@v1 | ||
with: | ||
version: 16 | ||
platform: x64 | ||
- name: Setup CMake | ||
uses: jwlawson/actions-setup-cmake@v1.13 | ||
with: | ||
cmake-version: '3.26.0' | ||
- name: Get Brotli | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/brotli | ||
key: libbrotli | ||
- name: Install Brotli | ||
run: | | ||
cd ~/brotli | ||
sudo cp -r include/* /usr/include/ | ||
sudo cp -r lib/* /usr/lib/ | ||
- name: Build | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
mkdir build | ||
mkdir build/flame-route | ||
cd build | ||
CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=flame-route .. | ||
make -j2 | ||
- name: Test | ||
run: | | ||
bash test/test.sh || exit 1 | ||
- name: Generate Artifact | ||
run: | | ||
cd build | ||
make install | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: flame-route | ||
path: build/flame-route | ||