diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..b2ae189726f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +# Continuous integration: run the test suite on Linux x64 (ubuntu-latest). +# Only FreeBSD runs `cargo test` today; this adds the main platform. +name: CI + +on: + push: + branches: [main] + pull_request: + paths: + - Cargo.toml + - Cargo.lock + - "**/Cargo.toml" + - .github/workflows/ci.yml + workflow_dispatch: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + RUST_BACKTRACE: 1 + RUST_TEST_THREADS: "4" + +jobs: + linux-x64: + name: Linux x86_64 (build + test) + runs-on: ubuntu-22.04 + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + retry: 3 + # Optional font build input so Japanese/Chinese font tests run (they skip without it). + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: storytold/craft-fonts + ref: 8dcdacd5153e64560d109541a47d806f26f048c0 + path: craft-fonts + retry: 3 + - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable + with: + retry: 3 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: ci-linux-x64-${{ hashFiles('Cargo.lock') }} + - name: Cache apt packages + uses: actions/cache@0400d5f644914a3c2c8c16d6b72f5c0a3a9b7c1e # v4.2.1 + with: + path: | + /var/cache/apt + /usr/lib + key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }} + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev \ + desktop-file-utils appstream python3-yaml zsync \ + pkg-config libfontconfig1-dev libfreetype6-dev + - name: Run cargo xtask ci + env: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + CARGO_TARGET_DIR: ${{ runner.temp }}/target + run: cargo xtask ci \ No newline at end of file diff --git a/crates/ui-egui/src/panels/edit.rs b/crates/ui-egui/src/panels/edit.rs index 56f405ea309..45cb5a0f857 100644 --- a/crates/ui-egui/src/panels/edit.rs +++ b/crates/ui-egui/src/panels/edit.rs @@ -561,21 +561,21 @@ fn histogram(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { // EXIF strip if let Some(ph) = app.session.catalog.photo(id) { let m = &ph.meta; - let items = [ - m.iso.map(|i| format!("ISO {i}")).unwrap_or_default(), - m.focal_mm.map(|f| format!("{f:.0}mm")).unwrap_or_default(), - m.aperture.map(|a| format!("f/{a:.1}")).unwrap_or_default(), - m.shutter.clone(), - ]; - let y = r.bottom() - 13.0; - for (i, s) in items.iter().enumerate() { - let x = r.left() + 18.0 + (r.width() - 36.0) * i as f32 / 3.0; - let align = match i { - 0 => Align2::LEFT_CENTER, - 3 => Align2::RIGHT_CENTER, - _ => Align2::CENTER_CENTER, - }; - p.text(pos2(x, y), align, s, t.font(12.5), t.text_label); + let parts: Vec = [ + m.iso.map(|i| format!("ISO {i}")), + m.focal_mm.map(|f| format!("{f:.0}mm")), + m.aperture.map(|a| format!("f/{a:.1}")), + if m.shutter.is_empty() { None } else { Some(m.shutter.clone()) }, + ] + .into_iter() + .flatten() + .collect(); + + if !parts.is_empty() { + let text = parts.join(" ยท "); + let y = r.bottom() - 13.0; + let x = r.left() + r.width() / 2.0; + p.text(pos2(x, y), Align2::CENTER_CENTER, text, t.font(12.5), t.text_label); } } }