Skip to content

Commit

Permalink
CI win32 wip (#724)
Browse files Browse the repository at this point in the history
prepare for win32 ci incl. migrations
  • Loading branch information
jondot authored Sep 1, 2024
1 parent 3461c65 commit 802b792
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 31 deletions.
61 changes: 34 additions & 27 deletions .github/workflows/e2e-cli-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,42 @@ on:
pull_request:

jobs:
saas-template-win32:
name: [WIN/loco-cli (master)] Create saas starter template
runs-on: windows-latest
# TODO: re-enable after 0.8 to check cmd spawning fix
# saas-template-win32:
# name: Create saas starter template (win32)
# runs-on: windows-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- run: |
cargo install --path .
# permissions:
# contents: read

ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=saas LOCO_TEMPLATE=saas loco new
working-directory: ./loco-cli
- run: |
ALLOW_IN_GIT_REPO=true loco new -n saas -t saas --db sqlite --bg async
- run: |
cargo build
working-directory: ./saas
- run: |
cargo loco generate scaffold movie title:string
working-directory: ./saas
- run: |
cargo build
working-directory: ./saas
# steps:
# - name: Checkout the code
# uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: nightly
# - run: |
# cargo install --path .
# working-directory: ./loco-cli
# - run: |
# loco new -n saas -t saas --db sqlite --bg async --assets none
# env:
# ALLOW_IN_GIT_REPO: true
# - run: |
# cargo build
# working-directory: ./saas
# - run: |
# cargo loco routes
# working-directory: ./saas
# - run: |
# cargo loco db migrate
# working-directory: ./saas
# - run: |
# cargo loco generate scaffold movie title:string
# working-directory: ./saas
# - run: |
# cargo loco db migrate
# working-directory: ./saas

saas-template:
name: Create saas starter template
Expand Down
6 changes: 3 additions & 3 deletions loco-cli/tests/cmd/starters/generate-starters.trycmd
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
```console
$ ALLOW_IN_GIT_REPO="" LOCO_APP_NAME="test_saas_template" LOCO_FOLDER_NAME=saas_template LOCO_TEMPLATE=saas loco new
$ ALLOW_IN_GIT_REPO="" LOCO_APP_NAME="test_saas_template" LOCO_FOLDER_NAME=saas_template LOCO_TEMPLATE=saas loco new --db postgres --assets none --bg async

🚂 Loco app generated successfully in:
[CWD]/test_saas_template

```

```console
$ ALLOW_IN_GIT_REPO="true" LOCO_APP_NAME="test_rest_api_template" LOCO_FOLDER_NAME=rest_api_template LOCO_TEMPLATE=rest-api loco new
$ ALLOW_IN_GIT_REPO="true" LOCO_APP_NAME="test_rest_api_template" LOCO_FOLDER_NAME=rest_api_template LOCO_TEMPLATE=rest-api loco new --db sqlite --bg async

🚂 Loco app generated successfully in:
[CWD]/test_rest_api_template

```

```console
$ ALLOW_IN_GIT_REPO="true" LOCO_APP_NAME="test_lightweight_template" LOCO_FOLDER_NAME=lightweight_template LOCO_TEMPLATE=lightweight-service loco new
$ ALLOW_IN_GIT_REPO="true" LOCO_APP_NAME="test_lightweight_template" LOCO_FOLDER_NAME=lightweight_template LOCO_TEMPLATE=lightweight-service loco new

🚂 Loco app generated successfully in:
[CWD]/test_lightweight_template
Expand Down
6 changes: 5 additions & 1 deletion src/gen/model.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::env::current_dir;
use std::{collections::HashMap, env::current_dir};

use chrono::Utc;
use duct::cmd;
Expand Down Expand Up @@ -60,9 +60,12 @@ pub fn generate<H: Hooks>(

if !migration_only {
let cwd = current_dir()?;
let env_map: HashMap<_, _> = std::env::vars().collect();

let _ = cmd!("cargo", "loco", "db", "migrate",)
.stderr_to_stdout()
.dir(cwd.as_path())
.full_env(&env_map)
.run()
.map_err(|err| {
Error::Message(format!(
Expand All @@ -72,6 +75,7 @@ pub fn generate<H: Hooks>(
let _ = cmd!("cargo", "loco", "db", "entities",)
.stderr_to_stdout()
.dir(cwd.as_path())
.full_env(&env_map)
.run()
.map_err(|err| {
Error::Message(format!(
Expand Down

0 comments on commit 802b792

Please sign in to comment.