forked from aws/sagemaker-spark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
66 lines (57 loc) · 2.51 KB
/
buildspec.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
version: 0.2
phases:
install:
commands:
# install openjdk-8
- apt-get update
- apt-get -y install openjdk-8-jdk
- update-java-alternatives -s java-1.8.0-openjdk-amd64
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/bin
# install sbt launcher
- curl -LO https://github.com/sbt/sbt/releases/download/v1.1.6/sbt-1.1.6.tgz
- tar -xf sbt-*.tgz
- export PATH=$CODEBUILD_SRC_DIR/sbt/bin/:$PATH
- cd $CODEBUILD_SRC_DIR/sagemaker-spark-sdk
- sbt -Dsbt.log.noformat=true sbtVersion scalaVersion
pre_build:
commands:
# clone the integration test repo
- cd $CODEBUILD_SRC_DIR
- GITHUB_OAUTH_TOKEN=$(aws secretsmanager get-secret-value --secret-id /codebuild/github/oauth --query SecretString --output text)
- INTEGRATION_TEST_REPO_URI="https://${GITHUB_OAUTH_TOKEN}@github.com/aws/PRIVATE-sagemaker-spark-integ-tests.git"
- git clone --depth 1 --single-branch $INTEGRATION_TEST_REPO_URI integration-tests
build:
commands:
# build spark sdk first, since pyspark package depends on it (even linters)
# spark unit tests
- cd $CODEBUILD_SRC_DIR/sagemaker-spark-sdk
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=
sbt -Dsbt.log.noformat=true clean coverage test coverageReport
# rebuild without coverage instrumentation
- cd $CODEBUILD_SRC_DIR/sagemaker-spark-sdk
- sbt -Dsbt.log.noformat=true clean package
# pyspark linters and unit tests
- cd $CODEBUILD_SRC_DIR/sagemaker-pyspark-sdk
- tox -e flake8,twine,sphinx
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=
tox -e py27,py36,stats -- tests/
# spark integration tests
- cd $CODEBUILD_SRC_DIR/sagemaker-spark-sdk
- |
if has-matching-changes "src/" "test/" "build.sbt"; then
cd $CODEBUILD_SRC_DIR/integration-tests/sagemaker-spark-sdk
sbt -Dsbt.log.noformat=true it:test
else
echo "skipping spark integration tests"
fi
# pyspark integration tests
- cd $CODEBUILD_SRC_DIR/sagemaker-pyspark-sdk
- |
if has-matching-changes "src/" "tests/" "setup.*" "requirements.txt" "tox.ini"; then
IGNORE_COVERAGE=- \
tox -e py36 -- $CODEBUILD_SRC_DIR/integration-tests/sagemaker-pyspark-sdk/tests/ -n 10 --boxed --reruns 2
else
echo "skipping pyspark integration tests"
fi