diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml deleted file mode 100644 index 78d5f65effe..00000000000 --- a/.github/workflows/analysis.yml +++ /dev/null @@ -1,216 +0,0 @@ -name: analysis - -on: - push: - branches: [ main ] - pull_request: - branches: - - '*' - -env: - RUST_BACKTRACE: 1 - # We can pin the version if nightly is too unstable. - # Otherwise, we test against the latest version. - RUST_NIGHTLY_TOOLCHAIN: nightly - # Mirai version tag, updates this whenever a new version - # is released. - MIRAI_TOOLCHAIN: nightly-2023-05-09 - MIRAI_TAG: v1.1.8 - -jobs: - rustfmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} - components: rustfmt - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - - name: Run cargo fmt - run : cargo fmt -- --check --verbose - - clippy: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - # By default, Clippy will lint he dependencies - crate_dir: ["aws-lc-rs"] - features: - - "--features bindgen,unstable" - - "--features bindgen,unstable,fips" - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} - components: clippy - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run cargo clippy - working-directory: ${{ matrix.crate_dir }} - run: cargo clippy ${{ matrix.features }} --all-targets -- -W clippy::all -W clippy::pedantic -D warnings - - apidiff: - if: github.repository == 'aws/aws-lc-rs' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - crate_dir: [ "aws-lc-sys", "aws-lc-fips-sys", "aws-lc-rs" ] - diff_target: [ "branch", "published" ] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: nightly - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Install cargo-public-api - run: cargo install --locked cargo-public-api - - name: Perform API Diff (Target Branch) - if: matrix.diff_target == 'branch' - working-directory: ${{ matrix.crate_dir }} - run: cargo public-api diff --deny changed --deny removed ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - - name: Perform API Diff (Published) - if: matrix.diff_target == 'published' - working-directory: ${{ matrix.crate_dir }} - shell: bash - run: | - CRATE_NAME="${{ matrix.crate_dir }}" - CRATE_VERSION=$(cargo search --limit 1 ${CRATE_NAME} | head -n 1 | sed -e 's/[^"]*"\([^"]*\)".*/\1/') - cargo public-api diff --deny changed --deny removed "${CRATE_VERSION}" - - dependency-review: - runs-on: ubuntu-latest - steps: - - name: 'Checkout Repository' - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 - with: - allow-licenses: Apache-2.0, ISC, MIT, MIT-0 - - udeps: - if: github.repository == 'aws/aws-lc-rs' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - - name: Install cargo-udeps - run: cargo install cargo-udeps - - - name: Run cargo udeps - # we only use openssl when the openssl-benchmarks feature is enabled. - # openssl is a dev-dependency so it can't be optional. - run: cargo udeps --workspace --all-targets --features openssl-benchmarks - env: - RUSTC_WRAPPER: "" - - mirai-analysis: - if: github.repository == 'aws/aws-lc-rs' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - lfs: true - - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ env.MIRAI_TOOLCHAIN }} - components: rust-src, rustc-dev, llvm-tools-preview - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - # https://github.com/facebookexperimental/MIRAI/blob/main/documentation/InstallationGuide.md#installing-mirai-into-cargo - - name: Install MIRAI - run: | - MIRAI_TMP_SRC=$(mktemp -d) - git clone --depth 1 --branch ${{ env.MIRAI_TAG }} https://github.com/facebookexperimental/MIRAI.git ${MIRAI_TMP_SRC} - pushd ${MIRAI_TMP_SRC} - cargo install --force --path ./checker --no-default-features - popd - rm -rf ${MIRAI_TMP_SRC} - - - name: Run MIRAI - working-directory: ./aws-lc-rs - run: | - cargo update - cargo update -p clap --precise 4.4.18 - cargo mirai - - minimal-versions: - if: github.repository == 'aws/aws-lc-rs' - name: Resolve the dependencies to the minimum SemVer version - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - lfs: true - - uses: dtolnay/rust-toolchain@nightly - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Setup to use minimal versions - working-directory: ./aws-lc-rs - run: cargo update -Z minimal-versions - - name: Build with minimal versions - working-directory: ./aws-lc-rs - run: cargo --locked check - - - - copyright: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Check - run: | - ./scripts/tools/copyright_check.sh - - semver-checks: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - name: Check semver (Default Features) - uses: obi1kenobi/cargo-semver-checks-action@v2 - with: - package: aws-lc-rs - feature-group: default-features - - name: Check semver (FIPS) - uses: obi1kenobi/cargo-semver-checks-action@v2 - with: - package: aws-lc-rs - feature-group: only-explicit-features - features: fips diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml index a1de618e9d1..47998b7e78e 100644 --- a/.github/workflows/cross.yml +++ b/.github/workflows/cross.yml @@ -15,7 +15,7 @@ env: jobs: aws-lc-rs-cross-test: - if: github.repository == 'aws/aws-lc-rs' + if: false # github.repository == 'aws/aws-lc-rs' name: aws-lc-rs cross tests runs-on: ${{ matrix.os }} strategy: @@ -42,7 +42,7 @@ jobs: - uses: dtolnay/rust-toolchain@master id: toolchain with: - toolchain: ${{ (matrix.target == 'riscv64gc-unknown-linux-gnu' && '1.72.1') || 'stable' }} + toolchain: ${{ (matrix.target == 'riscv64gc-unknown-linux-gnu' && '1.72.1') || 'stable' }} target: ${{ matrix.target }} - name: Set Rust toolchain override run: rustup override set ${{ steps.toolchain.outputs.name }} @@ -69,7 +69,6 @@ jobs: matrix: rust: [ stable ] os: [ macos-13-xlarge ] - target: [ aarch64-apple-ios-sim ] steps: - uses: actions/checkout@v3 with: @@ -78,11 +77,10 @@ jobs: id: toolchain with: toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} + target: aarch64-apple-ios-sim - name: Set Rust toolchain override run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run cargo test - working-directory: ./aws-lc-rs - run: cargo test --features bindgen,unstable --target ${{ matrix.target }} - env: - DYLD_ROOT_PATH: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot" + - name: Install bash + run: brew install bash + - name: iOS Simulator Runner + run: ./scripts/ci/ios-simulator-runner.sh \ No newline at end of file diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index c6b7021abfa..00000000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy Documentation -on: - push: - branches: - - main - tags: - - v1.* -jobs: - deploy-user-guide: - if: github.repository == 'aws/aws-lc-rs' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - submodules: 'recursive' - - name: Install Nightly Rust Toolchain - uses: dtolnay/rust-toolchain@nightly - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - uses: actions/setup-go@v4 - with: - go-version: '>=1.18' - - name: Build and Test User Guide - run: | - curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.34/mdbook-v0.4.34-x86_64-unknown-linux-gnu.tar.gz | tar xz - ./mdbook build book - ./mdbook test book - - name: Build Documentation - run: cargo doc --features fips,unstable --no-deps --workspace - - name: Copy docs - run: | - mkdir -p book/book/rustdocs/${{ github.ref_name }} - cp --recursive target/doc -t book/book/rustdocs/${{ github.ref_name }} - - name: Deploy Docs - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: book/book diff --git a/.github/workflows/fips.yml b/.github/workflows/fips.yml deleted file mode 100644 index e398d0c30db..00000000000 --- a/.github/workflows/fips.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: fips - -on: - push: - branches: [ main ] - pull_request: - branches: - - '*' - -env: - RUST_BACKTRACE: 1 - # We can pin the version if nightly is too unstable. - # Otherwise, we test against the latest version. - RUST_NIGHTLY_TOOLCHAIN: nightly - -jobs: - fips-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs fips-tests - runs-on: ${{ matrix.os }} - env: - CC: clang - CXX: clang++ - strategy: - fail-fast: false - matrix: - rust: [ stable ] - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - args: - - --release --all-targets --features fips,unstable - - --no-default-features --features fips,unstable - - --no-default-features --features fips,ring-io,unstable - - --no-default-features --features fips,ring-sig-verify,unstable - - --no-default-features --features fips,alloc,unstable - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ matrix.rust }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - uses: actions/setup-go@v4 - with: - go-version: '>=1.18' - - name: Run cargo test - working-directory: ./aws-lc-rs - # Doc-tests fail to link with dynamic build - # See: https://github.com/rust-lang/cargo/issues/8531 - run: cargo test --tests ${{ matrix.args }} - windows-fips-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs windows-fips-tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rust: [ stable ] - os: [ windows-2019, windows-latest ] - args: - - --all-targets --features fips,unstable - - --all-targets --features fips,bindgen,unstable - - --release --all-targets --features fips,unstable - - --no-default-features --features fips,unstable - - --no-default-features --features fips,ring-io,unstable - - --no-default-features --features fips,ring-sig-verify,unstable - - --no-default-features --features fips,alloc,unstable - steps: - - uses: ilammy/setup-nasm@v1 - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: actions-rs/toolchain@v1.0.7 - id: toolchain - with: - toolchain: ${{ matrix.rust }} - override: true - - name: Install ninja-build tool - uses: seanmiddleditch/gha-setup-ninja@v4 - - name: Run cargo test - working-directory: ./aws-lc-rs - # Doc-tests fail to link with dynamic build - # See: https://github.com/rust-lang/cargo/issues/8531 - run: cargo test --tests ${{ matrix.args }} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml deleted file mode 100644 index b0cae08f023..00000000000 --- a/.github/workflows/integration.yml +++ /dev/null @@ -1,158 +0,0 @@ -name: integration - -on: - push: - branches: [ main ] - pull_request: - branches: - - '*' - -env: - RUST_BACKTRACE: 1 - # We can pin the version if nightly is too unstable. - # Otherwise, we test against the latest version. - RUST_NIGHTLY_TOOLCHAIN: nightly - -jobs: - s2n-quic-integration: - if: github.repository == 'aws/aws-lc-rs' - name: s2n-quic-integration - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@stable - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run s2n-quic integration - working-directory: ./aws-lc-rs - run: | - ./scripts/run-s2n-quic-integration.sh - - rustls-integration: - if: github.repository == 'aws/aws-lc-rs' - name: rustls-integration - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@stable - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Install cargo-download - run: cargo install cargo-download - - name: Run rustls integration - working-directory: ./aws-lc-rs - run: | - ./scripts/run-rustls-integration.sh - - links-crate-tests: - if: github.repository == 'aws/aws-lc-rs' - name: sys crate tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ] - features: [ aws-lc-rs, aws-lc-rs-fips, aws-lc-sys, aws-lc-fips-sys ] - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@stable - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Install NASM on Windows - if: runner.os == 'Windows' - uses: ilammy/setup-nasm@v1 - - name: Setup Go >=v1.18 - uses: actions/setup-go@v4 - with: - go-version: '>=1.18' - - name: Install ninja-build tool - uses: seanmiddleditch/gha-setup-ninja@v4 - - name: Run cargo test - working-directory: ./links-testing - run: cargo test --features ${{ matrix.features }} --no-default-features - - name: Run cargo run - working-directory: ./links-testing - run: cargo run --features ${{ matrix.features }} --no-default-features - - publish-dry-run: - if: github.repository == 'aws/aws-lc-rs' - name: publish dry-run - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rust: [ stable ] - os: [ windows-latest, ubuntu-latest, macos-12, macos-13-xlarge ] - crate: [ aws-lc-sys, aws-lc-rs, aws-lc-fips-sys ] - args: - - publish --dry-run - steps: - - uses: actions/setup-go@v4 - with: - go-version: '>=1.18' - - run: go version - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - if: ${{ matrix.os == 'windows-latest' }} - uses: ilammy/setup-nasm@v1 - - name: Install ninja-build tool - if: ${{ matrix.os == 'windows-latest' }} - uses: seanmiddleditch/gha-setup-ninja@v4 - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ matrix.rust }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: ${{ matrix.crate }} - working-directory: ./${{ matrix.crate }} - run: cargo ${{ matrix.args }} - - msrv: - name: Minimum Supported Rust Version - if: github.repository == 'aws/aws-lc-rs' - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ] - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - lfs: true - - - name: Install NASM on Windows - if: runner.os == 'Windows' - uses: ilammy/setup-nasm@v1 - - - name: Install ninja-build tool - if: runner.os == 'Windows' - uses: seanmiddleditch/gha-setup-ninja@v4 - - - name: Install MSRV Rust version - uses: dtolnay/rust-toolchain@stable - with: - toolchain: 1.61.0 # TODO: dynamically identify MSRV - - - name: Verify msrv - working-directory: ./aws-lc-rs - run: cargo +1.61.0 check --features bindgen diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index ec02625c104..00000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,253 +0,0 @@ -name: tests - -on: - push: - branches: [ main ] - pull_request: - branches: - - '*' - -env: - RUST_BACKTRACE: 1 - # We can pin the version if nightly is too unstable. - # Otherwise, we test against the latest version. - RUST_NIGHTLY_TOOLCHAIN: nightly - -jobs: - - aws-lc-rs-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rust: [ stable ] - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - args: - - --all-targets --features unstable - - --release --all-targets --features unstable - - --no-default-features --features non-fips,unstable - - --no-default-features --features non-fips,ring-io,unstable - - --no-default-features --features non-fips,ring-sig-verify,unstable - - --no-default-features --features non-fips,alloc,unstable - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ matrix.rust }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run cargo test - working-directory: ./aws-lc-rs - run: cargo test ${{ matrix.args }} - - name: Run extra tests - working-directory: ./aws-lc-rs-testing - run: cargo test --all-targets - - bindgen-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs bindgen-tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rust: [ stable ] - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - args: - - --no-default-features --features aws-lc-sys,bindgen,unstable - - --release --all-targets --features bindgen,unstable - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ matrix.rust }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run cargo test - working-directory: ./aws-lc-rs - run: cargo test ${{ matrix.args }} - - windows-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs windows-tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - rust: [ stable ] - os: [ windows-2019, windows-2022 ] - args: - - --all-targets --features unstable - - --all-targets --features bindgen,unstable - - --release --all-targets --features unstable - - --no-default-features --features non-fips,unstable - - --no-default-features --features non-fips,ring-io,unstable - - --no-default-features --features non-fips,ring-sig-verify,unstable - - --no-default-features --features non-fips,alloc,unstable - steps: - - uses: ilammy/setup-nasm@v1 - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ matrix.rust }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run cargo test - working-directory: ./aws-lc-rs - run: cargo test ${{ matrix.args }} - - aws-lc-rs-coverage: - name: aws-ls-rs coverage - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - lfs: true - - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} - components: llvm-tools-preview - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - - name: Run coverage - working-directory: ./aws-lc-rs - run: cargo llvm-cov --workspace --features unstable --no-fail-fast --ignore-filename-regex "aws-lc-(fips-)?sys/.*" --lcov --output-path ${{ runner.temp }}/lcov.info - - name: Run FIPS coverage - working-directory: ./aws-lc-rs - run: cargo llvm-cov --workspace --features unstable,fips --no-fail-fast --ignore-filename-regex "aws-lc-(fips-)?sys/.*" --lcov --output-path ${{ runner.temp }}/lcov-fips.info - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: ${{ runner.temp }}/lcov.info,${{ runner.temp }}/lcov-fips.info - - aws-lc-rs-asan: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs asan - strategy: - matrix: - args: - - - - --release - features: - - --features asan - - --no-default-features --features fips,asan - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@master - id: toolchain - with: - toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run address sanitizers - env: - ASAN_OPTIONS: detect_leaks=1 - RUSTFLAGS: -Zsanitizer=address - RUSTDOCFLAGS: -Zsanitizer=address - working-directory: ./aws-lc-rs - run: cargo test ${{ matrix.args }} --lib --bins --tests --examples --target x86_64-unknown-linux-gnu --features asan - - build-env-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs build-env-test - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - static: [ 0, 1 ] - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@stable - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Run cargo test - working-directory: ./aws-lc-rs - # Doc-tests fail to link with dynamic build - # See: https://github.com/rust-lang/cargo/issues/8531 - run: AWS_LC_SYS_STATIC=${{ matrix.static }} cargo test --tests - - build-env-fips-test: - if: github.repository == 'aws/aws-lc-rs' - name: aws-lc-rs build-env-fips-test - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-12, macos-13-xlarge ] - static: [ 0, 1 ] - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - uses: dtolnay/rust-toolchain@stable - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - uses: actions/setup-go@v4 - with: - go-version: '>=1.18' - - name: Run cargo test - working-directory: ./aws-lc-rs - if: ${{ matrix.os == 'ubuntu-latest' || matrix.static != 1 }} - # Doc-tests fail to link with dynamic build - # See: https://github.com/rust-lang/cargo/issues/8531 - run: AWS_LC_FIPS_SYS_STATIC=${{ matrix.static }} cargo test --tests --features fips - - careful: - if: github.repository == 'aws/aws-lc-rs' - name: Run carefully - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - macos-12 - - macos-13-xlarge - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - lfs: true - - uses: dtolnay/rust-toolchain@nightly - id: toolchain - - name: Set Rust toolchain override - run: rustup override set ${{ steps.toolchain.outputs.name }} - - name: Install cargo-careful - run: cargo install cargo-careful - - uses: actions/setup-go@v4 - with: - go-version: '>=1.18' - - name: Run tests - working-directory: ./aws-lc-rs - run: cargo +nightly careful test - - name: Run tests w/ FIPS - working-directory: ./aws-lc-rs - # Rust doc tests dislike dynamic linking - run: cargo +nightly careful test --tests --features fips,bindgen diff --git a/scripts/ci/ios-simulator-runner.sh b/scripts/ci/ios-simulator-runner.sh new file mode 100755 index 00000000000..802d09b5883 --- /dev/null +++ b/scripts/ci/ios-simulator-runner.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 OR ISC + +set -e + +REPO_ROOT=$(git rev-parse --show-toplevel) + +SIM_IMAGE_LIST_PATH='/Library/Developer/CoreSimulator/Images/images.plist' +SIM_IMAGE_MOUNT_BASE='/Volumes' + +if [[ ! -r "${SIM_IMAGE_LIST_PATH}" ]]; then + echo ERROR: Image list not found: "${SIM_IMAGE_LIST_PATH}" + exit 1 +fi + +function plist_count_images() { + plutil -extract 'images' raw "${SIM_IMAGE_LIST_PATH}" -o - +} + +function plist_image_id_for() { + plutil -extract "images.${1}.runtimeInfo.bundleIdentifier" raw "${SIM_IMAGE_LIST_PATH}" -o - +} + +function plist_image_path_for() { + plutil -extract "images.${1}.path.relative" raw "${SIM_IMAGE_LIST_PATH}" -o - | sed -e 's/^file:\/\///' +} + +function plist_image_build_for() { + plutil -extract "images.${1}.runtimeInfo.build" raw "${SIM_IMAGE_LIST_PATH}" -o - | sed -e 's/^file:\/\///' +} + +function find_mount() { + hdiutil info | grep -s "${1}" +} + +function find_runtime_root() { + find "${1}" -type d -name "RuntimeRoot" |head -n 1 +} + + +IMAGE_LIST_SIZE=$(plist_count_images) +IMAGE_LIST_LAST_IDX=$(( "${IMAGE_LIST_SIZE}" - 1 )) +IMAGE_PATH='' +IMAGE_BUILD='' + + +for i in $(seq 0 "${IMAGE_LIST_LAST_IDX}"); do + if [[ $(plist_image_id_for "${i}") = *iOS-17* ]]; then + IMAGE_PATH=$(plist_image_path_for "${i}") + IMAGE_BUILD=$(plist_image_build_for "${i}") + fi +done + +if [[ -z ${IMAGE_PATH} ]]; then + echo ERROR: iOS 17 image not found. + exit 1 +fi + +IMAGE_MOUNT_POINT="${SIM_IMAGE_MOUNT_BASE}/iOS_${IMAGE_BUILD}" + +if ! find_mount "${IMAGE_MOUNT_POINT}"; then + sudo hdiutil attach "${IMAGE_PATH}" -mountpoint "${IMAGE_MOUNT_POINT}" +fi + +if ! find_mount "${IMAGE_MOUNT_POINT}"; then + echo ERROR: Unable to mount runtime + exit 1 +fi + +DYLD_ROOT_PATH='' +DYLD_ROOT_PATH=$(find_runtime_root "${IMAGE_MOUNT_POINT}") + +if [[ -z "${DYLD_ROOT_PATH}" ]]; then + echo ERROR: RuntimeRoot not found: "${IMAGE_MOUNT_POINT}" + exit 1 +fi + +export DYLD_ROOT_PATH +cd "${REPO_ROOT}"/aws-lc-rs +cargo test --features bindgen,unstable --target aarch64-apple-ios-sim