2024-01-26 10:28:40 +00:00
|
|
|
variables:
|
|
|
|
- &rust_image "rust:1.75"
|
2024-01-25 16:03:36 +00:00
|
|
|
|
2024-01-26 10:28:40 +00:00
|
|
|
steps:
|
2024-01-26 11:29:36 +00:00
|
|
|
cargo_test:
|
|
|
|
image: *rust_image
|
|
|
|
environment:
|
|
|
|
LEMMY_DATABASE_URL: postgres://ibis:password@database:5432/ibis
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
|
|
|
- apt-get update
|
|
|
|
- apt-get install postgresql sudo -y --no-install-recommends --no-install-suggests
|
2024-01-26 11:49:50 +00:00
|
|
|
- adduser testuser
|
2024-01-26 12:15:20 +00:00
|
|
|
- cp /usr/local/rustup /home/testuser/.rustup -r
|
|
|
|
- ls -la /home/testuser/.rustup
|
2024-01-26 11:40:57 +00:00
|
|
|
- chown testuser:testuser . -R
|
2024-01-26 12:01:13 +00:00
|
|
|
- chown testuser:testuser /home/testuser -R
|
2024-01-26 11:57:47 +00:00
|
|
|
- export PATH="/usr/lib/postgresql/15/bin:/usr/local/cargo/bin:$PATH"
|
2024-01-26 12:16:29 +00:00
|
|
|
- ##sudo -u testuser env "PATH=$PATH" rustup default stable
|
2024-01-26 11:59:31 +00:00
|
|
|
- sudo -u testuser env "PATH=$PATH" cargo test --no-fail-fast
|
2024-01-26 11:29:36 +00:00
|
|
|
|
2024-01-25 16:03:36 +00:00
|
|
|
cargo_fmt:
|
2024-01-26 10:28:40 +00:00
|
|
|
image: *rust_image
|
2024-01-25 16:03:36 +00:00
|
|
|
environment:
|
|
|
|
# store cargo data in repo folder so that it gets cached between steps
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
2024-01-25 16:05:24 +00:00
|
|
|
- rustup component add rustfmt
|
2024-01-25 16:03:36 +00:00
|
|
|
- cargo fmt -- --check
|
|
|
|
|
|
|
|
frontend_wasm_build:
|
2024-01-26 10:28:40 +00:00
|
|
|
image: *rust_image
|
2024-01-25 16:03:36 +00:00
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
|
|
|
- "rustup target add wasm32-unknown-unknown"
|
|
|
|
- "cargo check --target wasm32-unknown-unknown --features csr,hydrate --no-default-features"
|
|
|
|
|
|
|
|
check_diesel_schema:
|
|
|
|
image: willsquire/diesel-cli
|
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
DATABASE_URL: postgres://ibis:password@database:5432/ibis
|
|
|
|
commands:
|
|
|
|
- diesel migration run
|
|
|
|
- diesel print-schema --config-file=diesel.toml > tmp.schema
|
|
|
|
- diff tmp.schema src/backend/database/schema.rs
|
|
|
|
|
|
|
|
cargo_clippy:
|
2024-01-26 10:28:40 +00:00
|
|
|
image: *rust_image
|
2024-01-25 16:03:36 +00:00
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
2024-01-26 10:07:49 +00:00
|
|
|
- rustup component add clippy
|
2024-01-25 16:03:36 +00:00
|
|
|
- cargo clippy --tests --all-targets --all-features
|
|
|
|
|
|
|
|
services:
|
|
|
|
database:
|
|
|
|
image: postgres:15.2-alpine
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: ibis
|
|
|
|
POSTGRES_PASSWORD: password
|