-
-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (159 loc) · 5.26 KB
/
ci.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
name: CI
on:
# This action is triggered on any branch that opens a pull request.
push:
branches:
- "*"
# This action is not triggered when markdown files are modified.
paths-ignore:
- '**.md'
pull_request:
branches:
- "*"
# This action is not triggered when markdown files are modified.
paths-ignore:
- '**.md'
env:
# Permissions env
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# General env
ELIXIR_VERSION: 1.14
OTP_VERSION: 25.2
# Postgres env
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_HOSTNAME: localhost
# Redis env
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_PASS: '123456'
# Misc env
UPLOADS_PATH: "priv/static/uploads/"
FINNHUB_API_KEY: ${{ secrets.FINNHUB_API_KEY }}
CAFECITO_USERNAME: ${{ secrets.CAFECITO_USERNAME }}
jobs:
dev:
runs-on: ubuntu-22.04
services:
db:
image: postgres
ports: ['5432:5432']
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Setup & run Redis -----------------------------------------------------
- name: Run redis with a password
shell: bash
run: |
docker run \
--rm \
--name redis \
-p ${{ env.REDIS_PORT }}:6379 \
-d redis:6-alpine redis-server \
--appendonly yes \
--requirepass ${{ env.REDIS_PASS }} \
--port ${{ env.REDIS_PORT }}
# Run the dev action ----------------------------------------------------
- uses: actions/checkout@v2.3.4
- name: Run Development Checks
uses: ./.github/actions/dev
with:
CURRENCY_SUPPLIER: currency-supplier
CURRENCY_SUPPLIER_PRODUCER_NAME: CurrencySupplierProducer
CEDEAR_SUPPLIER: cedear-supplier
CEDEAR_SUPPLIER_PRODUCER_NAME: CedearSupplierProducer
ELIXIR_VERSION: ${{ env.ELIXIR_VERSION }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
MIX_ENV: dev
OTP_VERSION: ${{ env.OTP_VERSION }}
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
REDIS_HOST: ${{ env.REDIS_HOST }}
REDIS_PASS: ${{ env.REDIS_PASS }}
UPLOADS_PATH: ${{ env.UPLOADS_PATH }}
FINNHUB_API_KEY: ${{ env.FINNHUB_API_KEY }}
CAFECITO_USERNAME: ${{ env.CAFECITO_USERNAME }}
test:
runs-on: ubuntu-22.04
services:
db:
image: postgres
ports: ['5432:5432']
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Setup & run Redis -----------------------------------------------------
- name: Run redis with a password
shell: bash
run: |
docker run \
--rm \
--name redis \
-p ${{ env.REDIS_PORT }}:6379 \
-d redis:6-alpine redis-server \
--appendonly yes \
--requirepass ${{ env.REDIS_PASS }} \
--port ${{ env.REDIS_PORT }}
# Run the test action ---------------------------------------------------
- uses: actions/checkout@v2.3.4
- name: Run Unit Tests
uses: ./.github/actions/test
with:
CURRENCY_SUPPLIER: currency-supplier
CURRENCY_SUPPLIER_PRODUCER_NAME: CurrencySupplierProducer
CEDEAR_SUPPLIER: cedear-supplier
CEDEAR_SUPPLIER_PRODUCER_NAME: CedearSupplierProducer
ELIXIR_VERSION: ${{ env.ELIXIR_VERSION }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
MIX_ENV: test
OTP_VERSION: ${{ env.OTP_VERSION }}
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
REDIS_HOST: ${{ env.REDIS_HOST }}
REDIS_PASS: ${{ env.REDIS_PASS }}
UPLOADS_PATH: ${{ env.UPLOADS_PATH }}
FINNHUB_API_KEY: ${{ env.FINNHUB_API_KEY }}
CAFECITO_USERNAME: ${{ env.CAFECITO_USERNAME }}
prod:
runs-on: ubuntu-22.04
services:
db:
image: postgres
ports: ['5432:5432']
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2.3.4
- name: Assemble release
uses: ./.github/actions/prod
with:
ELIXIR_VERSION: ${{ env.ELIXIR_VERSION }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
MIX_ENV: prod
OTP_VERSION: ${{ env.OTP_VERSION }}
POSTGRES_HOSTNAME: ${{ env.POSTGRES_HOSTNAME }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
REDIS_HOST: ${{ env.REDIS_HOST }}
REDIS_PASS: ${{ env.REDIS_PASS }}
UPLOADS_PATH: ${{ env.UPLOADS_PATH }}
FINNHUB_API_KEY: ${{ env.FINNHUB_API_KEY }}
CAFECITO_USERNAME: ${{ env.CAFECITO_USERNAME }}