2024-01-26 13:21:59 +00:00
|
|
|
variables:
|
|
|
|
- &rust_image "rust:1.75"
|
|
|
|
|
|
|
|
steps:
|
2024-02-29 11:39:00 +00:00
|
|
|
|
2024-01-26 13:21:59 +00:00
|
|
|
cargo_fmt:
|
|
|
|
image: *rust_image
|
|
|
|
environment:
|
|
|
|
# store cargo data in repo folder so that it gets cached between steps
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
|
|
|
- rustup component add rustfmt
|
|
|
|
- cargo fmt -- --check
|
|
|
|
|
2024-02-07 15:54:43 +00:00
|
|
|
check_config_defaults_updated:
|
2024-01-26 13:21:59 +00:00
|
|
|
image: *rust_image
|
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
2024-02-07 15:54:43 +00:00
|
|
|
- cargo run -- --print-config > config/defaults_current.toml
|
|
|
|
- diff config/defaults.toml config/defaults_current.toml
|
2024-01-26 13:21:59 +00:00
|
|
|
|
2024-03-06 15:00:50 +00:00
|
|
|
ignored_files:
|
|
|
|
image: alpine:3
|
|
|
|
commands:
|
|
|
|
- apk add git
|
|
|
|
- IGNORED=$(git ls-files --cached -i --exclude-standard)
|
|
|
|
- if [[ "$IGNORED" ]]; then echo "Ignored files present:\n$IGNORED\n"; exit 1; fi
|
|
|
|
|
2024-01-26 13:21:59 +00:00
|
|
|
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
|
2024-02-07 15:54:43 +00:00
|
|
|
|
|
|
|
frontend_wasm_build:
|
|
|
|
image: *rust_image
|
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
|
|
|
- "rustup target add wasm32-unknown-unknown"
|
|
|
|
- "cargo check --target wasm32-unknown-unknown --features csr,hydrate --no-default-features"
|
2024-01-26 13:21:59 +00:00
|
|
|
|
|
|
|
cargo_clippy:
|
|
|
|
image: *rust_image
|
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
|
|
|
- rustup component add clippy
|
|
|
|
- cargo clippy --tests --all-targets --all-features
|
|
|
|
|
|
|
|
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
|
|
|
|
# dbinit (used by tests to create temp db) refuses to run as root so we need to setup another user
|
|
|
|
- adduser testuser
|
|
|
|
- cp /usr/local/rustup /home/testuser/.rustup -r
|
|
|
|
- chown testuser:testuser . -R
|
|
|
|
- chown testuser:testuser /home/testuser -R
|
|
|
|
- export PATH="/usr/lib/postgresql/15/bin:/usr/local/cargo/bin:$PATH"
|
|
|
|
- sudo -u testuser env "PATH=$PATH" cargo test --no-fail-fast
|
|
|
|
|
2024-03-06 14:58:00 +00:00
|
|
|
build_release:
|
|
|
|
image: *rust_image
|
|
|
|
environment:
|
|
|
|
CARGO_HOME: .cargo_home
|
|
|
|
commands:
|
|
|
|
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
|
|
|
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
|
|
|
|
- rustup target add wasm32-unknown-unknown
|
|
|
|
- ./cargo-binstall -y trunk
|
|
|
|
- ./.cargo_home/bin/trunk build --release
|
|
|
|
- cargo build --release
|
|
|
|
- ls -la target/release/ibis
|
|
|
|
- cp target/release/ibis .
|
|
|
|
- gzip ibis
|
|
|
|
- ls -la ibis.gz
|
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
|
|
|
|
publish_release:
|
|
|
|
image: woodpeckerci/plugin-github-release
|
|
|
|
settings:
|
|
|
|
files:
|
|
|
|
- ibis.gz
|
|
|
|
title: ${CI_COMMIT_TAG##v}
|
|
|
|
api-key:
|
|
|
|
from_secret: github_token
|
|
|
|
when:
|
|
|
|
event: tag
|
|
|
|
|
2024-01-26 13:21:59 +00:00
|
|
|
services:
|
|
|
|
database:
|
|
|
|
image: postgres:15.2-alpine
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: ibis
|
|
|
|
POSTGRES_PASSWORD: password
|