forked from AGSaidi/amazon-kinesis-producer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
175 lines (175 loc) · 9.72 KB
/
.travis.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
matrix:
include:
- name: "Build C++/Java and Upload to S3 on AL2012"
os: linux
services: docker
dist: trusty
before_install:
- echo "################################################################################"
- echo "Installing Dependencies for Linux/x86_64"
- echo "################################################################################"
- sudo apt-get update
- sudo apt-get install python3
- sudo apt-get -y install python3-pip
- pip3 --version
- pip3 install --user awscli
- mkdir -p ~/.aws
- |
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = $AWS_ACCESS_KEY_ID
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY
- cat <<'EOF' >> ~/.aws/credentials
- echo "################################################################################"
- echo "SUCCESS Installed Dependencies for Linux/x86_64"
- echo "################################################################################"
script:
- echo "################################################################################"
- echo "Starting build phase for Linux/x86_64"
- echo "################################################################################"
- $(aws ecr get-login --no-include-email --region us-west-2)
- echo "Getting Docker image for AL2012 build of KPL..."
- docker pull 056543101242.dkr.ecr.us-west-2.amazonaws.com/kinesis-producer-library-builder:latest
- ls
- df -h
- echo "Building KPL in current directory in the Container..."
- docker run --memory 9g -v $(pwd):/kpl -it 056543101242.dkr.ecr.us-west-2.amazonaws.com/kinesis-producer-library-builder:latest /bin/bash -c "export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY && export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID && cd /kpl && ls && ./bootstrap.sh"
- cd java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/$TRAVIS_OS_NAME-`uname -m`
- ls
- sudo zip kinesis-producer.zip kinesis_producer
- echo "Uploading build artifacts for KPL built on Linux..."
- aws s3 cp kinesis-producer.zip s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/$TRAVIS_OS_NAME-`uname -m`/kinesis-producer.zip
- echo "################################################################################"
- echo "SUCCESS Build phase for Linux/x86_64, complete. Check for any errors reported"
- echo "################################################################################"
- name: "Build C++/Java and Upload to S3 on AL2/Arm64"
os: linux
arch: arm64-graviton2
virt: vm
services: docker
dist: focal
before_install:
- echo "################################################################################"
- echo "Installing Dependencies for Linux/arm64"
- echo "################################################################################"
- sudo apt-get update
- sudo apt-get install python3
- sudo apt-get -y install python3-pip
- pip3 --version
- pip3 install --user awscli
- mkdir -p ~/.aws
- |
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = $AWS_ACCESS_KEY_ID
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY
- cat <<'EOF' >> ~/.aws/credentials
- echo "################################################################################"
- echo "SUCCESS Installed Dependencies for Linux/arm64"
- echo "################################################################################"
script:
- echo "################################################################################"
- echo "Starting build phase for Linux/arm64"
- echo "################################################################################"
- $(aws ecr get-login --no-include-email --region us-west-2)
- echo "Getting Docker image for AL2/Arm64 build of KPL..."
- docker pull amazonlinux:2
- ls
- df -h
- echo "Building KPL in current directory in the Container..."
- docker run --memory 9g -v $(pwd):/kpl -it amazonlinux:2 /bin/bash -c "yum install -y -q cmake3 gcc gcc-c++ make file tar gzip which perl git libuuid libuuid-devel maven zlib zlib-devel zlib-static && cd /kpl && ls && ./bootstrap.sh"
- cd java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/$TRAVIS_OS_NAME-`uname -m`
- ls
- sudo zip kinesis-producer.zip kinesis_producer
- echo "Uploading build artifacts for KPL built on Linux Arm64..."
- aws s3 cp kinesis-producer.zip s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/$TRAVIS_OS_NAME-`uname -m`/kinesis-producer.zip
- echo "################################################################################"
- echo "SUCCESS Build phase for Linux/arm64, complete. Check for any errors reported"
- echo "################################################################################"
- name: "Build C++/Java and Upload to S3 on OSX"
os: osx
compiler: clang
osx_image: xcode9.3
addons:
homebrew:
packages:
- ant
- awscli
update: true
script:
- DIR=$(pwd)
- ./bootstrap.sh
- cd java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/$TRAVIS_OS_NAME-`uname -m`
- zip kinesis-producer.zip kinesis_producer
- aws s3 cp kinesis-producer.zip s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/$TRAVIS_OS_NAME-`uname -m`/kinesis-producer.zip
- echo "################################################################################"
- echo "Finished building KPL on OSX...Starting Bundling of Linux/x86_64 with OSX binaries"
- echo "################################################################################"
- test -e $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/osx-`uname -m`/kinesis_producer
- aws s3 cp s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/linux-x86_64/kinesis-producer.zip linux-x86_64-binaries.zip
- mkdir -p java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-x86_64/
- unzip linux-x86_64-binaries.zip -d $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-x86_64/
- cd $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-x86_64/
- pwd
- ls
- test -e $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-x86_64/kinesis_producer
- cd $DIR
- pwd
- ls
- echo "################################################################################"
- echo "Starting Bundling of Linux/arm64 with OSX binaries"
- echo "################################################################################"
- aws s3 cp s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/linux-aarch64/kinesis-producer.zip linux-aarch64-binaries.zip
- mkdir -p java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-aarch64/
- unzip linux-aarch64-binaries.zip -d $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-aarch64/
- cd $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-aarch64/
- pwd
- ls
- test -e $DIR/java/amazon-kinesis-producer/src/main/resources/amazon-kinesis-producer-native-binaries/linux-aarch64/kinesis_producer
- cd $DIR
- pwd
- ls
- echo "################################################################################"
- echo "Starting the build phase for amazon-kinesis-producer and amazon-kinesis-producer-sample $KPL_VERSION"
- echo "################################################################################"
- cd $DIR/java/amazon-kinesis-producer/
- pwd
- ls
- mvn clean package source:jar javadoc:jar install
- cd $DIR
- pwd
- ls
- cd $DIR/java/amazon-kinesis-producer-sample/
- mvn clean package
- cd $DIR
- pwd
- ls
- cd $DIR/java/amazon-kinesis-producer/target
- pwd
- ls
- zip -R amazon-kinesis-producer-jars.zip '*.jar'
- aws s3 cp $DIR/java/amazon-kinesis-producer/target/amazon-kinesis-producer-jars.zip s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/release/amazon-kinesis-producer-jars.zip
- cd $DIR
- pwd
- ls
- cd $DIR/java/amazon-kinesis-producer-sample/target
- pwd
- ls
- aws s3 cp $DIR/java/amazon-kinesis-producer-sample/target/amazon-kinesis-producer-sample-1.0.0.jar s3://kpl-build-kinesis-internal/$KPL_VERSION-$HASH/release/amazon-kinesis-producer-sample-1.0.0.jar
- cd $DIR
- pwd
- ls
- echo "################################################################################"
- echo "SUCCESS, Uploaded Zipped Release Artifacts"
- echo "################################################################################"
before_script:
- cd java/amazon-kinesis-producer
- HASH=$(git rev-parse HEAD)
- KPL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
- echo "Found KPL version $KPL_VERSION in current directory $PWD ... "
- echo "Starting Packaging of KPL.$KPL_VERSION"
- cd ../..
after_success:
- sleep 10
after_failure:
- sleep 10