New loco cli generator #223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "[loco-gen:e2e]" | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
RUST_TOOLCHAIN: stable | |
TOOLCHAIN_PROFILE: minimal | |
jobs: | |
test: | |
name: test-generate | |
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 --htmx 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 pages about --htmx && cargo build && cargo test pages | |
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: scheduler | |
run: cargo run -- generate scheduler | |
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: test-fields | |
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! \ | |
blob_null:blob \ | |
blob:blob! \ | |
money_null:money \ | |
money:money! \ | |
&& cargo build | |
working-directory: ./examples/demo | |
env: | |
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}} | |
DATABASE_URL: ${{matrix.db}} | |
- name: test ${{ matrix.field_type }} scaffold field type | |
run: | | |
cargo run -- generate scaffold --api room \ | |
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}} |