-
Notifications
You must be signed in to change notification settings - Fork 385
feat: Modular crypto #1292
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
base: main
Are you sure you want to change the base?
feat: Modular crypto #1292
Changes from 23 commits
c54bb81
95c613f
c29dd0e
d94eee3
00ae1b4
a642718
18d810b
0b44c08
dd7330a
241e108
9c8f534
43e4e58
cb01384
a59d2ab
7a3b6fa
0cdb19c
5aa5473
1246c11
7656725
003563f
476ace9
5eef3b6
db9db46
1602691
ce0d72a
80850f5
322f76d
b5cf8f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,31 +14,45 @@ | ||||||||||||||||||||||
| toolchain: | |||||||||||||||||||||||
| required: true | |||||||||||||||||||||||
| type: string | |||||||||||||||||||||||
| tls_feature: | |||||||||||||||||||||||
| required: false | |||||||||||||||||||||||
| type: string | |||||||||||||||||||||||
| default: "tls-ring" | |||||||||||||||||||||||
|
|
|||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||
| build: | |||||||||||||||||||||||
| name: ${{ inputs.arch }}-${{ inputs.platform }} | |||||||||||||||||||||||
| name: ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.tls_feature }} | |||||||||||||||||||||||
| runs-on: ${{ inputs.os }} | |||||||||||||||||||||||
| steps: | |||||||||||||||||||||||
| - name: Checkout | |||||||||||||||||||||||
| uses: actions/checkout@v6 | |||||||||||||||||||||||
| - name: Setup Rust | |||||||||||||||||||||||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |||||||||||||||||||||||
| with: | |||||||||||||||||||||||
| toolchain: ${{ inputs.toolchain }} | |||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then add here: - name: Map crypto feature to TLS and crypto features
id: features
shell: bash
run: |
case "${{ inputs.crypto }}" in
graviola)
echo "tls_feature=tls-graviola" >> $GITHUB_OUTPUT
echo "crypto_feature=crypto-graviola" >> $GITHUB_OUTPUT
;;
ring)
echo "tls_feature=tls-ring" >> $GITHUB_OUTPUT
echo "crypto_feature=crypto-ring" >> $GITHUB_OUTPUT
;;
openssl)
echo "tls_feature=tls-openssl" >> $GITHUB_OUTPUT
echo "crypto_feature=crypto-openssl" >> $GITHUB_OUTPUT
;;
aws-lc)
echo "tls_feature=tls-aws-lc" >> $GITHUB_OUTPUT
echo "crypto_feature=crypto-ring" >> $GITHUB_OUTPUT
;;
*)
echo "Unknown crypto feature: ${{ inputs.crypto }}"
exit 1
;;
esacYou can add other cases if you want to mix and match |
|||||||||||||||||||||||
| - name: Run build crates | |||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then replace the following with - name: Run build crates
shell: bash
env:
RUSTFLAGS: ""
TLS_FEATURE: ${{ steps.features.outputs.tls_feature }}
CRYPTO_FEATURE: ${{ steps.features.outputs.crypto_feature }}
run: |
crates=$(cargo metadata --no-deps --format-version 1 --quiet | jq -r '.packages[] | select(.manifest_path | contains("modules/")) | .name')
for crate in $crates; do
echo "Compiling crate: $crate"
# Use TLS feature for crates that need TLS, with --no-default-features to avoid conflicts
if [ "$crate" = "llrt_fetch" ] || [ "$crate" = "llrt_http" ]; then
cargo build -p "$crate" --no-default-features --features "http1,http2,webpki-roots,compression-rust,$TLS_FEATURE"
elif [ "$crate" = "llrt_crypto" ]; then
cargo build -p "$crate" --no-default-features --features "$CRYPTO_FEATURE"
else
cargo build -p "$crate"
fi
done
- name: Run build all
env:
TLS_FEATURE: ${{ steps.features.outputs.tls_feature }}
CRYPTO_FEATURE: ${{ steps.features.outputs.crypto_feature }}
run: |
cargo build -p llrt_modules --no-default-features --features "base,$TLS_FEATURE,$CRYPTO_FEATURE"
- name: Run tests all
env:
TLS_FEATURE: ${{ steps.features.outputs.tls_feature }}
CRYPTO_FEATURE: ${{ steps.features.outputs.crypto_feature }}
run: |
cargo test -p llrt_modules --no-default-features --features "base,$TLS_FEATURE,$CRYPTO_FEATURE"
|
|||||||||||||||||||||||
| shell: bash | |||||||||||||||||||||||
| env: | |||||||||||||||||||||||
| RUSTFLAGS: "" | |||||||||||||||||||||||
| TLS_FEATURE: ${{ inputs.tls_feature }} | |||||||||||||||||||||||
| run: | | |||||||||||||||||||||||
| crates=$(cargo metadata --no-deps --format-version 1 --quiet | jq -r '.packages[] | select(.manifest_path | contains("modules/")) | .name') | |||||||||||||||||||||||
| for crate in $crates; do | |||||||||||||||||||||||
| echo "Compiling crate: $crate" | |||||||||||||||||||||||
| cargo build -p "$crate" | |||||||||||||||||||||||
| # Use TLS feature for crates that need TLS, with --no-default-features to avoid conflicts | |||||||||||||||||||||||
| if [ "$crate" = "llrt_fetch" ] || [ "$crate" = "llrt_http" ]; then | |||||||||||||||||||||||
| cargo build -p "$crate" --no-default-features --features "http1,http2,webpki-roots,$TLS_FEATURE" | |||||||||||||||||||||||
| else | |||||||||||||||||||||||
| cargo build -p "$crate" | |||||||||||||||||||||||
| fi | |||||||||||||||||||||||
| done | |||||||||||||||||||||||
| - name: Run build all | |||||||||||||||||||||||
| env: | |||||||||||||||||||||||
| TLS_FEATURE: ${{ inputs.tls_feature }} | |||||||||||||||||||||||
| run: | | |||||||||||||||||||||||
| cargo build -p llrt_modules | |||||||||||||||||||||||
| cargo build -p llrt_modules --no-default-features --features "base,$TLS_FEATURE" | |||||||||||||||||||||||
| - name: Run tests all | |||||||||||||||||||||||
| env: | |||||||||||||||||||||||
| TLS_FEATURE: ${{ inputs.tls_feature }} | |||||||||||||||||||||||
| run: | | |||||||||||||||||||||||
| cargo test -p llrt_modules | |||||||||||||||||||||||
| cargo test -p llrt_modules --no-default-features --features "base,$TLS_FEATURE" | |||||||||||||||||||||||
|
|||||||||||||||||||||||
| @@ -1,4 +1,6 @@ | ||
| name: Setup, Build & Test modules | ||
| permissions: | ||
| contents: read | ||
| on: | ||
| workflow_call: | ||
| inputs: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,13 +29,60 @@ jobs: | |
| for i in {1..5}; do | ||
| echo "console.log(123);" > "bundle/js/test$i.js" | ||
| done | ||
| cargo clippy --all-targets --all-features -- -D warnings | ||
| cargo clippy --all-targets --features "lambda,macro,no-sdk,uncompressed,crypto-rust,tls-ring,openssl-vendored" -- -D warnings | ||
|
|
||
| build: | ||
| needs: | ||
| - check | ||
| strategy: | ||
| fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
| matrix: | ||
| os: | ||
| - windows-latest | ||
| - ubuntu-latest | ||
| - ubuntu-24.04-arm | ||
| - macos-latest | ||
| crypto: | ||
| - name: default | ||
| features: "" | ||
| - name: crypto-rust+tls-ring | ||
| features: "--no-default-features --features crypto-rust,tls-ring,macro" | ||
| - name: crypto-rust+tls-aws-lc | ||
| features: "--no-default-features --features crypto-rust,tls-aws-lc,macro" | ||
| - name: crypto-ring+tls-ring | ||
| features: "--no-default-features --features crypto-ring,tls-ring,macro" | ||
| - name: crypto-ring-rust+tls-ring | ||
| features: "--no-default-features --features crypto-ring-rust,tls-ring,macro" | ||
| - name: crypto-graviola+tls-graviola | ||
| features: "--no-default-features --features crypto-graviola,tls-graviola,macro" | ||
| - name: crypto-graviola-rust+tls-graviola | ||
| features: "--no-default-features --features crypto-graviola-rust,tls-graviola,macro" | ||
| - name: crypto-openssl+tls-openssl | ||
| features: "--no-default-features --features crypto-openssl,tls-openssl,macro" | ||
| exclude: | ||
| # OpenSSL requires native compilation - exclude from cross-compile targets | ||
| - os: ubuntu-latest | ||
| crypto: | ||
| name: crypto-openssl+tls-openssl | ||
| - os: ubuntu-24.04-arm | ||
| crypto: | ||
| name: crypto-openssl+tls-openssl | ||
| - os: windows-latest | ||
| crypto: | ||
| name: crypto-openssl+tls-openssl | ||
| # Graviola only supports aarch64 | ||
| - os: ubuntu-latest | ||
| crypto: | ||
| name: crypto-graviola+tls-graviola | ||
| - os: ubuntu-latest | ||
| crypto: | ||
| name: crypto-graviola-rust+tls-graviola | ||
| - os: windows-latest | ||
| crypto: | ||
| name: crypto-graviola+tls-graviola | ||
| - os: windows-latest | ||
| crypto: | ||
| name: crypto-graviola-rust+tls-graviola | ||
| include: | ||
| - os: windows-latest | ||
| platform: windows | ||
|
|
@@ -63,24 +110,26 @@ jobs: | |
| platform: ${{ matrix.platform }} | ||
| arch: ${{ matrix.arch }} | ||
| toolchain: ${{ matrix.toolchain }} | ||
| cargo_features: ${{ matrix.crypto.features }} | ||
|
|
||
| modules: | ||
| needs: | ||
| - check | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - ubuntu-latest | ||
| - macos-latest | ||
| - windows-latest | ||
| tls: | ||
| - tls-ring | ||
| - tls-aws-lc | ||
| - tls-graviola | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing tls-openssl |
||
| include: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsure if you really need the include now? |
||
| - os: ubuntu-latest | ||
| platform: linux | ||
| arch: x86_64 | ||
| toolchain: stable | ||
| - os: ubuntu-24.04-arm | ||
| platform: linux | ||
| arch: aarch64 | ||
| toolchain: stable | ||
| - os: macos-latest | ||
| platform: darwin | ||
| arch: x86_64 | ||
| toolchain: stable | ||
| - os: macos-latest | ||
| platform: darwin | ||
| arch: aarch64 | ||
|
|
@@ -95,3 +144,4 @@ jobs: | |
| platform: ${{ matrix.platform }} | ||
| arch: ${{ matrix.arch }} | ||
| toolchain: ${{ matrix.toolchain }} | ||
| tls_feature: ${{ matrix.tls }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace that with