-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 1.83 KB
/
prod.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
name: Prod in Flight
on:
pull_request:
branches: [prod]
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
test:
runs-on: ubuntu-22.04
name: Build OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} && Run Mix Test
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: root
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
otp: ["26.2"]
elixir: ["1.16.3"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies for build
run: sudo apt-get update && sudo apt-get install -y libncurses-dev libtinfo5
- name: Setup Elixir and OTP
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Restore dependencies cache
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: mix deps.get
- name: Run tests
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
run: mix test
deploy:
needs: test
name: Build & Deploy to Fly
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to Fly.io
uses: superfly/flyctl-actions@master
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
FLY_APP: vyasa
with:
args: "deploy"