Skip to content

Commit

Permalink
fixed independent features (#1177)
Browse files Browse the repository at this point in the history
* run cargo-hack in ci

* fix needs

* now add sanity tests

* fix path
  • Loading branch information
kaplanelad authored Jan 14, 2025
1 parent ff701ac commit 774366a
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/loco-gen-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on:
push:
branches:
- master
paths:
- "loco-gen/**"
pull_request:
paths:
- "loco-gen/**"

env:
RUST_TOOLCHAIN: stable
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/loco-gen-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on:
push:
branches:
- master
paths:
- "loco-gen/**"
pull_request:
paths:
- "loco-gen/**"

env:
RUST_TOOLCHAIN: stable
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/loco-rs-ci-sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 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 }}
22 changes: 21 additions & 1 deletion .github/workflows/loco-rs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,30 @@ jobs:
command: clippy
args: --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms

test:
check:
needs: [style]
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
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- run: cargo hack check --each-feature

test:
needs: [check, style]
runs-on: ubuntu-latest

permissions:
contents: read

Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ lettre = { version = "0.11.4", default-features = false, features = [
include_dir = "0.7.3"
thiserror = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tracing-subscriber = { version = "0.3.16", features = ["env-filter", "json"] }
tracing-appender = "0.2.3"

duct = { version = "0.13.6" }
Expand Down Expand Up @@ -146,6 +146,7 @@ english-to-cron = { version = "0.1.2" }
# bg_sqlt: sqlite workers
# bg_pg: postgres workers
sqlx = { version = "0.8.2", default-features = false, features = [
"json",
"postgres",
"chrono",
"sqlite",
Expand Down

0 comments on commit 774366a

Please sign in to comment.