|
| 1 | +name: Binary size with bloaty |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + bloat: |
| 7 | + if: >- |
| 8 | + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && |
| 9 | + ! contains(toJSON(github.event.commits.*.message), '[skip github]') |
| 10 | + runs-on: ubuntu-20.04 |
| 11 | + env: |
| 12 | + cmakeflags: '-DCMAKE_BUILD_TYPE=Release -DSIMDJSON_BUILD_STATIC=On -DSIMDJSON_JUST_LIBRARY=On' |
| 13 | + steps: |
| 14 | + - name: Setup cmake |
| 15 | + uses: jwlawson/actions-setup-cmake@v1.4 |
| 16 | + with: |
| 17 | + cmake-version: '3.16.x' |
| 18 | + |
| 19 | + - name: Fetch head |
| 20 | + uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + path: 'source-head' |
| 23 | + |
| 24 | + - uses: actions/cache@v2 |
| 25 | + with: |
| 26 | + path: source-head/dependencies/.cache |
| 27 | + key: ${{ hashFiles('source-head/dependencies/CMakeLists.txt') }} |
| 28 | + |
| 29 | + - name: Compile static lib for head ref |
| 30 | + run: | |
| 31 | + cmake -S source-head -B build-head ${{env.cmakeflags}} -DCMAKE_INSTALL_PREFIX=install-head |
| 32 | + cmake --build build-head --target install |
| 33 | + - name: Bloat analysis - absolute values |
| 34 | + id: absolute |
| 35 | + uses: pauldreik/bloaty-analyze@v1.0.1 |
| 36 | + with: # see https://github.com/marketplace/actions/bloaty-analyze for explanations what these do |
| 37 | + file: install-head/lib/libsimdjson.a |
| 38 | + rows: 0 |
| 39 | + resultsfile: 'bloaty-sizes.txt' |
| 40 | + - name: Fetch base |
| 41 | + if: ${{ github.event_name == 'pull_request' }} |
| 42 | + uses: actions/checkout@v2 |
| 43 | + with: |
| 44 | + ref: ${{ github.base_ref }} |
| 45 | + path: 'source-base' |
| 46 | + |
| 47 | + - uses: actions/cache@v2 |
| 48 | + with: |
| 49 | + path: source-base/dependencies/.cache |
| 50 | + key: ${{ hashFiles('source-base/dependencies/CMakeLists.txt') }} |
| 51 | + |
| 52 | + - name: Compile static lib for base ref |
| 53 | + if: ${{ github.event_name == 'pull_request' }} |
| 54 | + run: | |
| 55 | + cmake -S source-base -B build-base ${{env.cmakeflags}} -DCMAKE_INSTALL_PREFIX=install-base |
| 56 | + cmake --build build-base --target install |
| 57 | + - name: Bloat analysis - diff |
| 58 | + id: diff |
| 59 | + uses: pauldreik/bloaty-analyze@v1.0.1 |
| 60 | + if: ${{ github.event_name == 'pull_request' }} |
| 61 | + with: # see https://github.com/marketplace/actions/bloaty-analyze for explanations what these do |
| 62 | + file: install-head/lib/libsimdjson.a |
| 63 | + base-file: install-base/lib/libsimdjson.a |
| 64 | + rows: 0 |
| 65 | + resultsfile: 'bloaty-diff.txt' |
| 66 | + - uses: actions/upload-artifact@v2 |
| 67 | + with: |
| 68 | + name: bloaty |
| 69 | + path: bloaty-*.txt |
| 70 | + if-no-files-found: error |
| 71 | + |
0 commit comments