|
| 1 | +name: xz benchmark (compression level + all cores) |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'try/ci/xz_testing' |
| 6 | + |
| 7 | +permissions: |
| 8 | + # Downloading another run's artifact. |
| 9 | + actions: read |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + source: |
| 14 | + name: Find source artifact |
| 15 | + runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 5 |
| 17 | + outputs: |
| 18 | + id: ${{ steps.find.outputs.id }} |
| 19 | + steps: |
| 20 | + - id: find |
| 21 | + env: |
| 22 | + GH_TOKEN: ${{ github.token }} |
| 23 | + run: | |
| 24 | + ID=$( gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=jetpack-build.tar.xz&per_page=100" --jq '[ .artifacts[] | select( .expired == false and .workflow_run.head_branch == "trunk" ) ][0].id' ) |
| 25 | + [[ -n "$ID" && "$ID" != null ]] || { echo "::error::No unexpired trunk jetpack-build.tar.xz found."; exit 1; } |
| 26 | + echo "id=$ID" >> "$GITHUB_OUTPUT" |
| 27 | +
|
| 28 | + bench: |
| 29 | + name: ${{ matrix.variant }} ${{ matrix.iteration }} |
| 30 | + runs-on: ubuntu-latest |
| 31 | + needs: source |
| 32 | + timeout-minutes: 15 |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + iteration: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] |
| 37 | + variant: [ level-3-all-cores ] |
| 38 | + include: |
| 39 | + - variant: level-3-all-cores |
| 40 | + xz_opt: -3 -T0 |
| 41 | + tar_flags: -vv |
| 42 | + env: |
| 43 | + BUILD_BASE: ${{ github.workspace }}/build |
| 44 | + steps: |
| 45 | + - name: Download and extract source build |
| 46 | + env: |
| 47 | + GH_TOKEN: ${{ github.token }} |
| 48 | + ID: ${{ needs.source.outputs.id }} |
| 49 | + run: | |
| 50 | + gh api "repos/$GITHUB_REPOSITORY/actions/artifacts/$ID/zip" > source.tar.xz |
| 51 | + tar --xz -xf source.tar.xz build |
| 52 | + rm source.tar.xz |
| 53 | +
|
| 54 | + - name: Create archive |
| 55 | + env: |
| 56 | + XZ_OPT: ${{ matrix.xz_opt }} |
| 57 | + TAR_FLAGS: ${{ matrix.tar_flags }} |
| 58 | + run: | |
| 59 | + START=$EPOCHREALTIME |
| 60 | + # shellcheck disable=SC2086 |
| 61 | + tar --owner=0 --group=0 --xz -c $TAR_FLAGS -f jetpack-build.tar.xz -C "$BUILD_BASE" --transform 's,^\.,build,' . |
| 62 | + echo "CREATE=$( awk -v s="$START" -v e="$EPOCHREALTIME" 'BEGIN { printf "%.3f", e - s }' )" >> "$GITHUB_ENV" |
| 63 | + echo "SIZE=$( stat -c %s jetpack-build.tar.xz )" >> "$GITHUB_ENV" |
| 64 | +
|
| 65 | + - name: Extract archive |
| 66 | + env: |
| 67 | + XZ_OPT: ${{ matrix.xz_opt }} |
| 68 | + TAR_FLAGS: ${{ matrix.tar_flags }} |
| 69 | + run: | |
| 70 | + mkdir extracted |
| 71 | + START=$EPOCHREALTIME |
| 72 | + # shellcheck disable=SC2086 |
| 73 | + tar --xz -x $TAR_FLAGS -f jetpack-build.tar.xz -C extracted build |
| 74 | + echo "EXTRACT=$( awk -v s="$START" -v e="$EPOCHREALTIME" 'BEGIN { printf "%.3f", e - s }' )" >> "$GITHUB_ENV" |
| 75 | +
|
| 76 | + - name: Record timing |
| 77 | + env: |
| 78 | + VARIANT: ${{ matrix.variant }} |
| 79 | + ITERATION: ${{ matrix.iteration }} |
| 80 | + run: | |
| 81 | + jq -n --arg variant "$VARIANT" --argjson iteration "$ITERATION" --argjson create "$CREATE" --argjson extract "$EXTRACT" --argjson size "$SIZE" \ |
| 82 | + '{ $variant, $iteration, $create, $extract, $size }' |
0 commit comments