-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Make GH workflows pass in staging & refactor using composite a…
…ctions (#886) * Adjust CI GitHub workflows so it works in staging repo as well. * Add missing cd command * Bring in composite action refactor * Rename composite action --------- Co-authored-by: Sichan Yoo <chanyoo@amazon.com>
- Loading branch information
Showing
3 changed files
with
111 additions
and
138 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
.github/actions/checkout-aws-sdk-swift-composite-action/action.yml
This file contains 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,51 @@ | ||
name: 'Checkout aws-sdk-swift composite action' | ||
description: 'A composite action that sets up aws-sdk-swift for the workflow.' | ||
inputs: | ||
AUTOMATION_USER_SSH_PRIVATE_KEY: | ||
description: 'SSH private key for the automation user' | ||
required: true | ||
STAGING_PARTNER_REPO: | ||
description: 'The staging partner repository' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up SSH key | ||
if: ${{ github.repository != 'smithy-lang/smithy-swift' }} | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ inputs.AUTOMATION_USER_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
shell: bash | ||
- name: Select staging aws-sdk-swift branch | ||
if: ${{ github.repository != 'smithy-lang/smithy-swift' }} | ||
run: | | ||
cd smithy-swift | ||
ORIGINAL_REPO_HEAD_REF="$GITHUB_HEAD_REF" \ | ||
DEPENDENCY_REPO_URL="git@github.com:${{ inputs.STAGING_PARTNER_REPO }}.git" \ | ||
./scripts/ci_steps/select_dependency_branch.sh | ||
shell: bash | ||
- name: Checkout staging aws-sdk-swift | ||
if: ${{ github.repository != 'smithy-lang/smithy-swift' }} | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.STAGING_PARTNER_REPO }} | ||
ref: ${{ env.DEPENDENCY_REPO_SHA }} | ||
path: aws-sdk-swift | ||
ssh-key: ${{ inputs.AUTOMATION_USER_SSH_PRIVATE_KEY }} | ||
- name: Select aws-sdk-swift branch | ||
if: ${{ github.repository == 'smithy-lang/smithy-swift' }} | ||
run: | | ||
cd smithy-swift | ||
ORIGINAL_REPO_HEAD_REF="$GITHUB_HEAD_REF" \ | ||
DEPENDENCY_REPO_URL="https://github.com/awslabs/aws-sdk-swift.git" \ | ||
./scripts/ci_steps/select_dependency_branch.sh | ||
shell: bash | ||
- name: Checkout aws-sdk-swift | ||
if: ${{ github.repository == 'smithy-lang/smithy-swift' }} | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: awslabs/aws-sdk-swift | ||
ref: ${{ env.DEPENDENCY_REPO_SHA }} | ||
path: aws-sdk-swift |
30 changes: 30 additions & 0 deletions
30
.github/actions/setup-common-tools-composite-action/action.yml
This file contains 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,30 @@ | ||
name: 'Setup Common Tools' | ||
description: 'A composite action that caches Gradle, caches Swift, and sets up Java.' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Cache Gradle | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: 1-${{ runner.os }}-gradle-${{ hashFiles('settings.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
1-${{ runner.os }}-gradle-${{ hashFiles('settings.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }} | ||
1-${{ runner.os }}-gradle- | ||
- name: Cache Swift | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/Library/Caches/org.swift.swiftpm | ||
~/.cache/org.swift.swiftpm | ||
key: 1-${{ runner.os }}-${{ matrix.xcode }}-spm-${{ hashFiles('Package.swift') }} | ||
restore-keys: | | ||
1-${{ runner.os }}-${{ matrix.xcode }}-spm-${{ hashFiles('Package.swift') }} | ||
1-${{ runner.os }}-${{ matrix.xcode }}-spm- | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: corretto | ||
java-version: 17 |
This file contains 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