-
Notifications
You must be signed in to change notification settings - Fork 81
94 lines (85 loc) · 3.41 KB
/
codegen-build-test-on-comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This script is for building the full SDK
# It will regenerate all models, build the full SDK with the new models, and run tests.
name: Codegen, Build, and Test triggered via comment
on:
issue_comment:
types: [created]
env:
BUILDER_VERSION: v0.8.19
BUILDER_SOURCE: releases
# host owned by CRT team to host aws-crt-builder releases. Contact their on-call with any issues
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-sdk-swift
LINUX_BASE_IMAGE: ubuntu-16-x64
RUN: ${{ github.run_id }}-${{ github.run_number }}
AWS_SDK_SWIFT_CI_DIR: /Users/runner/work/aws-sdk-swift/aws-sdk-swift
AWS_CRT_SWIFT_CI_DIR: /Users/runner/work/aws-sdk-swift/aws-sdk-swift/target/build/deps/aws-crt-swift
SMITHY_SWIFT_CI_DIR: /Users/runner/work/aws-sdk-swift/aws-sdk-swift/target/build/deps/smithy-swift
AWS_SWIFT_SDK_USE_LOCAL_DEPS: 1
jobs:
codegen-build-test:
runs-on: macos-13-xl
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test')
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: Set initial commit status as pending
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Print Tools Versions
run: |
which swiftc
swiftc --version
echo
which xcodebuild
xcodebuild -version
echo
which java
java --version
echo
echo "Head ref for comment PR: ${{ steps.comment-branch.outputs.head_ref }}"
echo "SHA for comment PR: ${{ steps.comment-branch.outputs.head_sha }}"
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
chmod a+x builder.pyz
GITHUB_HEAD_REF="${{ steps.comment-branch.outputs.head_ref }}" ./builder.pyz build -p ${{ env.PACKAGE_NAME }}
./gradlew -p codegen/sdk-codegen build
./gradlew -p codegen/sdk-codegen stageSdks
./gradlew --stop
./scripts/mergeModels.sh Sources/Services
cd AWSSDKSwiftCLI
swift run AWSSDKSwiftCLI generate-package-manifest ../
cd ..
cat Package.swift
swift build --build-tests
swift test --skip-build
- name: Set final commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}