This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
buildspec.yml
105 lines (94 loc) · 3.09 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
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
version: 0.2
env:
variables:
AWS_DEFAULT_REGION: eu-central-1
CI: 1
phases:
install:
runtime-versions:
nodejs: 14
commands:
- echo "Installing python 2.7"
- apt-get update && apt-get install -y python2.7 python2.7-dev build-essential
- pip install virtualenv==20.21.1
- n 10
pre_build:
commands:
- echo "Configuring stuff..."
- aws --version
- export NODE_VERSION=$(node --version | cut -c2-)
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- GIT_BRANCH=${CODEBUILD_WEBHOOK_HEAD_REF#refs/heads/*}
- export DEPLOY_GIT_BRANCH=${GIT_BRANCH}
- TODAY=$(date '+%Y%m%d')
- |-
if [ "${CODEBUILD_WEBHOOK_TRIGGER}" = pr/* ]; then
PULL_REQUEST=${CODEBUILD_WEBHOOK_TRIGGER#pr/*}
fi
- |-
if [ "${GIT_BRANCH}" != master ]; then
LATEST=${GIT_BRANCH:-staging}
else
LATEST=latest
fi
- export BUILD_TYPE=dev
- if [ "${GIT_BRANCH}" = "master" ] ; then
export BUILD_TYPE=prod;
fi
- echo "=========== VERSIONS ============="
- python --version
- python2 --version
- pip --version
- virtualenv --version
- bash --version
- echo "=========== VARIABLES ============="
- echo CODEBUILD_RESOLVED_SOURCE_VERSION=${CODEBUILD_RESOLVED_SOURCE_VERSION}
- echo CODEBUILD_SOURCE_VERSION=${CODEBUILD_SOURCE_VERSION}
- echo CODEBUILD_WEBHOOK_BASE_REF=${CODEBUILD_WEBHOOK_BASE_REF}
- echo CODEBUILD_WEBHOOK_HEAD_REF=${CODEBUILD_WEBHOOK_HEAD_REF=}
- echo CODEBUILD_WEBHOOK_TRIGGER=${CODEBUILD_WEBHOOK_TRIGGER}
- echo CODEBUILD_SOURCE_VERSION=${CODEBUILD_SOURCE_VERSION}
- echo CODEBUILD_BUILD_ID=${CODEBUILD_BUILD_ID}
- echo CODEBUILD_SOURCE_REPO_URL=${CODEBUILD_SOURCE_REPO_URL}
- echo COMMIT_HASH=${COMMIT_HASH}
- echo PULL_REQUEST=${PULL_REQUEST}
- echo GIT_BRANCH=${GIT_BRANCH}
- echo STAGING=${STAGING}
- echo BUILD_TYPE=${BUILD_TYPE}
- echo "==================================="
- make env
- npm install
- echo "=== Install dependencies =========="
- make ci
build:
commands:
- echo "=== Build started on `date` ======="
- make ${STAGING}
- echo Build completed on `date`
- |
echo Get application version
export APP_VERSION=$(cat .build-artefacts/last-version)
post_build:
commands:
# Suppress status outputs
- echo "=== Test started on `date` ========"
- make testdebug
- make testrelease
- echo Test completed on `date`
# Deploy it to dev if not on master branch
# - |
# if [ "${GIT_BRANCH}" != master ]; then
# make s3deploydev
# make s3activatedev VERSION=${APP_VERSION}
# fi
reports:
tests:
files:
- "junit-reports/**/*"
file-format: JunitXml
artifacts:
# The name below is only used for manual build (not by build started by the webhook)
name: ${BUILD_TYPE}/mf-geoadmin3/${APP_VERSION}
files:
- '**/*'
base-directory: dist