Skip to content

Commit 21abb44

Browse files
authored
Merge pull request #644 from aws-amplify/main
Release Codegen plugin - 7/24/23
2 parents 310e792 + 63f981a commit 21abb44

File tree

21 files changed

+271
-78
lines changed

21 files changed

+271
-78
lines changed

.codebuild/build_windows.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 0.2
2+
env:
3+
shell: powershell.exe
4+
phases:
5+
build:
6+
commands:
7+
- yarn run production-build
8+
9+
artifacts:
10+
files:
11+
- 'shared-scripts.sh'

.codebuild/e2e_workflow.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ batch:
1010
buildspec: .codebuild/build_linux.yml
1111
env:
1212
compute-type: BUILD_GENERAL1_LARGE
13+
- identifier: build_windows
14+
buildspec: .codebuild/build_windows.yml
15+
env:
16+
type: WINDOWS_SERVER_2019_CONTAINER
17+
compute-type: BUILD_GENERAL1_LARGE
18+
image: $WINDOWS_IMAGE_2019
1319
- identifier: test
1420
buildspec: .codebuild/test.yml
1521
env:
@@ -37,6 +43,15 @@ batch:
3743
CLI_REGION: us-east-2
3844
depend-on:
3945
- publish_to_local_registry
46+
- identifier: build_app_android
47+
buildspec: .codebuild/run_android_modelgen_e2e_test.yml
48+
env:
49+
compute-type: BUILD_GENERAL1_LARGE
50+
variables:
51+
TEST_SUITE: src/__tests__/build-app-android.test.ts
52+
CLI_REGION: us-east-2
53+
depend-on:
54+
- publish_to_local_registry
4055
- identifier: >-
4156
add_codegen_ios_configure_codegen_android_configure_codegen_js_graphql_codegen_android
4257
buildspec: .codebuild/run_e2e_tests.yml
@@ -100,7 +115,7 @@ batch:
100115
variables:
101116
TEST_SUITE: >-
102117
src/__tests__/push-codegen-ios.test.ts|src/__tests__/push-codegen-android.test.ts|src/__tests__/graphql-documents-generator.test.ts|src/__tests__/push-codegen-js.test.ts
103-
CLI_REGION: ap-southeast-1
118+
CLI_REGION: ap-northeast-1
104119
depend-on:
105120
- publish_to_local_registry
106121
- identifier: build_app_ts
@@ -109,16 +124,7 @@ batch:
109124
compute-type: BUILD_GENERAL1_LARGE
110125
variables:
111126
TEST_SUITE: src/__tests__/build-app-ts.test.ts
112-
CLI_REGION: ap-southeast-2
113-
depend-on:
114-
- publish_to_local_registry
115-
- identifier: build_app_android
116-
buildspec: .codebuild/run_e2e_tests.yml
117-
env:
118-
compute-type: BUILD_GENERAL1_MEDIUM
119-
variables:
120-
TEST_SUITE: src/__tests__/build-app-android.test.ts
121-
CLI_REGION: ap-northeast-1
127+
CLI_REGION: ap-southeast-1
122128
depend-on:
123129
- publish_to_local_registry
124130
- identifier: cleanup_e2e_resources

.codebuild/e2e_workflow_base.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ batch:
3737
CLI_REGION: us-east-2
3838
depend-on:
3939
- publish_to_local_registry
40+
- identifier: build_app_android
41+
buildspec: .codebuild/run_android_modelgen_e2e_test.yml
42+
env:
43+
compute-type: BUILD_GENERAL1_LARGE
44+
variables:
45+
TEST_SUITE: src/__tests__/build-app-android.test.ts
46+
CLI_REGION: us-east-2
47+
depend-on:
48+
- publish_to_local_registry

.codebuild/pr_workflow.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ batch:
88
build-graph:
99
- identifier: build_linux
1010
buildspec: .codebuild/build_linux.yml
11+
- identifier: build_windows
12+
buildspec: .codebuild/build_windows.yml
13+
env:
14+
type: WINDOWS_SERVER_2019_CONTAINER
15+
compute-type: BUILD_GENERAL1_LARGE
16+
image: $WINDOWS_IMAGE_2019
1117
- identifier: test
1218
buildspec: .codebuild/test.yml
1319
depend-on:

.codebuild/release_workflow.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ batch:
88
build-graph:
99
- identifier: build_linux
1010
buildspec: .codebuild/build_linux.yml
11+
- identifier: build_windows
12+
buildspec: .codebuild/build_windows.yml
13+
env:
14+
type: WINDOWS_SERVER_2019_CONTAINER
15+
compute-type: BUILD_GENERAL1_LARGE
16+
image: $WINDOWS_IMAGE_2019
1117
- identifier: test
1218
buildspec: .codebuild/test.yml
1319
depend-on:
@@ -24,3 +30,4 @@ batch:
2430
buildspec: .codebuild/deploy.yml
2531
depend-on:
2632
- test
33+
- build_windows
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 0.2
2+
env:
3+
shell: bash
4+
variables:
5+
AMPLIFY_DIR: /root/.npm-global/lib/node_modules/@aws-amplify/cli-internal/bin
6+
AMPLIFY_PATH: /root/.npm-global/lib/node_modules/@aws-amplify/cli-internal/bin/amplify
7+
CI: true
8+
CODEBUILD: true
9+
NODE_OPTIONS: --max-old-space-size=8096
10+
11+
phases:
12+
install:
13+
commands:
14+
- sudo apt update
15+
- yes | sudo apt install android-sdk
16+
- export ANDROID_HOME=/usr/lib/android-sdk
17+
- yes | sudo apt install sdkmanager
18+
# Review SDK licenses
19+
- yes | sudo sdkmanager --licenses
20+
21+
build:
22+
commands:
23+
- source ./shared-scripts.sh && _runE2ETestsLinux
24+
post_build:
25+
commands:
26+
- aws sts get-caller-identity
27+
- source ./shared-scripts.sh && _scanArtifacts
28+
29+
artifacts:
30+
files:
31+
- $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports/*
32+
discard-paths: yes

.codebuild/scripts/lint_pr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set -xeo pipefail
22
# extract the PR number from the PR link
33
PR_NUM=${CODEBUILD_WEBHOOK_TRIGGER##*/}
4+
PROJECT_USERNAME=aws-amplify
5+
REPO_NAME=amplify-codegen
46

57
if [ -z "$PR_NUM" ]; then
68
echo "Could not determine PR number. Cannot determine fork point for linting. Skipping linting."

.codebuild/scripts/publish.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash -e
22

3+
if [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then
4+
BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/}
5+
fi
6+
37
if [ -z "$BRANCH_NAME" ]; then
48
echo "BRANCH_NAME is missing"
59
exit 1

.codebuild/scripts/run-ios-modelgen-e2e-test.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ get_latest_run_id() {
1313
echo "$latest_run_id"
1414
}
1515

16-
# Function to get the status of a workflow run
16+
# Function to get the status of a workflow run - can be queued or in_progress or completed
1717
get_run_status() {
1818
run_id="$1"
1919
run_status=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
@@ -24,6 +24,17 @@ get_run_status() {
2424
echo "$run_status"
2525
}
2626

27+
# Function to get the status of a test run - can be success or failure
28+
get_test_status() {
29+
run_id="$1"
30+
test_status=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
31+
-H "Accept: application/vnd.github+json" \
32+
-H "X-GitHub-Api-Version: 2022-11-28" \
33+
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$run_id" | \
34+
jq -r '.conclusion')
35+
echo "$test_status"
36+
}
37+
2738
# Function to trigger a workflow dispatch event to run the e2e test
2839
trigger_workflow() {
2940
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
@@ -40,24 +51,25 @@ main() {
4051
# Get the latest run ID and initial status
4152
latest_run_id=$(get_latest_run_id)
4253
echo "Latest run ID: $latest_run_id"
43-
latest_status=$(get_run_status "$latest_run_id")
44-
timeout=$((SECONDS + 600)) # 600 seconds = 10 minutes
54+
run_status=$(get_run_status "$latest_run_id")
55+
timeout=$((SECONDS + 1200)) # 1200 seconds = 20 minutes
4556

4657
# Continuously check for status until completion
47-
while [[ "$latest_status" != "completed" && "$SECONDS" -lt "$timeout" ]]; do
48-
echo "Test run status: $latest_status"
58+
while [[ "$run_status" != "completed" && "$SECONDS" -lt "$timeout" ]]; do
59+
echo "Test run status: $run_status"
4960
sleep 10 # Wait before checking again
50-
latest_status=$(get_run_status "$latest_run_id")
61+
run_status=$(get_run_status "$latest_run_id")
5162
done
5263

5364
# Check if the run completed within the specified duration
54-
if [[ "$latest_status" != "completed" ]]; then
65+
if [[ "$run_status" != "completed" ]]; then
5566
echo "The test run did not complete within the specified duration."
5667
exit 1
5768
fi
5869

59-
# Check if the run failed and throw an error if it did
60-
if [[ "$latest_status" == "failure" ]]; then
70+
test_status=$(get_test_status "$latest_run_id")
71+
# Check if the test failed and throw an error if it did
72+
if [[ "$test_status" != "success" ]]; then
6173
echo "The test run failed."
6274
exit 1
6375
else

.github/workflows/build-swift-modelgen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
Build-Swift-Modelgen:
15-
name: Analyze
15+
name: Build
1616
runs-on: macos-13-xl
1717
permissions:
1818
actions: read

0 commit comments

Comments
 (0)