Skip to content

Commit

Permalink
Upgrade actions in GitHub Actions workflows (#1959)
Browse files Browse the repository at this point in the history
* Stop using actions-rs since it's not maintained (see actions-rs/toolchain#216)
* Upgrade `aws-actions/configure-aws-credentials` to `v1-node16`
* Replace `::set-output` with environment files
  • Loading branch information
jdisanti authored Nov 9, 2022
1 parent c4a14d7 commit b82b6a6
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 65 deletions.
11 changes: 6 additions & 5 deletions .github/actions/docker-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
runs:
using: composite
steps:
- uses: actions/cache@v2
- uses: actions/cache@v3
name: Gradle Cache
with:
path: |
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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
Expand Down
64 changes: 28 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand All @@ -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"]
Expand All @@ -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:
Expand Down Expand Up @@ -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) }}
6 changes: 2 additions & 4 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual-pull-request-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/pull-request-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ jobs:
outputs:
bot-message: ${{ steps.generate-diff.outputs.bot-message }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: smithy-rs
- name: Generate diff
uses: ./smithy-rs/.github/actions/docker-build
with:
action: generate-codegen-diff
action-arguments: ${{ inputs.base_revision }}
- uses: aws-actions/configure-aws-credentials@v1
- uses: aws-actions/configure-aws-credentials@v1-node16
name: Acquire credentials for uploading to S3
with:
role-to-assume: ${{ secrets.SMITHY_RS_PULL_REQUEST_CDN_ROLE_ARN }}
Expand All @@ -80,8 +80,8 @@ jobs:
outputs:
bot-message: ${{ steps.generate-preview.outputs.bot-message }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
name: Gradle Cache
with:
path: |
Expand All @@ -92,13 +92,14 @@ jobs:
${{ runner.os }}-gradle-
# JDK is needed to generate code
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: corretto
java-package: jdk
java-version: ${{ env.java_version }}
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.rust_version }}
default: true
- name: Generate doc preview
id: generate-preview
# Only generate three of the smallest services since the doc build can be very large. STS and SSO must be
Expand All @@ -122,8 +123,8 @@ jobs:
popd
./tools/generate-doc-preview-index.sh ${{ inputs.base_revision }}
echo '::set-output name=bot-message::A [new doc preview](https://d2luzm2xt3nokh.cloudfront.net/docs/'${{ inputs.head_revision }}'/index.html) is ready to view.'
- uses: aws-actions/configure-aws-credentials@v1
echo 'bot-message=A [new doc preview](https://d2luzm2xt3nokh.cloudfront.net/docs/'${{ inputs.head_revision }}'/index.html) is ready to view.' >> "${GITHUB_OUTPUT}"
- uses: aws-actions/configure-aws-credentials@v1-node16
name: Acquire credentials for uploading to S3
with:
role-to-assume: ${{ secrets.SMITHY_RS_PULL_REQUEST_CDN_ROLE_ARN }}
Expand Down Expand Up @@ -153,9 +154,9 @@ jobs:
id: bot-messages
run: |
set -eux
echo ::set-output name=codegen-diff::"$(cat ./bot-message-codegen-diff)"
echo "codegen-diff=$(cat ./bot-message-codegen-diff)" >> "${GITHUB_OUTPUT}"
- name: Post bot comment
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
script: |
await github.rest.issues.createComment({
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.rust_version }}
default: true
- name: Checkout smithy-rs
uses: actions/checkout@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update-sdk-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
path: aws-sdk-rust
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: corretto
java-package: jdk
java-version: 11
# Rust is only used to `rustfmt` the generated code; doesn't need to match MSRV
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
uses: dtolnay/rust-toolchain@stable
- name: Delete old SDK
run: |
- name: Generate a fresh SDK
Expand Down

0 comments on commit b82b6a6

Please sign in to comment.