From d4ddfee43c06f8e6ba1821bd0a8cc922518b74a7 Mon Sep 17 00:00:00 2001 From: Elad Kaplan Date: Tue, 14 Jan 2025 14:12:00 +0200 Subject: [PATCH] now add sanity tests --- .github/workflows/loco-rs-ci-sanity.yml | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/loco-rs-ci-sanity.yml diff --git a/.github/workflows/loco-rs-ci-sanity.yml b/.github/workflows/loco-rs-ci-sanity.yml new file mode 100644 index 000000000..db00c61fb --- /dev/null +++ b/.github/workflows/loco-rs-ci-sanity.yml @@ -0,0 +1,69 @@ +# To optimize CI runtime: +# A simpler "sanity check" workflow is introduced. +# This workflow only runs if changes in the PR do NOT include +# the `loco-gen` or `loco-new` paths. +# (When changes are made to `loco-gen` or `loco-new`, +# we run comprehensive tests to validate every generator command +# and template option.) + +# Purpose of the sanity check: +# It performs basic validation by comparing the local changes +# against the templates. +# If any breaking changes are detected in the templates, +# the sanity check will fail, signaling an issue. + +name: "[loco_rs:sanity]" + +on: + push: + branches: + - master + paths-ignore: + - "loco-gen/**" + - "loco-new/**" + pull_request: + paths-ignore: + - "loco-gen/**" + - "loco-new/**" + +env: + RUST_TOOLCHAIN: stable + TOOLCHAIN_PROFILE: minimal + +jobs: + sanity: + runs-on: ubuntu-latest + + permissions: + contents: read + + 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 + + - run: cargo install --path ../loco-new + + - run: | + loco new -n myappdb --db sqlite --bg async --assets serverside -a + cd myappdb + cargo check + + env: + LOCO_DEV_MODE_PATH: ${{ github.workspace }} + + - run: | + loco new -n myappnodb --db none --bg none --assets none -a + cd myappdb + cargo check + env: + LOCO_DEV_MODE_PATH: ${{ github.workspace }} + + \ No newline at end of file