forked from loco-rs/loco
-
Notifications
You must be signed in to change notification settings - Fork 0
203 lines (183 loc) · 6.4 KB
/
ci-generators.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: ci-generators
on:
push:
branches:
- master
pull_request:
env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
postgres:
image: postgres
env:
POSTGRES_DB: postgres_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
# Set health checks to wait until postgres has started
options: --health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install seaorm cli
run: cargo install sea-orm-cli
- name: scaffold
run: cargo run -- generate scaffold car name:string year:int && cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
- name: model
run: cargo run -- generate model post title:string content:text && cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
- name: controller
run: cargo run -- generate controller post && cargo build && cargo test requests::post
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
- name: worker
run: cargo run -- generate worker report_worker && cargo build && cargo test workers::report_worker::test_run_report_worker_worker
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
- name: mailer
run: cargo run -- generate mailer birthday_mailer && cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
- name: task
run: cargo run -- generate task mytask && cargo build && cargo test tasks::mytask::test_can_run_mytask
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
- name: docker deployment
run: cargo run -- generate deployment
working-directory: ./examples/demo
env:
LOCO_DEPLOYMENT_KIND: docker
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
model_fields_generator:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
db:
- "postgres://postgres:postgres@localhost:5432/postgres_test"
# XXX: need to clean up demo first
# - "sqlite://loco_app.sqlite?mode=rwc"
permissions:
contents: read
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
postgres:
image: postgres
env:
POSTGRES_DB: postgres_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
# Set health checks to wait until postgres has started
options: --health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install seaorm cli
run: cargo install sea-orm-cli
- name: test ${{ matrix.field_type }} model field type
run: |
cargo run -- generate model post \
uuid_uniq:uuid \
uuid_null:uuid_col \
uuid:uuid_col! \
string_null:string \
string:string! \
string_uniq:string^ \
text_null:text \
text:text! \
tiny_integer_null:tiny_int \
tiny_integer:tiny_int! \
tiny_integer_uniq:tiny_int^ \
small_integer_null:small_int \
small_integer:small_int! \
small_integer_uniq:small_int^ \
integer_null:int \
integer:int! \
integer_uniq:int^ \
big_integer_null:big_int \
big_integer:big_int! \
big_integer_uniq:big_int^ \
float_null:float \
float:float! \
double_null:double \
double:double! \
decimal_null:decimal \
decimal:decimal! \
decimal_len_null:decimal_len \
decimal_len:decimal_len! \
boolean_null:bool \
boolean:bool! \
timestamp_with_time_zone_null:tstz \
timestamp_with_time_zone:tstz! \
date_null:date \
date:date! \
timestamp_null:ts \
timestamp:ts! \
json_null:json \
json:json! \
json_binary_null:jsonb \
json_binary:jsonb! \
&& cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: ${{matrix.db}}