File: benchmarks.yml

package info (click to toggle)
c4core 0.2.7-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 5,184 kB
  • sloc: cpp: 35,521; python: 2,786; javascript: 414; makefile: 6
file content (200 lines) | stat: -rw-r--r-- 6,429 bytes parent folder | download
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# DO NOT EDIT - GENERATED FROM .github/workflows-in/benchmarks.ys

name: benchmarks
defaults:
  run:
    shell: bash -e -x {0}
'on':
  workflow_dispatch: null
  push:
    branches:
    - master
  pull_request:
    branches:
    - master
env:
  PROJ_PKG_NAME: c4core-
  PROJ_PFX_TARGET: c4core-
  PROJ_PFX_CMAKE: C4CORE_
  CMAKE_FLAGS: null
  NUM_JOBS_BUILD: null
jobs:
  gettag:
    runs-on: ubuntu-latest
    steps:
    - name: checkout (action)
      uses: actions/checkout@v4
      with:
        submodules: recursive
        fetch-depth: 0
    - name: Variables (from tag)
      if: contains(github.ref, 'tags/v')
      run: |
        set -exo pipefail
        # https://github.community/t/how-to-get-just-the-tag-name/16241/11
        SRC_TAG=${GITHUB_REF#refs/tags/}
        SRC_VERSION=${GITHUB_REF#refs/tags/v}
        SRC_VERSION_BODY=`pwd`/changelog/$SRC_VERSION.md
        if [ ! -f $SRC_VERSION_BODY ] ; then
          echo "version body file was not found: $SRC_VERSION_BODY"
          exit 1
        fi
        cat <<EOF >> vars.sh
        export SRC_TAG=$SRC_TAG
        export SRC_VERSION=$SRC_VERSION
        export SRC_VERSION_BODY=$SRC_VERSION_BODY
        EOF
    - name: Variables (from commit, no tag)
      if: ${{ !contains(github.ref, 'tags/v') }}
      run: |
        set -exo pipefail
        branch_name=${GITHUB_REF#refs/heads/}
        # builds triggered from PRs have the branch_name like this: refs/pull/150/merge
        # so filter to eg pr0150_merge
        branch_name=`echo $branch_name | sed "s:refs/pull/\([0-9]*\)/\(.*\):pr0\1_\2:"`
        # sanitize the branch name; eg merge/foo-bar -> merge_foo_bar
        branch_name=`echo $branch_name | sed 's:[/.-]:_:g'`
        SRC_TAG=$(git describe || git rev-parse --short HEAD)  # eg v0.2.0-110-gda837e0
        SRC_VERSION="${branch_name}-${SRC_TAG}"
        cat <<EOF > vars.sh
        export SRC_TAG=$SRC_TAG
        export SRC_VERSION=$SRC_VERSION
        EOF
    - name: Save vars.sh
      uses: actions/upload-artifact@v4
      with:
        name: vars.sh
        path: ./vars.sh
    - name: Show vars.sh
      run: cat vars.sh
    - name: Source vars.sh
      run: source vars.sh
    - name: Env (common)
      run: |
        source vars.sh
        echo "SRC_TAG=$SRC_TAG" >> $GITHUB_ENV
        echo "SRC_VERSION=$SRC_VERSION" >> $GITHUB_ENV
    - name: Env (from tag)
      if: contains(github.ref, 'tags/v')
      run: |
        source vars.sh
        echo "SRC_VERSION_BODY=$SRC_VERSION_BODY" >> $GITHUB_ENV
    - name: Variables (from commit, no tag)
      if: ${{ !contains(github.ref, 'tags/v') }}
      run: echo 'nothing to do'
    - name: Verify vars.sh
      run: env | grep SRC
  x64:
    name: bm/x64/${{matrix.comp}}/${{matrix.bt}}
    needs: gettag
    if: always()
    continue-on-error: false
    runs-on: ${{matrix.os}}
    strategy:
      fail-fast: false
      matrix:
        include:
        - std: 17
          comp: gcc14
          os: ubuntu-24.04
          cmkflags: -DCMAKE_CXX_COMPILER=g++-14     -DCMAKE_C_COMPILER=gcc-14
        - std: 17
          comp: clang18
          os: ubuntu-24.04
          cmkflags: -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18
        - std: 17
          comp: vs2022
          os: windows-2022
          cmkflags: -G 'Visual Studio 17 2022' -A x64
        - std: 17
          comp: xcode15
          os: macos-13
          xcver: 15
          cmkflags: -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64
    env:
      BM: 'ON'
      STD: ${{matrix.std}}
      CXX_: ${{matrix.cxx}}
      BT: ${{matrix.bt}}
      BITLINKS: ${{matrix.bitlinks}}
      VG: ${{matrix.vg}}
      SAN: ${{matrix.san}}
      LINT: ${{matrix.lint}}
      OS: ${{matrix.os}}
    steps:
    - name: checkout (action)
      uses: actions/checkout@v4
      with:
        submodules: recursive
        fetch-depth: 0
    - name: Download vars.sh
      uses: actions/download-artifact@v4
      with:
        name: vars.sh
        path: ./
    - name: Show vars.sh
      run: cat vars.sh
    - name: Source vars.sh
      run: source vars.sh
    - name: Env (common)
      run: |
        source vars.sh
        echo "SRC_TAG=$SRC_TAG" >> $GITHUB_ENV
        echo "SRC_VERSION=$SRC_VERSION" >> $GITHUB_ENV
    - name: Env (from tag)
      if: contains(github.ref, 'tags/v')
      run: |
        source vars.sh
        echo "SRC_VERSION_BODY=$SRC_VERSION_BODY" >> $GITHUB_ENV
    - name: Variables (from commit, no tag)
      if: ${{ !contains(github.ref, 'tags/v') }}
      run: echo 'nothing to do'
    - name: Verify vars.sh
      run: env | grep SRC
    - name: install requirements
      run: source .github/reqs.sh && c4_install_test_requirements $OS
    - name: show info
      run: source .github/setenv.sh && c4_show_info
    - name: Install python 3.10 for plotting
      uses: actions/setup-python@v5
      with:
        python-version: '3.10'
    - name: install benchmark plotting dependencies
      run: |
        which python
        which pip
        python --version
        pip --version
        pip install -v -r cmake/bm-xp/requirements.txt
        python -c 'import munch ; print("ok!") ; exit(0)'
        echo $?
    - name: configure-------------------------------------------------
      run: |
        cmake -S . -B build \
            ${{matrix.cmkflags}} \
            -DPython_EXECUTABLE="$(which python)" \
            -DC4_CXX_STANDARD=${{matrix.std}} \
            -DC4CORE_CXX_STANDARD=${{matrix.std}} \
            -DC4CORE_BUILD_BENCHMARKS=ON
    - name: build
      run: cmake --build build --config Release --parallel --verbose --target c4core-bm-build
    - name: run
      run: cmake --build build --config Release --verbose --target c4core-bm-run
    - name: plot
      run: cmake --build build --config Release --verbose --target c4core-bm-plot
    - name: gather benchmark results-------------------------------------------
      run: |
        set -x
        source vars.sh
        echo SRC_TAG=$SRC_TAG
        echo SRC_VERSION=$SRC_VERSION
        desc=$SRC_TAG
        dst=c4core-benchmark_results/$desc/x64/${{matrix.comp}}-${{matrix.bt}}
        mkdir -p $dst
        find build -name bm-results
        mv -vf build/$bl/bm/bm-results/* $dst/.
    - name: upload benchmark result artifacts
      uses: actions/upload-artifact@v4
      with:
        name: c4core-benchmark_results-x64-${{matrix.comp}}-${{matrix.bt}}
        path: c4core-benchmark_results/