Skip to content

Commit

Permalink
Run mempool benchmarks in a separate GHA job
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisdral committed Sep 5, 2024
1 parent f7d78f8 commit 7ce17e8
Showing 1 changed file with 68 additions and 31 deletions.
99 changes: 68 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,76 @@ jobs:
if: matrix.test-set == 'no-thunks-safe'
run: cabal test ouroboros-consensus:consensus-test ouroboros-consensus:doctest ouroboros-consensus:infra-test ouroboros-consensus:storage-test ouroboros-consensus-cardano:byron-test ouroboros-consensus-cardano:shelley-test ouroboros-consensus-diffusion:infra-test ouroboros-consensus-protocol:protocol-test -j --test-show-details=streaming

- name: Identify benchmark executables
run: |
cp $(cabal list-bin mempool-bench) mempool-bench
- name: Upload benchmark executables
uses: actions/upload-artifact@v4
with:
name: benchmark-exes-${{ runner.os }}-${{ matrix.ghc }}
path: mempool-bench
retention-days: 1

# NB: build the haddocks at the end to avoid unecessary recompilations.
# We build the haddocks only for one GHC version.
- name: Build Haddock documentation
if: |
github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& matrix.ghc=='9.6.6'
run: |
# need for latex, dvisvgm and standalone
sudo apt install texlive-latex-extra texlive-latex-base
# cabal-docspec doesn't work with XDG https://github.com/phadej/cabal-extras/issues/136
sed -i 's_-- store-dir:_store-dir: /home/runner/.local/state/cabal/store_g' ~/.config/cabal/config
export CABAL_CONFIG=~/.config/cabal/config
./scripts/docs/haddocks.sh
tar vzcf haddocks.tgz ./docs/website/static/haddocks
- name: Upload haddocks as an artifact
if: |
github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& matrix.ghc=='9.6.6'
uses: actions/upload-artifact@v4
with:
name: haddocks
path: haddocks.tgz
retention-days: 1

benchmarks:
name: Run benchmarks
needs: build-test-bench-haddocks

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.6.6", "9.10.1"]

steps:
- uses: actions/checkout@v4

- name: Install base libraries
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: false

- name: Download benchmark executables
uses: actions/download-artifact@v4
with:
name: benchmark-exes-${{ runner.os }}-${{ matrix.ghc }}

- name: Set permissions for benchmark executables
run: |
chmod u+x mempool-bench
- name: Create baseline-benchmark
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
cabal new-run ouroboros-consensus:mempool-bench -- \
./mempool-bench \
--timeout=60 --csv mempool-benchmarks.csv \
+RTS -T
Expand All @@ -163,7 +229,6 @@ jobs:
# then we will save the same results we just restored.
- name: Cache benchmark baseline results
uses: actions/cache@v4
if: matrix.variant == 'default'
with:
path: baseline-mempool-benchmarks.csv
key: baseline-mempool-benchmarks-${{ runner.os }}-${{ matrix.ghc }}-${{ github.run_id }}
Expand All @@ -188,7 +253,7 @@ jobs:
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -f baseline-mempool-benchmarks.csv ]; then
cabal new-run ouroboros-consensus:mempool-bench -- \
./mempool-bench \
--timeout=60 --baseline baseline-mempool-benchmarks.csv \
--fail-if-slower 100 \
+RTS -T
Expand All @@ -197,34 +262,6 @@ jobs:
echo "Benchmarks comparison skipped."
fi
# NB: build the haddocks at the end to avoid unecessary recompilations.
# We build the haddocks only for one GHC version.
- name: Build Haddock documentation
if: |
github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& matrix.ghc=='9.6.6'
run: |
# need for latex, dvisvgm and standalone
sudo apt install texlive-latex-extra texlive-latex-base
# cabal-docspec doesn't work with XDG https://github.com/phadej/cabal-extras/issues/136
sed -i 's_-- store-dir:_store-dir: /home/runner/.local/state/cabal/store_g' ~/.config/cabal/config
export CABAL_CONFIG=~/.config/cabal/config
./scripts/docs/haddocks.sh
tar vzcf haddocks.tgz ./docs/website/static/haddocks
- name: Upload haddocks as an artifact
if: |
github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& matrix.ghc=='9.6.6'
uses: actions/upload-artifact@v4
with:
name: haddocks
path: haddocks.tgz
retention-days: 1

deploy-documentation:
name: Deploy documentation to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down

0 comments on commit 7ce17e8

Please sign in to comment.