-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwercker.yml
146 lines (128 loc) · 4.41 KB
/
wercker.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
# Obtained and modified from:
# https://engineering.appcues.com/2015/12/21/elixir-wercker.html
box: grvtylabs/phoenix:1.2.1
build:
services:
- id: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
steps:
- script:
name: Set envs and get versions
code: |
export MIX_ENV=test
export PROJECT_DIR="visualfest"
export LOGS_PATH=/pipeline/source/$PROJECT_DIR/wercker-logs
export ERL_CRASH_DUMP=$LOGS_PATH/erl_crash.dump
bash -c "echo 'Node version: $(node -v)'"
bash -c "echo 'NPM version: $(npm -v)'"
bash -c "echo 'Elixir version: $(elixir -v)'"
bash -c "echo 'Phoenix version: $(mix phoenix.new -v)'"
mkdir -p $LOGS_PATH
touch $LOGS_PATH/erl_crash.dump
# Fix for error: Failed to restore d:/phoenix/northwind/deps/idna/.rebar3/erlcinfo file. Discarding it
# Apparently it doesn't recognize IDNA, comment
# - script:
# name: IDNA Fix
# cwd: /pipeline/source/$PROJECT_DIR
# code: |
# pwd
# yes | bash -c "mix do deps.clean idna, deps.compile idna >> $LOGS_PATH/deps.txt 2>&1"
- script:
name: Elixir Dependencies Get
cwd: /pipeline/source/$PROJECT_DIR
code: |
elixir --erl '-smp disable' /usr/local/bin/mix deps.get >> $LOGS_PATH/depsget.txt 2>&1
- script:
name: Elixir Dependencies Compile
cwd: /pipeline/source/$PROJECT_DIR
code: |
elixir --erl '-smp disable' /usr/local/bin/mix deps.compile >> $LOGS_PATH/depscompile.txt 2>&1
- script:
name: Compile Project
cwd: /pipeline/source/$PROJECT_DIR
code: |
elixir --erl '-smp disable' /usr/local/bin/mix compile --long-compilation-threshold 60 >> $LOGS_PATH/compile.txt 2>&1
- script:
name: Database Test
cwd: /pipeline/source/$PROJECT_DIR
code: |
env
# while ! nc -q 1 $POSTGRES_PORT_5432_TCP_ADDR $POSTGRES_PORT_5432_TCP_PORT </dev/null; do sleep 3; done
elixir --erl '-smp disable' /usr/local/bin/mix do ecto.create, ecto.setup, ecto.migrate >> $LOGS_PATH/database.txt 2>&1
- script:
name: Project Tests
cwd: /pipeline/source/$PROJECT_DIR
code: |
mix test --trace >> $LOGS_PATH/test.txt 2>&1
after-steps:
- script:
name: Crash export
code: |
export PROJECT_DIR="visualfest"
export LOGS_PATH=/pipeline/source/$PROJECT_DIR/wercker-logs
export ERL_CRASH_DUMP=$LOGS_PATH/erl_crash.dump
echo ""
echo "===================================================="
echo "ERL_CRASH.DUMP"
cat $ERL_CRASH_DUMP
echo ""
echo "===================================================="
echo "DEPENDENCIES - GET"
cat $LOGS_PATH/depsget.txt
echo ""
echo "===================================================="
echo "DEPENDENCIES - COMPILE"
cat $LOGS_PATH/depscompile.txt
echo ""
echo "===================================================="
echo "COMPILE"
cat $LOGS_PATH/compile.txt
echo ""
echo "===================================================="
echo "DATABASE"
cat $LOGS_PATH/database.txt
echo ""
echo "===================================================="
echo "TESTS"
cat $LOGS_PATH/test.txt
- wercker/[email protected]: # Organization vars
url: $SLACK_URL
channel: $SLACK_CHANNEL
icon_url: $SLACK_ICON
username: $SLACK_USER
deploy:
steps:
- script:
name: set env vars
code: |
export MIX_ENV=prod
- script:
name: get and compile prod deps
code: |
cd $WERCKER_SOURCE_DIR
cd $PROJECT_DIR
yes | mix do deps.get --only prod, deps.compile
- script:
name: prod compile
code: |
yes | mix compile
- script:
name: webpack build
code: |
node node_modules/webpack/bin/webpack -p
- script:
name: phoenix digest
code: |
mix phoenix.digest
- script:
name: migrate db
code: |
mix ecto.migrate
after-steps:
- wercker/[email protected]: # Organization vars
url: $SLACK_URL
channel: $SLACK_CHANNEL
icon_url: $SLACK_ICON
username: $SLACK_USER