-
Notifications
You must be signed in to change notification settings - Fork 3
120 lines (99 loc) · 3.11 KB
/
ci.yml
File metadata and controls
120 lines (99 loc) · 3.11 KB
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
name: CI
on:
pull_request:
branches:
- main
- develop
env:
OTP_VERSION: "28"
GLEAM_VERSION: "1.14.0"
REBAR3_VERSION: "3"
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Erlang and Gleam
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
gleam-version: ${{ env.GLEAM_VERSION }}
rebar3-version: ${{ env.REBAR3_VERSION }}
- name: Download dependencies
run: gleam deps download
- name: Check code format
run: gleam format --check
- name: Build project
run: gleam build
- name: Patch http_client dependencies
uses: ./.github/actions/patch-dream-deps
with:
module_dir: modules/http_client
- name: Patch mock_server dependencies
uses: ./.github/actions/patch-dream-deps
with:
module_dir: modules/mock_server
- name: Run all unit tests
env:
CI: "true"
run: make test-unit
- name: Restore http_client dependencies
if: always()
uses: ./.github/actions/restore-dream-deps
with:
module_dir: modules/http_client
- name: Restore mock_server dependencies
if: always()
uses: ./.github/actions/restore-dream-deps
with:
module_dir: modules/mock_server
integration-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dream_example_database_db
ports:
- 5435:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Erlang and Gleam
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
gleam-version: ${{ env.GLEAM_VERSION }}
rebar3-version: ${{ env.REBAR3_VERSION }}
elixir-version: "1.18"
- name: Download dependencies
run: gleam deps download
- name: Build project
run: gleam build
- name: Setup database examples
env:
PGPASSWORD: postgres
DATABASE_URL: postgres://postgres:postgres@localhost:5435/dream_example_database_db
run: |
psql -h localhost -p 5435 -U postgres -c "CREATE DATABASE dream_example_multi_format_db;" || true
cd examples/database
gleam deps download
gleam run -m cigogne all
cd ../multi_format
gleam deps download
export DATABASE_URL=postgres://postgres:postgres@localhost:5435/dream_example_multi_format_db
gleam run -m cigogne all
- name: Run all integration tests
env:
CI: "true"
DATABASE_URL: postgres://postgres:postgres@localhost:5435/dream_example_database_db
POSTGRES_PORT: "5435"
run: make test-integration