mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 09:26:43 +00:00
Merge upstream CI ordering while retaining clipboard regression jobs
This commit is contained in:
commit
0caa7ed54a
6 files changed
+77
-25
No files matched your search
+20
-12
@@ -39,6 +39,7 @@ jobs:
|
||||
# platform: the app shell, UI, text and fonts, GPU, pen input, build scripts or the lockfile.
|
||||
# macOS is tested only by release.yml.
|
||||
platforms:
|
||||
timeout-minutes: 10
|
||||
name: select platforms
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
@@ -77,6 +78,7 @@ jobs:
|
||||
fi
|
||||
|
||||
test:
|
||||
timeout-minutes: 100
|
||||
name: test (${{ matrix.os }})
|
||||
needs: platforms
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -111,10 +113,24 @@ jobs:
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: true
|
||||
|
||||
# The cheap checks run first: a format, lint, layering or stale-scorecard failure is red
|
||||
# after a few minutes instead of after the test passes (#6119). Clippy restores main's cache.
|
||||
- name: Format
|
||||
if: runner.os == 'Linux'
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings
|
||||
|
||||
- name: Dependency layering
|
||||
run: cargo xtask layers
|
||||
|
||||
# docs/scorecard.md must match its sources (checklists, budgets, baseline, corpus floors,
|
||||
# prefs audit). Static: it reads committed files only, no benchmarks run here.
|
||||
- name: Scorecard up to date
|
||||
if: runner.os == 'Linux'
|
||||
run: cargo xtask scorecard --check
|
||||
|
||||
# `--features heif`: official builds open HEIC photos via the optional photocraft-heif crate.
|
||||
- name: Test
|
||||
run: cargo test --workspace --locked --features heif
|
||||
@@ -145,18 +161,6 @@ jobs:
|
||||
CRAFT_FONTS_REQUIRED: "1"
|
||||
run: cargo test --workspace --locked --features heif
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings
|
||||
|
||||
- name: Dependency layering
|
||||
run: cargo xtask layers
|
||||
|
||||
# docs/scorecard.md must match its sources (checklists, budgets, baseline, corpus floors,
|
||||
# prefs audit). Static: it reads committed files only, no benchmarks run here.
|
||||
- name: Scorecard up to date
|
||||
if: runner.os == 'Linux'
|
||||
run: cargo xtask scorecard --check
|
||||
|
||||
# Keep clipboard regressions runnable when an unrelated workspace test fails.
|
||||
clipboard:
|
||||
name: clipboard regressions (${{ matrix.os }})
|
||||
@@ -192,6 +196,7 @@ jobs:
|
||||
run: cargo test -p photocraft --locked --bin photocraft services::tests::busy_native_clipboard_preserves_copied_shape -- --ignored --exact --test-threads=1
|
||||
|
||||
corpus:
|
||||
timeout-minutes: 30
|
||||
# Real-file corpus tests (cargo feature `corpus`), on every PR and on main. The corpora are
|
||||
# pinned in xtask/src/corpus_pins.rs and sha256-verified (xtask/*.sha256) after both a cache
|
||||
# restore and a download; a missing corpus fails the tests. The cache key changes only when a
|
||||
@@ -224,6 +229,7 @@ jobs:
|
||||
run: cargo xtask test-corpus
|
||||
|
||||
wasm:
|
||||
timeout-minutes: 30
|
||||
name: wasm32 check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -240,6 +246,7 @@ jobs:
|
||||
run: cargo xtask wasm
|
||||
|
||||
web:
|
||||
timeout-minutes: 60
|
||||
name: web build and wasm size gate
|
||||
# PRs run it only when web-relevant files change (see `platforms`); main always does.
|
||||
needs: platforms
|
||||
@@ -287,6 +294,7 @@ jobs:
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
fuzz:
|
||||
timeout-minutes: 60
|
||||
name: fuzz (${{ matrix.target.crate }}/${{ matrix.target.name }})
|
||||
# Placeholder: manual trigger only until a nightly schedule is enabled.
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.fuzz
|
||||
|
||||
@@ -27,6 +27,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
timeout-minutes: 15
|
||||
name: mdBook build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -23,6 +23,7 @@ jobs:
|
||||
uses: storytold/craft-common-actions/.github/workflows/packaging-lint.yml@main
|
||||
|
||||
verified-appimage-inputs:
|
||||
timeout-minutes: 10
|
||||
name: Verified AppImage inputs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -563,14 +563,14 @@ impl LayerKeys {
|
||||
fn identity(&self, layer: &Layer, doc: Option<&Document>) -> u64 {
|
||||
let addr = std::ptr::from_ref(layer) as usize;
|
||||
let in_doc = doc.is_some_and(|d| self.in_doc.get_or_init(|| doc_layer_addresses(d)).contains(&addr));
|
||||
if in_doc && let Some(id) = self.ids.lock().unwrap_or_else(|e| e.into_inner()).get(&addr) {
|
||||
return *id;
|
||||
}
|
||||
let id = self.compute(layer);
|
||||
if in_doc {
|
||||
self.ids.lock().unwrap_or_else(|e| e.into_inner()).insert(addr, id);
|
||||
let mut ids = self.ids.lock().unwrap_or_else(|e| e.into_inner());
|
||||
// Computing an identity only hashes immutable layer data; it does not run Rayon
|
||||
// work or re-enter this memo. Keep the miss and insertion atomic across callers.
|
||||
*ids.entry(addr).or_insert_with(|| self.compute(layer))
|
||||
} else {
|
||||
self.compute(layer)
|
||||
}
|
||||
id
|
||||
}
|
||||
|
||||
fn compute(&self, layer: &Layer) -> u64 {
|
||||
|
||||
@@ -3190,3 +3190,27 @@ fn effect_cache_keeps_no_pixels_of_a_dropped_layer() {
|
||||
assert_eq!(std::sync::Arc::strong_count(&own), 1);
|
||||
assert_eq!(std::sync::Arc::strong_count(&child), 1);
|
||||
}
|
||||
|
||||
// Concurrent callers share one memoized effect identity.
|
||||
#[test]
|
||||
fn concurrent_effect_identity_misses_compute_once() {
|
||||
let mut doc = identity_doc(SampleType::U8);
|
||||
// Make the existing pure identity hash long enough to expose overlapping misses.
|
||||
doc.layers[1].effects.items = vec![Effect::DropShadow(shadow(4.0, 120.0)); 512];
|
||||
let layer = &doc.layers[1];
|
||||
let keys = LayerKeys::default();
|
||||
let start = std::sync::Barrier::new(8);
|
||||
std::thread::scope(|scope| {
|
||||
let handles: Vec<_> = (0..8)
|
||||
.map(|_| {
|
||||
scope.spawn(|| {
|
||||
start.wait();
|
||||
keys.identity(layer, Some(&doc))
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
let ids: Vec<_> = handles.into_iter().map(|h| h.join().unwrap()).collect();
|
||||
assert!(ids.iter().all(|id| *id == ids[0]));
|
||||
});
|
||||
assert_eq!(keys.built.load(std::sync::atomic::Ordering::Relaxed), 1, "concurrent cache misses must compute one memoized identity");
|
||||
}
|
||||
+25
-7
@@ -681,13 +681,12 @@ pub mod transcode {
|
||||
if !self.from.is_little() && TaggedBlock::is_foreign_order_signature(self.r.peek_rest()) {
|
||||
let sig = self.r.array::<4>()?;
|
||||
let mut key = self.r.array::<4>()?;
|
||||
let long = uses_long_length(self.version, &{
|
||||
let mut k = key;
|
||||
if self.to.is_little() {
|
||||
k.reverse();
|
||||
}
|
||||
k
|
||||
});
|
||||
// Only reached with `from == Big`: the key is canonical here whatever the
|
||||
// target order. `TaggedBlock::write` sizes the length field from that same key.
|
||||
// Reversing it for the target order before the check
|
||||
// asked about a key `PSB_LONG_KEYS` never contains, so a PSB long key's 8-byte
|
||||
// length was read as 4 and every later block was copied unconverted.
|
||||
let long = uses_long_length(self.version, &key);
|
||||
let len = self.r.len_field(long)?;
|
||||
let data = self.r.bytes_u64(len)?;
|
||||
if self.to.is_little() {
|
||||
@@ -2211,6 +2210,25 @@ mod tests {
|
||||
assert_eq!(ImageSourceData::from_bytes(&big).unwrap().0.global_blocks, back.global_blocks);
|
||||
}
|
||||
|
||||
/// A PSB keeps `Mt16`/`Mt32`/`Mtrn`/`Alph` blocks of unknown layout verbatim, and their
|
||||
/// length field is 8 bytes (a PSB long key). Writing them into a little-endian TIFF must
|
||||
/// read that width; the old code looked the key up after reversing it for the target
|
||||
/// order, which never matches `PSB_LONG_KEYS`.
|
||||
#[test]
|
||||
fn psb_foreign_order_long_key_roundtrips() {
|
||||
let d = ImageSourceData {
|
||||
version: Version::Psb,
|
||||
byte_order: ByteOrder::Little,
|
||||
global_blocks: vec![TaggedBlock { signature: *b"MIB8", key: *b"Mt16", data: vec![9, 8, 7, 6, 5, 4], padding: None }],
|
||||
..Default::default()
|
||||
};
|
||||
let (little, w) = d.to_bytes(ByteOrder::Little).unwrap();
|
||||
assert!(w.is_empty(), "{w:?}");
|
||||
let (back, w) = ImageSourceData::from_bytes(&little).unwrap();
|
||||
assert!(w.is_empty(), "{w:?}");
|
||||
assert_eq!(back.global_blocks, d.global_blocks, "the 8-byte length and the bytes survive");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rle_counts_follow_the_container_and_samples_do_not() {
|
||||
let file = testgen::layered(Version::Psd, ColorMode::Rgb, 16, Compression::Rle);
|
||||
|
||||
Reference in new issue
Block a user