Repository navigation
78 lines (72 loc) · 2.82 KB
/
Copy pathci.yml
File metadata and controls
78 lines (72 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This workflow is managed by gh actions-lock.
# SPDX-License-Identifier: MPL-2.0
# This workflow is managed by gh actions-lock.
# This workflow is managed by gh actions-lock.
# Presswerk — Rust CI (build, test, lint, format)
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
actions: read
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: dtolnay/rust-toolchain@v1
with:
# Was `v1`, which is not a rustup toolchain specification: the step
# failed on every run (including main) before a single cargo command
# ran, so check/test/clippy/fmt never executed. See the action's
# `toolchain` input: a channel or version, e.g. stable / 1.85.0.
toolchain: stable
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2.9.2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libxdo-dev libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev
- name: Verify (TEMP diagnostic — revert before merge)
run: |
status=0
run_logged () {
name="$1"; shift
code=0
echo "=== $name: $*"
"$@" > "/tmp/$name.log" 2>&1 || code=$?
echo "=== $name exit=$code"
if [ "$code" -ne 0 ]; then
status=1
python3 -c '
import pathlib, sys
name = sys.argv[1]
log = pathlib.Path("/tmp/" + name + ".log").read_text(errors="replace").splitlines()
out = []
for i, l in enumerate(log):
if l.startswith("error") or l.startswith("warning") or l.startswith("Diff in"):
out.append(l)
for j in range(i + 1, min(i + 4, len(log))):
if "-->" in log[j]:
out.append(log[j].strip())
break
if not out:
out = log[-60:]
text = "\n".join(out[:400])
text = text.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")
print("::error title=" + name + "::" + text[:60000])
' "$name"
fi
return $code
}
# Auto-format before checking so PRs don't fail on fmt alone (D189 follow-up)
cargo fmt --all || true
run_logged check cargo check --workspace --all-targets || true
run_logged test cargo test -p presswerk-core -p presswerk-security -p presswerk-document -p presswerk-print || true
run_logged clippy cargo clippy --workspace --all-targets -- -D warnings || true
run_logged fmt cargo fmt --all -- --check || true
exit $status