|
| 1 | +# Reusable: the waste sanitizer (memory + CPU waste), REPORT-ONLY. |
| 2 | +# |
| 3 | +# What runs (scripts/memwaste.sh, memwaste-scaling.py, memwaste-ratchet.py): |
| 4 | +# mode=pr Linux: the event lane (memory waste + CPU work) indexing this |
| 5 | +# repository at the checked-out commit, and the CPU scaling lane |
| 6 | +# (src/ replicated 2x against 4x, per-function counter ratios). |
| 7 | +# mode=full the same, plus the event lane on macOS and Windows and the access |
| 8 | +# lane (read/write verdicts per allocation) on Linux. |
| 9 | +# |
| 10 | +# The corpus is the repository itself: pinned by the commit, no network, and a |
| 11 | +# real mix of C, C++, Python, JavaScript and vendored code. |
| 12 | +# |
| 13 | +# REPORT-ONLY: every job uploads its report and prints the ratchet comparison |
| 14 | +# against scripts/memwaste-baseline.json, but nothing here can turn a PR red -- |
| 15 | +# the ratchet runs without --enforce and the PR's ci-ok gate does not depend on |
| 16 | +# these jobs. A job fails only when the MEASUREMENT is unsound (a table |
| 17 | +# overflowed, frees the layer never saw): that is a defect of the tool, and a |
| 18 | +# red job is how it gets noticed. Switching the ratchet to --enforce is a |
| 19 | +# separate, deliberate change once the numbers have been stable across reruns. |
| 20 | +name: Memwaste |
| 21 | + |
| 22 | +on: |
| 23 | + workflow_call: |
| 24 | + inputs: |
| 25 | + mode: |
| 26 | + description: "pr (Linux event + scaling) or full (all platforms, access lane)" |
| 27 | + type: string |
| 28 | + default: pr |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: read |
| 32 | + |
| 33 | +jobs: |
| 34 | + event-linux: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 60 |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 39 | + - name: Install deps |
| 40 | + run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 clang llvm |
| 41 | + - name: Event lane on this repository |
| 42 | + run: | |
| 43 | + # `cmd | tee` reports TEE's status: without this a failing lane |
| 44 | + # (a missing exec bit, a build error) passes the step and only |
| 45 | + # surfaces as the ratchet not finding its JSON. |
| 46 | + set -o pipefail |
| 47 | + mkdir -p "$RUNNER_TEMP/memwaste-event" |
| 48 | + scripts/memwaste.sh "$GITHUB_WORKSPACE" --top 40 --out "$RUNNER_TEMP/memwaste-event" \ |
| 49 | + | tee "$RUNNER_TEMP/memwaste-event/report.txt" |
| 50 | + - name: Ratchet (report-only) |
| 51 | + run: python3 scripts/memwaste-ratchet.py --out "$RUNNER_TEMP/memwaste-event" --venue ${{ inputs.mode }}-linux |
| 52 | + - name: Upload report |
| 53 | + if: ${{ always() }} |
| 54 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 55 | + with: |
| 56 | + name: memwaste-event-linux-${{ inputs.mode }} |
| 57 | + path: | |
| 58 | + ${{ runner.temp }}/memwaste-event/report.txt |
| 59 | + ${{ runner.temp }}/memwaste-event/memwaste.json |
| 60 | + ${{ runner.temp }}/memwaste-event/index.json |
| 61 | + if-no-files-found: warn |
| 62 | + |
| 63 | + scaling-linux: |
| 64 | + runs-on: ubuntu-latest |
| 65 | + timeout-minutes: 60 |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 68 | + - name: Install deps |
| 69 | + run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 clang llvm |
| 70 | + - name: CPU scaling lane (src/ at 2x against 4x) |
| 71 | + # Report-only: the script exits 1 when it flags a super-linear function. |
| 72 | + continue-on-error: true |
| 73 | + run: | |
| 74 | + # `cmd | tee` reports TEE's status: without this a failing lane |
| 75 | + # (a missing exec bit, a build error) passes the step and only |
| 76 | + # surfaces as the ratchet not finding its JSON. |
| 77 | + set -o pipefail |
| 78 | + mkdir -p "$RUNNER_TEMP/memwaste-scaling" |
| 79 | + python3 scripts/memwaste-scaling.py --corpus src --replicas 2 \ |
| 80 | + --out "$RUNNER_TEMP/memwaste-scaling" | tee "$RUNNER_TEMP/memwaste-scaling/report.txt" |
| 81 | + - name: Upload report |
| 82 | + if: ${{ always() }} |
| 83 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 84 | + with: |
| 85 | + name: memwaste-scaling-linux-${{ inputs.mode }} |
| 86 | + path: ${{ runner.temp }}/memwaste-scaling/report.txt |
| 87 | + if-no-files-found: warn |
| 88 | + |
| 89 | + access-linux: |
| 90 | + if: ${{ inputs.mode == 'full' }} |
| 91 | + runs-on: ubuntu-latest |
| 92 | + timeout-minutes: 120 |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 95 | + - name: Install deps |
| 96 | + run: sudo apt-get update && sudo apt-get install -y zlib1g-dev python3 clang llvm |
| 97 | + - name: Access lane on this repository |
| 98 | + run: | |
| 99 | + # `cmd | tee` reports TEE's status: without this a failing lane |
| 100 | + # (a missing exec bit, a build error) passes the step and only |
| 101 | + # surfaces as the ratchet not finding its JSON. |
| 102 | + set -o pipefail |
| 103 | + mkdir -p "$RUNNER_TEMP/memwaste-access" |
| 104 | + scripts/memwaste.sh "$GITHUB_WORKSPACE" --lane access --top 40 --sort untouched \ |
| 105 | + --out "$RUNNER_TEMP/memwaste-access" | tee "$RUNNER_TEMP/memwaste-access/report.txt" |
| 106 | + - name: Upload report |
| 107 | + if: ${{ always() }} |
| 108 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 109 | + with: |
| 110 | + name: memwaste-access-linux-${{ inputs.mode }} |
| 111 | + path: | |
| 112 | + ${{ runner.temp }}/memwaste-access/report.txt |
| 113 | + ${{ runner.temp }}/memwaste-access/memwaste.json |
| 114 | + if-no-files-found: warn |
| 115 | + |
| 116 | + event-macos: |
| 117 | + if: ${{ inputs.mode == 'full' }} |
| 118 | + runs-on: macos-14 |
| 119 | + timeout-minutes: 60 |
| 120 | + steps: |
| 121 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 122 | + - name: Event lane on this repository |
| 123 | + run: | |
| 124 | + # `cmd | tee` reports TEE's status: without this a failing lane |
| 125 | + # (a missing exec bit, a build error) passes the step and only |
| 126 | + # surfaces as the ratchet not finding its JSON. |
| 127 | + set -o pipefail |
| 128 | + mkdir -p "$RUNNER_TEMP/memwaste-event" |
| 129 | + scripts/memwaste.sh "$GITHUB_WORKSPACE" --top 40 --out "$RUNNER_TEMP/memwaste-event" \ |
| 130 | + | tee "$RUNNER_TEMP/memwaste-event/report.txt" |
| 131 | + - name: Ratchet (report-only) |
| 132 | + run: python3 scripts/memwaste-ratchet.py --out "$RUNNER_TEMP/memwaste-event" --venue full-macos |
| 133 | + - name: Upload report |
| 134 | + if: ${{ always() }} |
| 135 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 136 | + with: |
| 137 | + name: memwaste-event-macos-${{ inputs.mode }} |
| 138 | + path: | |
| 139 | + ${{ runner.temp }}/memwaste-event/report.txt |
| 140 | + ${{ runner.temp }}/memwaste-event/memwaste.json |
| 141 | + if-no-files-found: warn |
| 142 | + |
| 143 | + event-windows: |
| 144 | + if: ${{ inputs.mode == 'full' }} |
| 145 | + runs-on: windows-latest |
| 146 | + timeout-minutes: 90 |
| 147 | + steps: |
| 148 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 149 | + - uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2 |
| 150 | + with: |
| 151 | + msystem: CLANG64 |
| 152 | + path-type: inherit |
| 153 | + install: >- |
| 154 | + mingw-w64-clang-x86_64-clang |
| 155 | + mingw-w64-clang-x86_64-llvm |
| 156 | + mingw-w64-clang-x86_64-zlib |
| 157 | + mingw-w64-clang-x86_64-python3 |
| 158 | + make |
| 159 | + git |
| 160 | + coreutils |
| 161 | + - name: Event lane on this repository |
| 162 | + shell: msys2 {0} |
| 163 | + run: | |
| 164 | + # `cmd | tee` reports TEE's status: without this a failing lane |
| 165 | + # (a missing exec bit, a build error) passes the step and only |
| 166 | + # surfaces as the ratchet not finding its JSON. |
| 167 | + set -o pipefail |
| 168 | + out="$(cygpath -u "$RUNNER_TEMP")/memwaste-event" |
| 169 | + mkdir -p "$out" |
| 170 | + CC=clang CXX=clang++ scripts/memwaste.sh "$(cygpath -u "$GITHUB_WORKSPACE")" --top 40 --out "$out" \ |
| 171 | + | tee "$out/report.txt" |
| 172 | + - name: Ratchet (report-only) |
| 173 | + shell: msys2 {0} |
| 174 | + run: python3 scripts/memwaste-ratchet.py --out "$(cygpath -u "$RUNNER_TEMP")/memwaste-event" --venue full-windows |
| 175 | + - name: Upload report |
| 176 | + if: ${{ always() }} |
| 177 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 178 | + with: |
| 179 | + name: memwaste-event-windows-${{ inputs.mode }} |
| 180 | + path: | |
| 181 | + ${{ runner.temp }}/memwaste-event/report.txt |
| 182 | + ${{ runner.temp }}/memwaste-event/memwaste.json |
| 183 | + if-no-files-found: warn |
0 commit comments