Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI win32 wip #724

Merged
merged 18 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading