-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsemaphore.yml
103 lines (90 loc) · 3.37 KB
/
semaphore.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
# Use the latest stable version of Semaphore 2.0 YML syntax:
version: v1.0
# Name of your pipeline. In this example we connect two pipelines with
# a promotion, so it helps to differentiate what's the job of each.
name: Elixir Phoenix example CI pipeline on Semaphore
# An agent defines the environment in which your code runs.
# It is a combination of one of available machine types and operating
# system images. See:
# https://docs.semaphoreci.com/article/20-machine-types
# https://docs.semaphoreci.com/article/32-ubuntu-1804-image
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
# Blocks make up the structure of a pipeline and are executed sequentially.
# Each block has a task that defines one or many parallel jobs. Jobs define
# the commands to execute.
# See https://docs.semaphoreci.com/article/62-concepts
blocks:
- name: Set up
task:
jobs:
- name: compile and build plts
commands:
# Checkout code from Git repository. This step is mandatory if the
# job is to work with your code.
- checkout
- export LIVE_VIEW_SALT="$LIVE_VIEW_SALT"
- bin/setup_ci_elixir
- sem-version elixir 1.8.1
# Restore dependencies from cache, command won't fail if it's
# missing. More on caching:
# - https://docs.semaphoreci.com/article/149-caching
# - https://docs.semaphoreci.com/article/87-language-elixir
- cache restore
# Cache the PLT generated from the dialyzer to speed up pipeline process.
# As suggested here - https://github.com/jeremyjh/dialyxir#continuous-integration
# This will need to be rebuilt if elixir or erlang version changes.
- cache restore dialyzer-plt
- mix deps.get
- mix do compile, dialyzer --plt
- MIX_ENV=test mix compile
# Store deps after compilation, otherwise rebar3 deps (that is, most
# Erlang deps) won't be cached:
- cache store
- cache store dialyzer-plt priv/plts/
- name: Analyze code
task:
# Commands in prologue run at the beginning of each parallel job.
# https://docs.semaphoreci.com/article/50-pipeline-yaml
prologue:
commands:
- checkout
- export LIVE_VIEW_SALT="$LIVE_VIEW_SALT"
- bin/setup_ci_elixir
- sem-version elixir 1.8.1
- cache restore
- cache restore dialyzer-plt
# This block contains 3 parallel jobs:
jobs:
- name: credo
commands:
- mix credo -a
- name: dialyzer
commands:
- mix dialyzer --halt-exit-status --no-compile
- name: formatter
commands:
- mix format --check-formatted
- name: Run tests
task:
prologue:
commands:
- checkout
- export LIVE_VIEW_SALT="$LIVE_VIEW_SALT"
- bin/setup_ci_elixir
- sem-version elixir 1.8.1
- cache restore
jobs:
- name: ex_unit
# Define an environment variable
# See https://docs.semaphoreci.com/article/66-environment-variables-and-secrets
env_vars:
- name: DATABASE_URL
value: "ecto://postgres:@0.0.0.0:5432/sema_test"
commands:
# Start Postgres database service
# https://docs.semaphoreci.com/article/54-toolbox-reference#sem-service
- sem-service start postgres
- mix test