-
-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (115 loc) · 4.63 KB
/
Copy pathrules.yml
File metadata and controls
129 lines (115 loc) · 4.63 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Rules
on:
push:
branches: [main]
pull_request:
concurrency:
group: rules-${{ github.ref }}
cancel-in-progress: true
jobs:
conventions:
name: Project conventions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Unsafe lives only in the -sys crates
run: |
expected="crates/cp-mac-sys crates/cp-win-sys"
found=$(grep -rl 'unsafe_code = "allow"' crates/*/Cargo.toml | xargs -n1 dirname | sort | tr '\n' ' ')
for dir in $found; do
case " $expected " in
*" $dir "*) ;;
*) echo "unsafe declarado fuera de los crates -sys: $dir"; exit 1 ;;
esac
done
- name: The core produces no terminal output
run: |
if grep -rnE '^[^"]*(^|[ \t{;(=>|&])(e?print(ln)?!)' crates/cp-core/src --include='*.rs'; then
echo "cp-core no imprime: usa tracing"; exit 1
fi
- name: The core touches neither platform nor interface
run: |
if grep -rn 'use tauri\|use windows\|use objc2' crates/cp-core/src --include='*.rs'; then
echo "cp-core no depende de plataforma ni de interfaz"; exit 1
fi
- name: No Spanish identifiers
run: |
if grep -rnE '\b(fecha|limite|prioridad|filtro|tarea|titulo|etiqueta|imagen|archivo) *:' \
crates/*/src --include='*.rs' | grep -v '"' | grep -vE ':[0-9]+: *///?!?'; then
echo "los identificadores van en ingles"; exit 1
fi
- name: No voseo in the Spanish anywhere
run: |
if grep -rniE '\b(vos|tenés|querés|podés|andá|mirá|hacé|che)\b' \
crates docs README.md --include='*.rs' --include='*.md' 2>/dev/null | grep -q .; then
echo "espanol neutro, sin voseo"; exit 1
fi
- name: No peninsular Spanish in what a person reads
run: |
if grep -rniE '\b(fichero|ficheros|ordenador|pulsa|pulsar|pulsando)\b' \
crates docs README.md --include='*.rs' --include='*.md' 2>/dev/null | grep -q .; then
echo "espanol neutro: archivo, computador, presiona"; exit 1
fi
- name: The code carries no comments
run: |
if grep -rnE '[/]{2}' crates --include='*.rs' | grep -vE '[a-z]+:[/][/]' | grep -q .; then
echo "el codigo va sin comentarios; lo que haya que explicar va al expediente"; exit 1
fi
if grep -rnE '[/][*]' crates --include='*.rs' | grep -q .; then
echo "tampoco comentarios de bloque"; exit 1
fi
deterministic:
name: Tests are deterministic (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15, windows-2025]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Twenty consecutive runs of the core
run: for i in $(seq 1 20); do cargo test -p cp-core --quiet || exit 1; done
coverage:
name: Coverage does not slip
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --no-report --workspace
- run: cargo llvm-cov --no-report run -p cp-mac --example probe
- run: cargo llvm-cov report --fail-under-lines 90 --summary-only --ignore-filename-regex 'cp-panel[/\]src[/\](app|main|measure)\.rs'
coverage-windows:
name: Coverage does not slip on Windows
runs-on: windows-2025
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --no-report -p cp-core -p cp-store -p cp-win -p cp-win-sys -p cp-panel
- name: The probe reads a real clipboard, so leave something on it
shell: pwsh
run: Set-Clipboard -Value "cp-probe"
- run: cargo llvm-cov --no-report run -p cp-win --example probe
- run: cargo llvm-cov report --fail-under-lines 95 --summary-only --ignore-filename-regex 'cp-panel[/\]src[/\](app|main|measure)\.rs'
budget:
name: Latency stays within budget
runs-on: macos-15
env:
CP_BUDGET_SLACK: "4"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo run -p cp-store --release --example budget