Repository navigation
SRE-1172: Link a cached prebuilt AWS-LC in CI instead of compiling it every run #10010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
aef97a6
Link a cached prebuilt AWS-LC in CI instead of compiling it on every run
claude 1622773
Add a temporary workflow measuring the hash-graph compile with and wi…
claude 3e52745
Build the prebuilt AWS-LC per profile and pass action values through …
claude 6142bd4
Measure only the prebuilt AWS-LC in the temporary compile timings wor…
claude a1d7572
Build the AWS-LC prefix with AWS-LC's own CMake install
claude 0c14944
Install `bindgen-cli` through mise for the AWS-LC prefix build
claude 2c0023b
Install `bindgen-cli` only when the AWS-LC prefix has to be built
claude dfecf99
Install `bindgen-cli` with the CI tools and trim the AWS-LC CMake opt…
claude e295b36
Add a temporary workflow reporting the install-tools state
claude 5bb4504
Report the AWS-LC prefix build output from the temporary debug workflow
claude dcfac60
Pass the resolved `bindgen` binary to the AWS-LC CMake build
claude d84296d
Skip the prebuilt AWS-LC on checkouts that lack its action
claude 413f378
Key the AWS-LC cache on `cargo pkgid` and build from cargo's crate so…
claude 200a7b0
Remove the unused AWS-LC cache key script
claude 14a0490
Key the AWS-LC cache on the runner image and harden the prefix build
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| [tools] | ||
| "cargo:bindgen-cli" = "0.72.1" | ||
| "cargo:clippy-sarif" = "0.8.0" | ||
| "cargo:sarif-fmt" = "0.8.0" | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Install AWS-LC | ||
| description: Restores a prebuilt AWS-LC from the Actions cache, building it on a miss, and makes `aws-lc-sys` link it instead of compiling AWS-LC. | ||
|
|
||
| inputs: | ||
| profile: | ||
| description: Cargo profile the job's Rust builds use, `dev` or `release`. Profiles inheriting from one of them, such as `test` or `bench`, use its value. | ||
| default: dev | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Compute AWS-LC cache key | ||
| id: key | ||
| shell: bash | ||
| env: | ||
| PROFILE: ${{ inputs.profile }} | ||
| ACTION_FILES: ${{ hashFiles('.github/actions/install-aws-lc/**', '.config/mise/config.ci.toml', '.config/mise/mise.ci.lock') }} | ||
| run: | | ||
| package=$(cargo pkgid --locked aws-lc-sys) | ||
| { | ||
| echo "key=aws-lc-sys-${package##*@}-${ImageOS:?the runner image sets no ImageOS}-$RUNNER_ARCH-$PROFILE-$ACTION_FILES" | ||
| echo "prefix=$RUNNER_TEMP/aws-lc-$PROFILE" | ||
| } >>"$GITHUB_OUTPUT" | ||
|
|
||
| - name: Restore AWS-LC | ||
| id: restore | ||
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | ||
| with: | ||
| path: ${{ steps.key.outputs.prefix }} | ||
| key: ${{ steps.key.outputs.key }} | ||
|
|
||
| - name: Build AWS-LC | ||
| if: steps.restore.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| env: | ||
| BUILD_PREFIX: ${{ github.action_path }}/build-prefix.sh | ||
| PREFIX: ${{ steps.key.outputs.prefix }} | ||
| PROFILE: ${{ inputs.profile }} | ||
| run: '"$BUILD_PREFIX" "$PREFIX" "$PROFILE"' | ||
|
|
||
| - name: Save AWS-LC | ||
| if: steps.restore.outputs.cache-hit != 'true' | ||
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | ||
| with: | ||
| path: ${{ steps.key.outputs.prefix }} | ||
| key: ${{ steps.key.outputs.key }} | ||
|
|
||
| - name: Link AWS-LC from the prefix | ||
| shell: bash | ||
| env: | ||
| PREFIX: ${{ steps.key.outputs.prefix }} | ||
| run: | | ||
| target=$(rustc -vV | sed -n 's/^host: //p' | tr '-' '_') | ||
| { | ||
| echo "AWS_LC_SYS_SYSTEM_DIR_${target}=$PREFIX" | ||
| echo "AWS_LC_SYS_STATIC_${target}=1" | ||
| } >>"$GITHUB_ENV" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/usr/bin/env bash | ||
| # Usage: build-prefix.sh <prefix> <dev|release> | ||
| # | ||
| # Builds the AWS-LC source bundled in the locked `aws-lc-sys` crate with AWS-LC's own CMake build, | ||
| # and installs the static library, headers and generated Rust bindings into <prefix>, which | ||
| # `aws-lc-sys` links when `AWS_LC_SYS_SYSTEM_DIR` points at it. | ||
| set -euo pipefail | ||
|
|
||
| prefix=$1 | ||
| profile=$2 | ||
|
|
||
| case $profile in | ||
| dev) build_type=Debug ;; | ||
| release) build_type=Release ;; | ||
| *) | ||
| echo "::error::unknown profile \`$profile\`, expected \`dev\` or \`release\`" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| if ! metadata=$(cargo metadata --locked --format-version 1); then | ||
| echo "::error::\`cargo metadata --locked\` failed" | ||
| exit 1 | ||
| fi | ||
| if ! manifest=$(jq --raw-output --exit-status '.packages[] | select(.name == "aws-lc-sys") | .manifest_path' <<<"$metadata"); then | ||
| echo "::error::\`cargo metadata\` lists no aws-lc-sys package" | ||
| exit 1 | ||
| fi | ||
| crate=$(dirname "$manifest") | ||
| version=$(cargo pkgid --locked aws-lc-sys) | ||
| version=${version##*@} | ||
|
|
||
| # CMake runs bindgen outside the repository, where the mise shim cannot resolve a version. | ||
| if ! bindgen=$(mise which bindgen); then | ||
| echo "::error::\`mise which bindgen\` failed, \`mise install --env ci\` should provide \`bindgen-cli\`" | ||
| exit 1 | ||
| fi | ||
|
|
||
| work=$(mktemp -d) | ||
| trap 'rm -rf "$work"' EXIT | ||
| rm -rf "$prefix" | ||
|
|
||
| # The crate ships AWS-LC with pregenerated assembly and its symbol-prefix headers, so the build | ||
| # needs neither Go nor Perl, and keeps the prefix the crate's own bindings use. The source is | ||
| # cargo's registry copy, which the build must leave unmodified. | ||
| cmake -S "$crate/aws-lc" -B "$work" \ | ||
| -DCMAKE_BUILD_TYPE="$build_type" \ | ||
| -DCMAKE_INSTALL_PREFIX="$prefix" \ | ||
| -DBUILD_LIBSSL=OFF \ | ||
| -DBUILD_TESTING=OFF \ | ||
| -DBUILD_TOOL=OFF \ | ||
| -DDISABLE_GO=ON \ | ||
| -DDISABLE_PERL=ON \ | ||
| -DENABLE_SOURCE_MODIFICATION=OFF \ | ||
| -DBORINGSSL_PREFIX="aws_lc_${version//./_}" \ | ||
| -DBORINGSSL_PREFIX_HEADERS="$crate/generated-include" \ | ||
| -DGENERATE_RUST_BINDINGS=ON \ | ||
| -DBINDGEN_EXECUTABLE="$bindgen" | ||
| cmake --build "$work" --parallel "$(nproc)" | ||
| cmake --install "$work" | ||
|
|
||
| echo "::notice::Built the $profile AWS-LC prefix for aws-lc-sys $version on ${ImageOS:-an unknown image} in ${SECONDS}s" |
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.