Skip to content

Commit

Permalink
Add a buildspec file for nightly tests (#2180)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcreaser committed Dec 15, 2022
1 parent e6848ef commit d24b15d
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions scripts/nightly-buildspec.yml
@@ -0,0 +1,85 @@
version: 0.2
# This file is used as part of the build process implemented using AWS CodeBuild [1].
# The CodeBuild documentation [2] provides an introduction of the service and its capabilities. In general
# terms, it allows us to configure the actions executed when a build is triggered by a commit to the
# amplify-android GitHub repository.
#
# For the purposes of this repo, we're simply running a build by using "./gradlew build"
# command and in the post-build phase, we consolidate the JUnit report files in one location.
# In the reports section, we're instructing CodeBuild to publish those reports which can be
# viewed in the AWS CodeBuild console (Future work will be to publish those to Github for easier access).
#
# [1] - https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
# [2] - https://docs.aws.amazon.com/codebuild/latest/userguide/planning.html
env:
shell: /bin/sh
phases:
install:
runtime-versions:
nodejs: 12
python: 3.8
java: corretto11
commands:
- echo 'Install phase starting'
- npm install -g xunit-viewer
- pip3 install junit-xml
### INSTALL ANDROID 31
- export ANDROID_TOOLS_FILENAME="commandlinetools-linux-9123335_latest.zip"
- wget https://dl.google.com/android/repository/$ANDROID_TOOLS_FILENAME -P ~ > /dev/null
- unzip ~/$ANDROID_TOOLS_FILENAME -d ~ > /dev/null 2>&1
- mkdir -p /usr/local/android-sdk-linux/cmdline-tools
- mv ~/cmdline-tools /usr/local/android-sdk-linux/cmdline-tools/latest
- export PATH=/usr/local/android-sdk-linux/cmdline-tools/latest:/usr/local/android-sdk-linux/cmdline-tools/latest/bin:/usr/local/android-sdk-linux/platform-tools:$PATH
- export ANDROID_SDK_ROOT=/usr/local/android-sdk-linux
- yes | sdkmanager --licenses > /dev/null
- sdkmanager "platform-tools" "platforms;android-31" > /dev/null
- sdkmanager "build-tools;31.0.0" > /dev/null
### END INSTALL ANDROID 31
finally:
- echo 'Install phase completed.'
pre_build:
commands:
- echo 'Pre-build phase starting'
- mkdir -p build/allTests
- |
if [[ -z "${CONFIG_SOURCE_BUCKET}" ]]; then
echo 'Pulling config files from Amplify'
JAVA_HOME=$JDK_11_HOME ./gradlew pullBackendConfigFromAmplify
else
echo 'Pulling config files from S3'
./scripts/pull_backend_config_from_s3 ${CONFIG_SOURCE_BUCKET}
fi
finally:
- echo 'Pre-build phase completed.'
build:
commands:
- echo 'Build phase starting.'
- JAVA_HOME=$JDK_11_HOME ./gradlew runNightlyTestsInDeviceFarmPool
finally:
- echo 'Build phase completed.'
post_build:
commands:
- echo 'Post-build phase starting'
- mkdir -p build/reports/instrumented
- xunit-viewer -r build/allTests -o build/reports/instrumented/${CODEBUILD_RESOLVED_SOURCE_VERSION}.html
finally:
- echo 'Post-build phase completed.'
reports:
amplify-android-devicefarm-tests:
files:
- '**/*'
base-directory: 'build/allTests'
discard-paths: no
file-format: JUNITXML
artifacts:
files:
- '**/*.apk'
name: AmplifyAndroidCatApks
discard-paths: yes
secondary-artifacts:
reports:
files:
- '**/*'
name: DevicefarmTestRunReport
base-directory: 'build/reports/instrumented'
discard-paths: no

0 comments on commit d24b15d

Please sign in to comment.