-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (90 loc) · 2.94 KB
/
workflow.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
name: Timo workflow
on: [push]
jobs:
build_and_test_backend:
name: Builds and test backend
runs-on: ubuntu-latest
env:
MIX_ENV: test
services:
db:
image: postgres:12.1
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v2
- name: Setup elixir
uses: actions/setup-elixir@v1
with:
otp-version: '25.0'
elixir-version: '1.13.4'
experimental-otp: true
- name: Get phoenix dependencies
working-directory: ./timo_backend
run: |
mix deps.get
mix deps.compile
- name: Compile with warnings as errors
working-directory: ./timo_backend
run: mix compile --warnings-as-errors
- name: Check format
working-directory: ./timo_backend
run: mix format --check-formatted
- name: Run phoenix tests
working-directory: ./timo_backend
run: mix test
build_and_test_frontend:
name: Builds and test frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install ember
run: npm install -g ember-cli@3.28.3
- name: Yarn dependencies
working-directory: ./timo_frontend
run: yarn install
- name: Run ember tests
working-directory: ./timo_frontend
run: ember test
deploy_backend:
name: Deploy backend to heroku
needs: [build_and_test_backend, build_and_test_frontend]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.0.4
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "timo-backend"
heroku_email: ${{ secrets.HEROKU_EMAIL }}
- name: Run migrations
run: heroku run "POOL_SIZE=2 cd timo_backend && mix ecto.migrate"
deploy_frontend:
name: Deploy frontend to Netlify with own domain
needs: [build_and_test_backend, build_and_test_frontend]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Setup Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install ember
run: npm install -g ember-cli@3.28.3
- name: Yarn dependencies
working-directory: ./timo_frontend
run: yarn install
- name: Build ember project
working-directory: ./timo_frontend
run: ember build --environment production
- name: Install netlify-cli
run: npm install netlify-cli -g
- name: Deploy to timo.mimiquate.xyz with netlify-cli
run: netlify deploy --prod --dir=timo_frontend/dist --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} --site=${{ secrets.NETLIFY_SITE_ID }}