Repository navigation
[temp][do not merge] probe: the time of the trees suite's commands #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # THE PROBE (temporary; this branch is never merged). How long the commands of the | |
| # trees suite (tests/e2e/openkal/trees.cpp) take on the runner the CI uses, and where | |
| # the time goes: trees/955 alone, cold and then warm, and the CI's shard 2/4 as it | |
| # runs there, each twice. Every mcpp command the e2e kit runs is recorded by | |
| # .github/probe/mcpp-timed.sh (wall time, the CPU of its process tree, the ninja logs | |
| # of its builds); the machine's load is sampled every 5 s; mtest's own report of the | |
| # run is kept. The kit's per-command limit is 60 minutes on this branch, so a | |
| # command's whole duration is measured. The data goes to the draft release | |
| # `probe-data`, one asset per job. | |
| name: probe-trees | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| actions: write | |
| concurrency: | |
| group: probe-trees-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # The third round measures trees/955 alone only. The mcpp and the test archive are | |
| # those of the second round's run (44723402028): its sources are this commit's, the | |
| # workflow alone differs, so they are not built again. | |
| measure: | |
| name: trees ${{ matrix.cond }} ${{ matrix.id }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Round 1 measured shard 2/4 twice, round 2 the shards 1/4, 3/4 and 4/4. | |
| include: | |
| - { cond: alone, id: '1' } | |
| - { cond: alone, id: '2' } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/bootstrap-mcpp | |
| - name: The second round's mcpp | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mcpp-built-linux-x86_64 | |
| path: ${{ runner.temp }}/mcpp-built | |
| run-id: 44723402028 | |
| github-token: ${{ github.token }} | |
| - name: Use it | |
| shell: bash | |
| run: bash .github/actions/use-built-mcpp/use.sh linux-x86_64 GLOBAL | |
| - name: The second round's tests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mcpp-unit-linux-x86_64 | |
| path: ${{ runner.temp }}/unit | |
| run-id: 44723402028 | |
| github-token: ${{ github.token }} | |
| - name: The program under test and the probe's recorder | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| P="$RUNNER_TEMP/probe" | |
| mkdir -p "$P/bin" | |
| sed -e "s|@REAL@|$MCPP|" -e "s|@DIR@|$P|" .github/probe/mcpp-timed.sh > "$P/bin/mcpp" | |
| chmod +x "$P/bin/mcpp" | |
| { | |
| echo "MCPP_VENDORED_XLINGS=$XLINGS_BIN" | |
| echo "MCPP_BIN_MCPP=$MCPP" | |
| echo "PROBE_DIR=$P" | |
| echo "MCPP_E2E_MCPP=$P/bin/mcpp" | |
| } >> "$GITHUB_ENV" | |
| { nproc; lscpu; free -m; df -h /; } > "$P/machine.txt" 2>&1 | |
| cat "$P/machine.txt" | |
| nohup vmstat -t 5 > "$P/vmstat.txt" 2>&1 & | |
| - name: The history the shards share | |
| shell: bash | |
| run: | | |
| rm -rf -- "$GITHUB_WORKSPACE/target/mtest" | |
| python3 .github/tools/test_history.py take target/mtest "$RUNNER_TEMP/unit/history" | |
| - name: "alone: trees/955, cold and then warm" | |
| if: matrix.cond == 'alone' | |
| shell: bash | |
| run: | | |
| set -uo pipefail | |
| # The archive's program is `e2e/openkal`; `e2e/openkal/trees` is a part of it, | |
| # and an archive run selects by the program's name only (round 2: "no test ... | |
| # ran"). The case is named whole: a pattern with `*` under the listed case | |
| # `trees` selects all of `trees`. | |
| for phase in cold warm; do | |
| echo "$phase" > "$PROBE_DIR/phase" | |
| echo "== $phase $(date -u +%T)" | |
| "$MCPP" test --timeout 0 --archive "$RUNNER_TEMP/unit/unit.tar.gz" e2e/openkal \ | |
| --case 'trees/955 the openkal set is one tree of every architecture' \ | |
| || echo "::warning::the $phase pass ended with $?" | |
| done | |
| - name: "shard: one of the CI's four shards" | |
| if: matrix.cond == 'shard' | |
| continue-on-error: true | |
| uses: ./.github/actions/mcpp-unit | |
| with: | |
| name: probe-${{ matrix.id }} | |
| archive: ${{ runner.temp }}/unit/unit.tar.gz | |
| shard: ${{ matrix.shard }} | |
| - name: The analysis | |
| if: always() | |
| shell: bash | |
| run: python3 -I .github/probe/analyze_trees.py "$PROBE_DIR" "${{ matrix.cond }} ${{ matrix.id }}" | tee -a "$GITHUB_STEP_SUMMARY" | |
| - uses: ./.github/actions/mtest | |
| if: always() | |
| - name: mtest's own account of the run | |
| if: always() | |
| shell: bash | |
| run: | | |
| set +e | |
| job="$RUNNER_TEMP/mtest-job" | |
| mkdir -p "$job" | |
| (cd "$job" && "$MTEST" store import --from "$GITHUB_WORKSPACE/target/mtest") | |
| (cd "$job" && "$MTEST" report --format md --sections summary,slowest,resources,path,gantt) > "$PROBE_DIR/mtest-report.md" 2>&1 | |
| (cd "$job" && "$MTEST" analyze durations) > "$PROBE_DIR/mtest-durations.txt" 2>&1 | |
| (cd "$job" && "$MTEST" analyze path) > "$PROBE_DIR/mtest-path.txt" 2>&1 | |
| cat "$PROBE_DIR/mtest-report.md" >> "$GITHUB_STEP_SUMMARY" | |
| head -80 "$PROBE_DIR/mtest-durations.txt" | |
| head -80 "$PROBE_DIR/mtest-path.txt" | |
| cp "${MCPP_HOME:-$HOME/.mcpp}/log/mcpp.log" "$PROBE_DIR/mcpp.log" 2>/dev/null | |
| cp -r "$job/.mtest" "$PROBE_DIR/mtest-store" 2>/dev/null | |
| exit 0 | |
| - name: The data, to the probe's draft release | |
| if: always() | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| pkill vmstat || true | |
| a="$RUNNER_TEMP/trees-${{ matrix.cond }}-${{ matrix.id }}.tar.gz" | |
| tar -czf "$a" -C "$PROBE_DIR" . | |
| ls -la "$a" | |
| gh release view probe-data -R "$GITHUB_REPOSITORY" > /dev/null 2>&1 \ | |
| || gh release create probe-data -R "$GITHUB_REPOSITORY" --draft --title "probe data" \ | |
| --notes "Data that temporary probe pull requests upload for local analysis; each upload replaces its asset." \ | |
| || true | |
| gh release upload probe-data "$a" -R "$GITHUB_REPOSITORY" --clobber |