forked from IntersectMBO/ouroboros-consensus
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (109 loc) · 4.43 KB
/
publish-mempool-benchmarks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
##
## Since the benchmarking code lives in `ouroboros-network`, we have to clone
## that repository and build the benchmarks before we can run them. Once we
## migrate Consensus code to this repository we will not need to perform these
## steps before running the benchmarks.
##
## Another issue with benchmarking the code from `ouroboros-network` is that we
## cannot run the benchmarks when code in that repository changes. For the time
## being we schedule a benchmark run periodically. Once we migraet Consensus
## code here, we can remove such a scheduled run.
##
# Do not run this workflow on pull requests since this workflow has permission
# to modify the contents of our github pages, which it needs to publish the
# benchmarks results.
name: Run and publish mempool benchmarks
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
# The day was somewhat arbitrarily choosen. The rationale is that we
# want to run the jobs at least once a week
concurrency:
# Define a group for this workflow, which at the moment is only used to cancel
# any worflow in progress when a new commit is pushed.
#
# See:
# - https://stackoverflow.com/a/72408109/2289983
# - https://docs.github.com/en/actions/using-jobs/using-concurrency
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
# Deployments permission to deploy GitHub pages website.
deployments: write
# Contents permission to update benchmark contents in gh-pages branch.
contents: write
jobs:
build_bench:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
cabal: ["3.10.1.0"]
ghc: ["9.2.7"]
env:
# SECP_CACHE_VERSION and SECP256K1_REF are take from cardano-node
# Modify this value to "invalidate" the secp cache.
SECP_CACHE_VERSION: "2022-12-30"
# current ref from: 27.02.2022
SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a
steps:
- uses: actions/checkout@v3
- name: Install Haskell
uses: input-output-hk/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: "Linux: Install build environment (apt-get)"
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get -y install libsodium-dev
- name: "Linux: Install build environment (for secp256k1)"
if: runner.os == 'Linux'
run: sudo apt-get -y install autoconf automake libtool
- name: Install secp256k1
uses: input-output-hk/setup-secp256k1@v1
with:
git-ref: ${{ env.SECP256K1_REF }}
cache-version: ${{ env.SECP_CACHE_VERSION }}
- name: Create a cabal.project.local file
run: |
# We need this option to make cardano-crypto-praos use the libsodium
# library we installed in this system (and not the IOG fork).
echo 'package cardano-crypto-praos' >> ouroboros-network/cabal.project.local
echo ' flags: -external-libsodium-vrf' >> ouroboros-network/cabal.project.local
- name: Cabal update
run: cabal update
- name: Freeze
run: cabal freeze
- uses: actions/cache@v3
name: Cache ~/.cabal/store
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
- uses: actions/cache@v3
name: "Cache `dist-newstyle`"
with:
path: |
dist-newstyle
!dist-newstyle/**/.git
key: cache-dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
- name: Install dependencies
run: cabal build ouroboros-consensus-test:bench-mempool --only-dependencies
- name: Run benchmarks
run: |
cabal new-run ouroboros-consensus-test:bench-mempool -- --timeout=60
cat mempool-benchmarks.json
- name: Mempool bench
uses: benchmark-action/github-action-benchmark@v1
with:
name: Mempool
tool: 'customSmallerIsBetter'
output-file-path: mempool-benchmarks.json
# Access token to deploy GitHub Pages branch
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: true