-
Notifications
You must be signed in to change notification settings - Fork 24
/
circle.yml
89 lines (84 loc) · 2.75 KB
/
circle.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
version: 2.1
workflows:
version: 2
default:
jobs:
- build
- release:
filters:
branches:
only: master
tags:
only: /^v.*/
jobs:
build:
working_directory: ~/code
docker:
- image: mbgl/android-ndk-r21e:latest
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "library/build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "library/build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}
- run:
name: Check code style
command: make checkstyle
- run:
name: Run Lint
command: ./gradlew lint
- run:
name: Run unit-test in Android libraries
command: make test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
# ------------------------------------------------------------------------------
release:
docker:
- image: mbgl/android-ndk-r21e:latest
working_directory: ~/code
steps:
- checkout
- init-aws
- run:
name: Update version name
command: |
if [[ $CIRCLE_TAG == v* ]]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${CIRCLE_TAG:1}/" library/gradle.properties
elif [[ $CIRCLE_BRANCH == master ]]; then
COMMIT_SHA=$(git rev-parse --short HEAD)
sed -i -e "s/-SNAPSHOT.*/-${COMMIT_SHA}-SNAPSHOT/" library/gradle.properties
fi
- run:
name: Build libraries
command: make release
- deploy:
name: Publish to the SDK registry
command: |
git config --global user.email "[email protected]"
git config --global user.name "MapboxCI"
export GITHUB_TOKEN=$(./mbx-ci github writer private token)
if [[ $CIRCLE_BRANCH == master ]] || [[ $CIRCLE_TAG == v* ]]; then
make sdkRegistryUpload
fi
if [[ $CIRCLE_TAG == v* ]]; then
make sdkRegistryPublish
fi
commands:
init-aws:
steps:
- run:
name: Init aws with mbx-ci
command: |
curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64 > mbx-ci && chmod 755 ./mbx-ci
./mbx-ci aws setup