-
Notifications
You must be signed in to change notification settings - Fork 14
97 lines (78 loc) · 2.1 KB
/
cd.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
name: CD
on:
push:
branches: [main]
env:
OTP_VERSION: "26"
ELIXIR_VERSION: "1.15"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build_test:
name: Build & Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Checkout Repository
uses: actions/checkout@v4
- name: Cache deps
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-deps-
- name: Cache build
uses: actions/cache@v4
with:
path: _build
key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-build-
${{ runner.os }}-mix-
- name: Clean caches on workflow retry
if: github.run_attempt != '1'
run: |
mix deps.clean --all
mix clean
shell: sh
- name: Install Dependencies
run: mix deps.get
- name: Compiles without warnings
run: mix compile --warnings-as-errors
- name: Check Code Style
run: mix credo --strict
- name: Check Formatting
run: mix format --check-formatted
- name: Run Tests
run: mix test
deploy:
name: Deploy
runs-on: ubuntu-latest
needs:
- build_test
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}