Skip to content

Commit

Permalink
ci: add gen deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Dec 7, 2024
1 parent 9130f18 commit bfa4222
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/loco-gen-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "[loco-gen-deploy]"

on:
push:
branches:
- master
pull_request:

env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal

jobs:
test:
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:
run: cargo run -- generate deployment && docker build -t demo .
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
1 change: 1 addition & 0 deletions loco-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl FromStr for DeploymentKind {
match s.to_lowercase().as_str() {
"docker" => Ok(Self::Docker),
"shuttle" => Ok(Self::Shuttle),
"ngnix" => Ok(Self::Nginx),
_ => Err(()),
}
}
Expand Down

0 comments on commit bfa4222

Please sign in to comment.