Update README.md #51
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: Benchmark | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Install Basic Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake | |
sudo apt-get install -y clang | |
- name: Install vcpkg | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git | |
./vcpkg/bootstrap-vcpkg.sh | |
./vcpkg/vcpkg integrate install | |
- name: Set up environment | |
run: | | |
echo "CC=clang" >> $GITHUB_ENV | |
echo "CXX=clang++" >> $GITHUB_ENV | |
echo "CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV | |
- name: Build for Benchmarking | |
run: | | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3" | |
./vcpkg/vcpkg integrate install | |
cmake --build build --target Benchmark | |
- name: Run Benchmarking | |
run: ./build/Benchmark --benchmark_format=console --benchmark_out=benchmark_results.json --benchmark_out_format=json | |
- name: Upload Benchmark Results as Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: benchmark-results | |
path: benchmark_results.json | |
- name: Move Benchmark Results to Temp Directory | |
run: mv benchmark_results.json /tmp/ | |
- name: Checkout default branch | |
uses: actions/checkout@v2 | |
- name: Create or Checkout gh-pages branch | |
run: | | |
git fetch | |
git checkout gh-pages || (git checkout --orphan gh-pages && git rm -rf .) | |
- name: Move Benchmark Results Back from Temp Directory | |
run: mv /tmp/benchmark_results.json ./ | |
- name: Commit and Push to gh-pages | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add benchmark_results.json | |
git commit -m "Add benchmark results" || echo "No changes to commit" | |
git push https://${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}} gh-pages |