Skip to content

Commit 2e3d373

Browse files
authored
chore(build-system-test): Run build system tests pre-release and on schedule (#5706)
1 parent 834b4d3 commit 2e3d373

16 files changed

+412
-312
lines changed

.github/workflows/build-system-test-react-native.yml

Lines changed: 3 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -6,126 +6,14 @@ permissions:
66
id-token: write # This is required for aws-actions/configure-aws-credentials
77

88
on:
9-
push:
10-
branches: ['main']
119
schedule:
1210
- cron: '0 * * * *' # Run at the first minute of every hour
1311

1412
jobs:
1513
build:
16-
runs-on: macos-13
17-
environment: ci
18-
strategy:
19-
fail-fast: false
20-
matrix:
21-
framework: [react-native]
22-
framework-version: [latest]
23-
# uncomment to re-enable
24-
# build-tool: [cli, expo]
25-
build-tool: [expo]
26-
build-tool-version: [latest]
27-
pkg-manager: [npm]
28-
language: [ts]
29-
node-version: [18]
30-
platform: [ios, android]
31-
logfile: [test.log]
32-
pkg-manager-version: [latest]
33-
exclude:
34-
- build-tool: expo
35-
platform: ios
36-
37-
env:
38-
MEGA_APP_NAME: rn${{ matrix.framework-version }}${{ matrix.build-tool }}${{ matrix.build-tool-version }}${{ matrix.language }}${{ matrix.platform }}
39-
40-
steps:
41-
- name: Checkout Amplify UI
42-
uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
43-
with:
44-
persist-credentials: false
45-
- name: Setup Node.js ${{ matrix.node-version }} with ${{ matrix.pkg-manager }}
46-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 https://github.com/actions/setup-node/commit/60edb5dd545a775178f52524783378180af0d1f8
47-
with:
48-
node-version: ${{ matrix.node-version }}
49-
cache: ${{ matrix.pkg-manager }}
50-
env:
51-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
52-
53-
- name: Restore CocoaPods cache
54-
if: ${{ matrix.platform == 'ios' }}
55-
id: restore-cocoapods-cache
56-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 https://github.com/actions/cache/commit/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
57-
with:
58-
path: ./examples/react-native/ios/Pods
59-
key: ${{ runner.os }}-cocoapods-${{ inputs.commit }}
60-
restore-keys: pods-${{ hashFiles('examples/react-native/ios/Podfile.lock') }}
61-
env:
62-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
63-
- name: Restore node_modules cache
64-
if: ${{ matrix.platform == 'ios' }}
65-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 https://github.com/actions/cache/commit/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
66-
id: restore-cache
67-
with:
68-
path: |
69-
./node_modules
70-
**/node_modules
71-
key: ${{ runner.os }}-nodemodules-${{ inputs.commit }}
72-
env:
73-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
74-
- name: Install Java 17
75-
if: ${{ matrix.platform == 'android' }}
76-
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc # 3.6.0
77-
with:
78-
distribution: 'corretto' # Amazon Corretto Build of OpenJDK
79-
java-version: '17'
80-
81-
- name: Install iOS simulator
82-
if: ${{ matrix.platform == 'ios' }}
83-
run: |
84-
brew tap wix/brew
85-
brew install applesimutils
86-
brew install watchman
87-
brew link --overwrite [email protected]
88-
echo "ruby --version"
89-
ruby --version
90-
continue-on-error: true # brew overwrite step addresses a python install issue: https://github.com/actions/runner-images/issues/8500
91-
- name: Update CocoaPods
92-
if: ${{ matrix.platform == 'ios' }}
93-
run: |
94-
gem update cocoapods xcodeproj
95-
yarn react-native-example ios:pod-install
96-
97-
- name: Install Android emulator
98-
if: ${{ matrix.platform == 'android' }}
99-
run: |
100-
echo -e "echo \$ANDROID_HOME"
101-
echo $ANDROID_HOME
102-
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'build-tools;33.0.2' platform-tools
103-
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "system-images;android-27;default;x86_64"
104-
echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd --force --name Pixel_5_API_27 --device "pixel_5" --abi x86_64 --package "system-images;android-27;default;x86_64"
105-
printf 'hw.cpu.ncore=2\n' >> ~/.android/avd/Pixel_5_API_27.avd/config.ini
106-
printf 'hw.ramSize=2048\n' >> ~/.android/avd/Pixel_5_API_27.avd/config.ini
107-
printf 'hw.heapSize=576\n' >> ~/.android/avd/Pixel_5_API_27.avd/config.ini
108-
- name: Start Android emulator
109-
if: ${{ matrix.platform == 'android' }}
110-
run: |
111-
nohup $ANDROID_HOME/emulator/emulator -avd Pixel_5_API_27 -no-boot-anim -no-audio -no-snapshot-load -gpu host -accel on &
112-
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
113-
$ANDROID_HOME/platform-tools/adb devices
114-
# disable spell checker
115-
$ANDROID_HOME/platform-tools/adb shell settings put secure spell_checker_enabled 0
116-
# disable animations
117-
$ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0.0
118-
$ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0.0
119-
$ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0.0
120-
121-
- name: Create MegaApp ${{ env.MEGA_APP_NAME }} and run build on NodeJS ${{ matrix.node-version }}
122-
run: npm run ${{ env.MEGA_APP_NAME }}
123-
shell: bash
124-
working-directory: build-system-tests
125-
- name: Detect Mega App Error in Log
126-
run: npm run checkReactNativeLogs -- --log-file-name ${{ matrix.logfile }} --mega-app-name ${{ env.MEGA_APP_NAME }} --platform ${{ matrix.platform }}
127-
shell: bash
128-
working-directory: build-system-tests
14+
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
15+
with:
16+
dist-tag: latest
12917

13018
log-failure-metric:
13119
# Send a failure data point to metric BuildSystemTestFailure in github-workflows@ us-east-2

.github/workflows/build-system-test.yml

Lines changed: 3 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -11,127 +11,9 @@ on:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-latest
15-
environment: ci
16-
strategy:
17-
fail-fast: false
18-
matrix:
19-
framework: [react]
20-
framework-version: [latest]
21-
build-tool: [cra, next, vite]
22-
build-tool-version: [latest]
23-
pkg-manager: [npm]
24-
language: [ts]
25-
node-version: [18]
26-
pkg-manager-version: [latest]
27-
include:
28-
- framework: react
29-
framework-version: latest
30-
build-tool: cra
31-
build-tool-version: latest
32-
pkg-manager: npm
33-
language: ts
34-
node-version: 20
35-
- framework: react
36-
framework-version: 16
37-
build-tool: cra
38-
build-tool-version: latest
39-
pkg-manager: npm
40-
language: ts
41-
node-version: 20
42-
- framework: react
43-
framework-version: latest
44-
build-tool: cra
45-
build-tool-version: latest
46-
pkg-manager: npm
47-
language: js
48-
node-version: 20
49-
- framework: react
50-
framework-version: latest
51-
build-tool: cra
52-
build-tool-version: latest
53-
pkg-manager: yarn
54-
pkg-manager-version: 1
55-
language: ts
56-
node-version: 20
57-
- framework: react
58-
framework-version: 18
59-
build-tool: next
60-
build-tool-version: 12
61-
pkg-manager: npm
62-
language: ts
63-
node-version: 20
64-
- framework: react
65-
framework-version: latest
66-
build-tool: vite
67-
build-tool-version: 2
68-
pkg-manager: npm
69-
language: ts
70-
node-version: 20
71-
72-
- framework: angular
73-
framework-version: latest
74-
build-tool: angular-cli
75-
build-tool-version: latest
76-
pkg-manager: npm
77-
language: ts
78-
node-version: 20
79-
- framework: angular
80-
framework-version: 14
81-
build-tool: angular-cli
82-
build-tool-version: 14
83-
pkg-manager: npm
84-
language: ts
85-
node-version: 20
86-
87-
- framework: vue
88-
framework-version: 3 # here use "3" instead of "latest" because .vuerc(preset) doesn't accept "latest" as "vueVersion"
89-
build-tool: vue-cli
90-
build-tool-version: latest
91-
pkg-manager: yarn # vue-cli defualt pkg-manager is yarn. It can't be customized in the preset.json.
92-
language: ts
93-
node-version: 20
94-
- framework: vue
95-
framework-version: latest
96-
build-tool: vite
97-
build-tool-version: latest
98-
pkg-manager: npm
99-
language: ts
100-
node-version: 20
101-
- framework: vue
102-
framework-version: latest
103-
build-tool: vite
104-
build-tool-version: 3
105-
pkg-manager: npm
106-
language: ts
107-
node-version: 20
108-
- framework: vue
109-
framework-version: latest
110-
build-tool: nuxt
111-
build-tool-version: latest
112-
pkg-manager: npm
113-
language: ts
114-
node-version: 20
115-
116-
env:
117-
MEGA_APP_NAME: ${{ matrix.framework }}-${{ matrix.framework-version }}-${{ matrix.build-tool }}-${{ matrix.build-tool-version }}-${{ matrix.language }}
118-
119-
steps:
120-
- name: Checkout Amplify UI
121-
uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
122-
with:
123-
persist-credentials: false
124-
- name: Setup Node.js ${{ matrix.node-version }} with ${{ matrix.pkg-manager }}
125-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 https://github.com/actions/setup-node/commit/60edb5dd545a775178f52524783378180af0d1f8
126-
with:
127-
node-version: ${{ matrix.node-version }}
128-
cache: ${{ matrix.pkg-manager }}
129-
env:
130-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
131-
- name: Create MegaApp ${{ env.MEGA_APP_NAME }} and run build on NodeJS ${{ matrix.node-version }}
132-
run: npm run ${{ env.MEGA_APP_NAME }}
133-
shell: bash
134-
working-directory: build-system-tests
14+
uses: ./.github/workflows/reusable-build-system-test.yml
15+
with:
16+
dist-tag: latest
13517

13618
log-failure-metric:
13719
# Send a failure data point to metric BuildSystemTestFailure in github-workflows@ us-east-2

.github/workflows/publish-hotfix.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,25 @@ jobs:
8383
run: yarn build
8484
working-directory: ./canary
8585

86+
build-test-v2:
87+
uses: ./.github/workflows/reusable-build-system-test.yml
88+
needs: publish-hotfix
89+
with:
90+
dist-tag: hotfix
91+
92+
build-test-v2-react-native:
93+
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
94+
needs: publish-hotfix
95+
with:
96+
dist-tag: hotfix
97+
8698
publish:
8799
runs-on: ubuntu-latest
88100
environment: deployment
89-
needs: build-test
101+
needs:
102+
- build-test
103+
- build-test-v2
104+
- build-test-v2-react-native
90105
if: ${{ needs.setup.outputs.has-changesets != 'true' }}
91106
steps:
92107
- name: Checkout repo

.github/workflows/publish-latest.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,25 @@ jobs:
8282
run: yarn build
8383
working-directory: ./canary
8484

85+
build-test-v2:
86+
uses: ./.github/workflows/reusable-build-system-test.yml
87+
needs: setup
88+
with:
89+
dist-tag: next
90+
91+
build-test-v2-react-native:
92+
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
93+
needs: setup
94+
with:
95+
dist-tag: next
96+
8597
publish:
8698
runs-on: ubuntu-latest
8799
environment: deployment
88-
needs: build-test
100+
needs:
101+
- build-test
102+
- build-test-v2
103+
- build-test-v2-react-native
89104
if: ${{ needs.setup.outputs.has-changesets != 'true' }}
90105
steps:
91106
- name: Checkout repo

.github/workflows/publish-next.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ jobs:
7272
env:
7373
ENDPOINT: ${{ secrets.LIVENESS_BETA_SAMPLE_APP_BUILD_TRIGGER }}
7474

75+
build-test-v2:
76+
uses: ./.github/workflows/reusable-build-system-test.yml
77+
needs: publish
78+
with:
79+
dist-tag: next
80+
81+
build-test-v2-react-native:
82+
uses: ./.github/workflows/reusable-build-system-test-react-native.yml
83+
needs: publish
84+
with:
85+
dist-tag: next
86+
7587
build-test:
7688
needs: publish
7789
runs-on: ubuntu-latest
@@ -121,7 +133,10 @@ jobs:
121133
# Send a failure data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure
122134
runs-on: ubuntu-latest
123135
environment: ci
124-
needs: build-test
136+
needs:
137+
- build-test
138+
- build-test-v2
139+
- build-test-v2-react-native
125140
if: ${{ failure() }}
126141
steps:
127142
- name: Log failure data point to metric PublishNextFailure
@@ -136,7 +151,10 @@ jobs:
136151
# Send a success data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a success
137152
runs-on: ubuntu-latest
138153
environment: ci
139-
needs: build-test
154+
needs:
155+
- build-test
156+
- build-test-v2
157+
- build-test-v2-react-native
140158
if: ${{ success() }}
141159
steps:
142160
- name: Log success data point to metric PublishNextFailure

0 commit comments

Comments
 (0)