84 lines
1.9 KiB
YAML
84 lines
1.9 KiB
YAML
name: "[loco-gen:ci]"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- "loco-gen/**"
|
|
pull_request:
|
|
paths:
|
|
- "loco-gen/**"
|
|
|
|
env:
|
|
RUST_TOOLCHAIN: stable
|
|
TOOLCHAIN_PROFILE: minimal
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./loco-gen
|
|
|
|
jobs:
|
|
style:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: rustfmt
|
|
- name: Setup Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
- name: Run cargo fmt
|
|
run: cargo fmt --all -- --check
|
|
- name: Run cargo clippy
|
|
run: cargo clippy --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms
|
|
|
|
test:
|
|
needs: [style]
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_DB: postgres_test
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- "5432:5432"
|
|
# Set health checks to wait until postgres has started
|
|
options: --health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@v7
|
|
- 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
|
|
|
|
- name: Run cargo test
|
|
run: cargo test --all-features
|
|
env:
|
|
LOCO_DEV_MODE_PATH: ${{ github.workspace }}
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test
|