stages: - check - build - package variables: CARGO_TERM_COLOR: always RUST_BACKTRACE: "1" # Cache the target dir — Rust builds are slow, everything after the first is fast. cache: key: files: - Cargo.lock prefix: cargo paths: - target/ # ---------- check ---------- fmt: stage: check image: rust:latest script: - rustup component add rustfmt - cargo fmt --check rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH clippy: stage: check image: rust:latest before_script: - apt-get update && apt-get install -y pkg-config libssl-dev - rustup component add clippy script: - cargo clippy --all-targets -- --deny warnings rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH allow_failure: true test: stage: check image: rust:latest before_script: - apt-get update && apt-get install -y pkg-config libssl-dev script: - cargo test --locked rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # ---------- build ---------- build-linux: stage: build image: rust:latest needs: [fmt] before_script: - apt-get update && apt-get install -y pkg-config libssl-dev libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev libswscale-dev libswresample-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev libxkbcommon-dev libgtk-3-dev script: - cargo build --release --locked artifacts: name: "scythe-linux-x86_64" paths: - target/release/scythe-daemon - target/release/scythe-ui expire_in: 30 days build-windows: stage: build image: rust:latest before_script: - apt-get update && apt-get install -y mingw-w64 pkg-config libssl-dev gcc-mingw-w64-x86-64 script: - rustup target add x86_64-pc-windows-gnu - cargo build --release --locked --target x86_64-pc-windows-gnu --bin scythe-daemon --bin scythe-ui artifacts: name: "scythe-windows-x86_64" paths: - target/x86_64-pc-windows-gnu/release/*.exe expire_in: 30 days # ---------- package ---------- # Real releases only on tags, so a main-branch push doesn't burn CI minutes. release: stage: package image: rust:latest needs: [build-linux] rules: - if: $CI_COMMIT_TAG script: - echo "Release build for $CI_COMMIT_TAG" - cargo build --release --locked artifacts: name: "scythe-$CI_COMMIT_TAG" paths: - target/release/scythe-daemon - target/release/scythe-ui expire_in: 90 days