Files
ltk/.gitea/workflows/ci.yml
Pedro M. de Echanove Pasquin a7f953ca42
Some checks failed
CI / build + test (push) Has been cancelled
CI / cargo audit (push) Has been cancelled
layout: adaptive grid and vertical flex; enforce the mechanical style rules
grid_min_cell( width ) adds the adaptive mode WrapGrid was missing: instead of a fixed column count, the count is derived at layout time from the available width so every cell is at least `width` wide (any Length, so a fluid threshold works; never fewer than one column), re-derived on every resize. Cells then share the width equally, and WrapGrid::max_columns( n ) caps the derived count so cells grow instead of multiplying on very wide surfaces — the cap only applies to the adaptive mode, grid( n ) keeps the fixed behaviour untouched. Four new layout tests cover width derivation, spacing accounting, the one-column floor and the cap; the row-wrap assertions check X positions rather than Y because zero-height spacer children produce zero-height rows.
flex( child ) now distributes leftover height inside a Column, mirroring its leftover-width behaviour in a Row: flex children join the weight pool alongside weight-only spacers and y-scrolls, draw their child inside the allocated share at full inner width, and contribute zero to the column's natural height exactly like a row counts flex width. This closes the documented "vertical flex is not yet implemented" gap; the Flex rustdoc and the widgets.md entry now describe both axes.
Add scripts/style-check.sh and a make stylecheck target, wired into CI: mechanical verification of the grep-checkable subset of code_style_guide.md — tab indentation and spaces inside attribute brackets — with comment lines skipped so prose may cite raw attribute syntax. To turn the check on green, the 82 unspaced attribute sites across 24 files (#[test], #[derive(...)], #[cfg(...)], #[allow(...)]) were normalized to the spaced form. CONTRIBUTING and the style guide reference the new target; brace placement and paren spacing remain review concerns.
2026-07-30 22:20:21 +02:00

100 lines
3.4 KiB
YAML

# Gitea Actions CI for ltk.
#
# Runs on every push and pull request against `main`. Two independent
# jobs share the cache layer but otherwise execute in parallel:
#
# - `test` builds the workspace and runs the full test corpus.
# - `audit` runs `cargo audit` against the RustSec advisory database to
# catch dependency CVEs without waiting for a human to remember to run
# it locally.
#
# Note: ltk uses Modified Allman style (not rustfmt's default), so there
# is no `cargo fmt --check` step here on purpose. If rustfmt ever ships
# a stable Allman config, add a third `fmt` job.
#
# Compatible syntax with GitHub Actions, so swapping host providers does
# not require touching this file. Gitea also reads `.github/workflows/`
# by default, but `.gitea/workflows/` is preferred for clarity.
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
# Surface the MSRV that `Cargo.toml` declares so the runner pins the
# toolchain to the same version the package is published against.
RUST_TOOLCHAIN: "1.85"
jobs:
test:
name: build + test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system dependencies
# ltk links against Wayland / EGL / xkbcommon at compile time
# through smithay-client-toolkit, wayland-egl and khronos-egl.
# The runner image does not ship these headers by default.
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libwayland-dev libegl-dev libxkbcommon-dev pkg-config
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Cache cargo registry and target
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --workspace --all-targets --features test-support
- name: Test
run: cargo test --workspace --all-targets --features test-support
# External-Markdown doctests. `cargo test --doc` only sees doctests
# inside `src/`; the cookbook and widget reference under `docs/`
# are stand-alone Markdown files that rustdoc has to be invoked
# against directly. The script discovers the freshly-built rlib
# from the `Build` step's `target/debug/` and runs `rustdoc --test`
# over each `.md`. Snippets are `no_run` so this only typechecks —
# the goal is to catch API drift, not integration-test the runtime.
- name: Markdown doctests
run: ./scripts/doctest-md.sh
- name: Style check
run: ./scripts/style-check.sh
audit:
name: cargo audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
# `--locked` so the audit tool itself does not pick up an
# advisory-affected transitive dep at install time.
run: cargo install cargo-audit --locked
- name: Run cargo audit
# Default behaviour: fail on any active advisory. Add
# `--ignore RUSTSEC-...` here for advisories that have a
# documented mitigation upstream we cannot avoid yet.
run: cargo audit