diff --git a/.github/workflows/e2e-cli-master.yaml b/.github/workflows/e2e-cli-master.yaml index 76a1971a5..ece4d2d14 100644 --- a/.github/workflows/e2e-cli-master.yaml +++ b/.github/workflows/e2e-cli-master.yaml @@ -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 diff --git a/loco-cli/tests/cmd/starters/generate-starters.trycmd b/loco-cli/tests/cmd/starters/generate-starters.trycmd index dd59cfc53..4a93df5c5 100644 --- a/loco-cli/tests/cmd/starters/generate-starters.trycmd +++ b/loco-cli/tests/cmd/starters/generate-starters.trycmd @@ -1,5 +1,5 @@ ```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 @@ -7,7 +7,7 @@ $ ALLOW_IN_GIT_REPO="" LOCO_APP_NAME="test_saas_template" LOCO_FOLDER_NAME=saas_ ``` ```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 @@ -15,7 +15,7 @@ $ ALLOW_IN_GIT_REPO="true" LOCO_APP_NAME="test_rest_api_template" LOCO_FOLDER_NA ``` ```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 diff --git a/src/gen/model.rs b/src/gen/model.rs index f949912b5..8870dd5db 100644 --- a/src/gen/model.rs +++ b/src/gen/model.rs @@ -1,4 +1,4 @@ -use std::env::current_dir; +use std::{collections::HashMap, env::current_dir}; use chrono::Utc; use duct::cmd; @@ -60,9 +60,12 @@ pub fn generate( 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!( @@ -72,6 +75,7 @@ pub fn generate( let _ = cmd!("cargo", "loco", "db", "entities",) .stderr_to_stdout() .dir(cwd.as_path()) + .full_env(&env_map) .run() .map_err(|err| { Error::Message(format!(