Unverified Commit b82b6a65 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Upgrade actions in GitHub Actions workflows (#1959)

* Stop using actions-rs since it's not maintained (see https://github.com/actions-rs/toolchain/issues/216)
* Upgrade `aws-actions/configure-aws-credentials` to `v1-node16`
* Replace `::set-output` with environment files
parent c4a14d7c
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ inputs:
runs:
  using: composite
  steps:
  - uses: actions/cache@v2
  - uses: actions/cache@v3
    name: Gradle Cache
    with:
      path: |
@@ -24,11 +24,12 @@ runs:
      key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/caches/**/*', 'gradle/wrapper/**/*') }}
      restore-keys: |
        ${{ runner.os }}-gradle-
      # Pinned to the commit hash of v1.3.0
  - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641
    # Pinned to the commit hash of v2.1.0
  - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
    with:
      sharedKey: ${{ runner.os }}-${{ github.job }}
      target-dir: ./smithy-rs-target
      shared-key: ${{ runner.os }}-${{ github.job }}
      workspaces: |
        . smithy-rs-target
  - name: Download all artifacts
    uses: ./smithy-rs/.github/actions/download-all-artifacts
  - name: Prepare build image
+2 −2
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ jobs:
      contents: read
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      uses: actions/checkout@v3
    - name: Build image
      run: |
        IMAGE_TAG="$(./tools/ci-build/tools-hash)"
@@ -38,7 +38,7 @@ jobs:
          -t "${{ env.ecr_repository }}:main" \
          .
    - name: Acquire credentials
      uses: aws-actions/configure-aws-credentials@v1
      uses: aws-actions/configure-aws-credentials@v1-node16
      with:
        role-to-assume: ${{ secrets.SMITHY_RS_PUBLIC_ECR_PUSH_ROLE_ARN }}
        role-session-name: GitHubActions
+28 −36
Original line number Diff line number Diff line
@@ -121,16 +121,17 @@ jobs:
      RUSTFLAGS: -D warnings
    steps:
    - uses: actions/checkout@v3
      # Pinned to the commit hash of v1.3.0
    - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641
      # Pinned to the commit hash of v2.1.0
    - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
      with:
        sharedKey: ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}
        target-dir: ./target
    - uses: actions-rs/toolchain@v1
        shared-key: ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}
        workspaces: |
          .
          tools
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ env.rust_version }}
        components: ${{ env.rust_toolchain_components }}
        default: true
    - name: Run tests
      shell: bash
      run: |
@@ -181,19 +182,19 @@ jobs:
      CROSS_CONFIG: Cross.toml
    steps:
    - name: Checkout
      uses: actions/checkout@v1
      # Pinned to the commit hash of v1.3.0
    - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641
      uses: actions/checkout@v3
      # Pinned to the commit hash of v2.1.0
    - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd
      with:
        sharedKey: ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}-${{ matrix.target }}
        target-dir: ./target
    - uses: actions-rs/toolchain@v1
        shared-key: ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}-${{ matrix.target }}
        workspaces: |
          .
          tools
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ env.rust_version }}
        components: ${{ env.rust_toolchain_components }}
        profile: minimal
        override: true
        target: ${{ matrix.target }}
        targets: ${{ matrix.target }}
    - name: Sets OpenSSL env vars on i686
      run: |
        echo "OPENSSL_LIB_DIR=/usr/lib/i386-linux-gnu" >> $GITHUB_ENV
@@ -208,6 +209,8 @@ jobs:
      # configure and cross compile openssl locally on ppc and ppc64 to be able to run aws-smithy-client tests.
      # since cross dropped support for openssl, we use the build script from version 0.16.
      run: |
        cargo install cross --locked --version 0.2.4

        cat > Cross.toml << EOF
        [target.i686-unknown-linux-gnu]
        pre-build = ["dpkg --add-architecture i386", "apt-get update && apt-get install --assume-yes pkg-config:i386 libssl-dev:i386"]
@@ -226,29 +229,17 @@ jobs:
        passthrough = ["OPENSSL_DIR"]
        EOF
    - name: Build Smithy-rs rust-runtime crates
      uses: actions-rs/cargo@v1
      with:
        use-cross: true
        command: build
        args: -vv --target ${{ matrix.target }} --manifest-path "rust-runtime/Cargo.toml" ${{ matrix.build_smithy_rs_exclude }} --workspace ${{ matrix.build_smithy_rs_features }}
      shell: bash
      run: cross build -vv --target ${{ matrix.target }} --manifest-path "rust-runtime/Cargo.toml" ${{ matrix.build_smithy_rs_exclude }} --workspace ${{ matrix.build_smithy_rs_features }}
    - name: Build AWS rust-runtime crates
      uses: actions-rs/cargo@v1
      with:
        use-cross: true
        command: build
        args: -vv --target ${{ matrix.target }} --manifest-path "aws/rust-runtime/Cargo.toml" ${{ matrix.build_aws_exclude }} --workspace
      shell: bash
      run: cross build -vv --target ${{ matrix.target }} --manifest-path "aws/rust-runtime/Cargo.toml" ${{ matrix.build_aws_exclude }} --workspace
    - name: Test Smithy-rs rust-runtime crates
      uses: actions-rs/cargo@v1
      with:
        use-cross: true
        command: test
        args: --target ${{ matrix.target }} --manifest-path "rust-runtime/Cargo.toml" ${{ matrix.test_smithy_rs_exclude }} --workspace ${{ matrix.test_smithy_rs_features }}
      shell: bash
      run: cross test --target ${{ matrix.target }} --manifest-path "rust-runtime/Cargo.toml" ${{ matrix.test_smithy_rs_exclude }} --workspace ${{ matrix.test_smithy_rs_features }}
    - name: Test AWS rust-runtime crates
      uses: actions-rs/cargo@v1
      with:
        use-cross: true
        command: test
        args: --target ${{ matrix.target }} --manifest-path "aws/rust-runtime/Cargo.toml" ${{ matrix.test_aws_exclude }} --workspace
      shell: bash
      run: cross test --target ${{ matrix.target }} --manifest-path "aws/rust-runtime/Cargo.toml" ${{ matrix.test_aws_exclude }} --workspace

  # This job is split out from the rest since it is not required to pass for merge
  check-sdk-examples:
@@ -280,6 +271,7 @@ jobs:
    name: Matrix Success
    steps:
    - name: Verify jobs succeeded
      uses: re-actors/alls-green@3a2de129f0713010a71314c74e33c0e3ef90e696
      # Pinned to commit hash of v1.2.2
      uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
      with:
        jobs: ${{ toJSON(needs) }}
+2 −4
Original line number Diff line number Diff line
@@ -17,12 +17,10 @@ jobs:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      uses: actions/checkout@v3
      with:
        persist-credentials: false
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
    - uses: dtolnay/rust-toolchain@stable
    - name: Generate docs
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ jobs:
    steps:
    - name: Get PR info
      id: get-pr-info
      uses: actions/github-script@v5
      uses: actions/github-script@v6
      with:
        script: |
          const response = await github.rest.pulls.get({
Loading