Skip to content

Commit e5d7d5d

Browse files
authored
Merge branch 'main' into project/denisa.filip
2 parents e58cabf + 0708b26 commit e5d7d5d

761 files changed

Lines changed: 1083854 additions & 305389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/image-check.yml

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
name: Image Format & Resolution Check
2+
3+
on:
4+
push:
5+
paths:
6+
- "website/versioned_docs/version-acs_cc/project/**"
7+
- "website/versioned_docs/version-fils_en/project/**"
8+
pull_request:
9+
10+
jobs:
11+
check-images:
12+
name: Validate Images in versioned_docs project folders
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install image tools
22+
run: |
23+
sudo apt-get update -qq
24+
sudo apt-get install -y imagemagick webp file
25+
26+
- name: Get changed files in versioned_docs project folders
27+
id: changed-files
28+
run: |
29+
if [ "${{ github.event_name }}" = "pull_request" ]; then
30+
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
31+
FILES=$(git diff --name-only --diff-filter=ACM FETCH_HEAD HEAD -- \
32+
'website/versioned_docs/version-acs_cc/project/' \
33+
'website/versioned_docs/version-fils_en/project/')
34+
else
35+
BASE=${{ github.event.before }}
36+
if [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
37+
BASE=$(git rev-parse HEAD~1 2>/dev/null || echo "")
38+
fi
39+
40+
if [ -z "$BASE" ]; then
41+
FILES=$(git ls-files \
42+
'website/versioned_docs/version-acs_cc/project/' \
43+
'website/versioned_docs/version-fils_en/project/')
44+
else
45+
FILES=$(git diff --name-only --diff-filter=ACM "$BASE" HEAD -- \
46+
'website/versioned_docs/version-acs_cc/project/' \
47+
'website/versioned_docs/version-fils_en/project/')
48+
fi
49+
fi
50+
51+
echo "files<<EOF" >> $GITHUB_OUTPUT
52+
echo "$FILES" >> $GITHUB_OUTPUT
53+
echo "EOF" >> $GITHUB_OUTPUT
54+
55+
# ── Check for both case-sensitive and case-insensitive duplicates ──
56+
- name: Check for filename duplicates (case-sensitive and case-insensitive)
57+
id: check-duplicates
58+
run: |
59+
ERRORS=0
60+
FILES="${{ steps.changed-files.outputs.files }}"
61+
62+
if [ -z "$FILES" ]; then
63+
echo "No files to check for duplicates."
64+
exit 0
65+
fi
66+
67+
declare -A EXACT_MAP
68+
declare -A LOWERCASE_MAP
69+
70+
echo "══════════════════════════════"
71+
echo "Checking for filename duplicates..."
72+
echo "══════════════════════════════"
73+
74+
while IFS= read -r FILE; do
75+
[ -z "$FILE" ] && continue
76+
[ ! -f "$FILE" ] && continue
77+
78+
FILE_LOWER=$(echo "$FILE" | tr '[:upper:]' '[:lower:]')
79+
80+
# ── Check 1: Case-sensitive duplicate (exact same path) ──
81+
if [ -n "${EXACT_MAP[$FILE]}" ]; then
82+
echo "❌ DUPLICATE DETECTED (case-sensitive / exact match):"
83+
echo " - ${EXACT_MAP[$FILE]}"
84+
echo " - $FILE"
85+
echo " → Same file path appears multiple times in changes"
86+
ERRORS=$((ERRORS + 1))
87+
continue
88+
fi
89+
EXACT_MAP[$FILE]="$FILE"
90+
91+
# ── Check 2: Case-insensitive duplicate (differs only by case) ──
92+
if [ -n "${LOWERCASE_MAP[$FILE_LOWER]}" ]; then
93+
echo "❌ DUPLICATE DETECTED (case-insensitive conflict):"
94+
echo " - ${LOWERCASE_MAP[$FILE_LOWER]}"
95+
echo " - $FILE"
96+
echo " → These files differ only by case and will conflict on Windows/macOS"
97+
ERRORS=$((ERRORS + 1))
98+
continue
99+
fi
100+
LOWERCASE_MAP[$FILE_LOWER]="$FILE"
101+
102+
done <<< "$FILES"
103+
104+
echo "══════════════════════════════"
105+
if [ "$ERRORS" -gt 0 ]; then
106+
echo "$ERRORS duplicate(s) found."
107+
echo "duplicate_errors=$ERRORS" >> $GITHUB_OUTPUT
108+
exit 1
109+
else
110+
echo "✅ No duplicates found (case-sensitive or case-insensitive)."
111+
echo "duplicate_errors=0" >> $GITHUB_OUTPUT
112+
fi
113+
114+
- name: Check image format, resolution, and file size
115+
run: |
116+
ERRORS=0
117+
MAX_WIDTH=1024
118+
MAX_HEIGHT=768
119+
MAX_FILE_SIZE=307200 # 300KB in bytes (300 * 1024)
120+
121+
FILES="${{ steps.changed-files.outputs.files }}"
122+
123+
if [ -z "$FILES" ]; then
124+
echo "No files found in versioned_docs project folders – skipping checks."
125+
exit 0
126+
fi
127+
128+
while IFS= read -r FILE; do
129+
[ -z "$FILE" ] && continue
130+
[ ! -f "$FILE" ] && continue
131+
132+
echo "──────────────────────────────"
133+
echo "Checking: $FILE"
134+
135+
EXT="${FILE##*.}"
136+
EXT_LOWER=$(echo "$EXT" | tr '[:upper:]' '[:lower:]')
137+
138+
if [ "$EXT_LOWER" = "md" ]; then
139+
echo " Markdown file – skipping image checks"
140+
continue
141+
fi
142+
143+
if [ "$EXT_LOWER" != "svg" ] && [ "$EXT_LOWER" != "webp" ]; then
144+
echo " FAIL – Invalid extension: .$EXT_LOWER (only .svg and .webp are allowed)"
145+
ERRORS=$((ERRORS + 1))
146+
continue
147+
fi
148+
149+
MIME_TYPE=$(file --mime-type -b "$FILE")
150+
echo " Detected MIME type: $MIME_TYPE"
151+
152+
if [ "$EXT_LOWER" = "webp" ]; then
153+
if [ "$MIME_TYPE" != "image/webp" ]; then
154+
echo " FAIL – Extension is .webp but file content is $MIME_TYPE (Possible renamed PNG/JPG)"
155+
ERRORS=$((ERRORS + 1))
156+
continue
157+
fi
158+
elif [ "$EXT_LOWER" = "svg" ]; then
159+
if [ "$MIME_TYPE" != "image/svg+xml" ] && [ "$MIME_TYPE" != "text/xml" ]; then
160+
echo " FAIL – Extension is .svg but file content is $MIME_TYPE"
161+
ERRORS=$((ERRORS + 1))
162+
continue
163+
fi
164+
if [ "$MIME_TYPE" = "text/xml" ]; then
165+
if ! grep -q "<svg" "$FILE"; then
166+
echo " FAIL – File is XML but does not contain SVG tag"
167+
ERRORS=$((ERRORS + 1))
168+
continue
169+
fi
170+
fi
171+
fi
172+
173+
echo " Format & Content OK (.$EXT_LOWER)"
174+
175+
# ── File Size Check (applies to all images including SVG) ──
176+
FILE_SIZE=$(stat -c%s "$FILE")
177+
FILE_SIZE_KB=$((FILE_SIZE / 1024))
178+
echo " File size: ${FILE_SIZE_KB}KB (${FILE_SIZE} bytes)"
179+
180+
if [ "$FILE_SIZE" -gt "$MAX_FILE_SIZE" ]; then
181+
echo " FAIL – File size ${FILE_SIZE_KB}KB exceeds limit of 300KB"
182+
ERRORS=$((ERRORS + 1))
183+
else
184+
echo " File size OK"
185+
fi
186+
187+
# ── Resolution check (skip for SVG – they are vector) ──────
188+
if [ "$EXT_LOWER" = "svg" ]; then
189+
echo " SVG is vector – resolution check skipped"
190+
continue
191+
fi
192+
193+
DIMENSIONS=$(identify -format "%wx%h" "$FILE" 2>/dev/null)
194+
if [ -z "$DIMENSIONS" ]; then
195+
echo " FAIL – Could not read dimensions (File might be corrupted)"
196+
ERRORS=$((ERRORS + 1))
197+
continue
198+
fi
199+
200+
WIDTH=$(echo "$DIMENSIONS" | cut -d'x' -f1)
201+
HEIGHT=$(echo "$DIMENSIONS" | cut -d'x' -f2)
202+
203+
echo " Dimensions: ${WIDTH}x${HEIGHT}"
204+
205+
if [ "$WIDTH" -gt "$MAX_WIDTH" ] || [ "$HEIGHT" -gt "$MAX_HEIGHT" ]; then
206+
echo " FAIL – Resolution ${WIDTH}x${HEIGHT} exceeds limit of ${MAX_WIDTH}x${MAX_HEIGHT}"
207+
ERRORS=$((ERRORS + 1))
208+
else
209+
echo " Resolution OK"
210+
fi
211+
212+
done <<< "$FILES"
213+
214+
echo "══════════════════════════════"
215+
if [ "$ERRORS" -gt 0 ]; then
216+
echo "$ERRORS image(s) failed validation."
217+
exit 1
218+
else
219+
echo "All images passed validation."
220+
fi

Cargo.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

firmware/lab01/.cargo/config.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

firmware/lab01/.gitignore

Lines changed: 0 additions & 14 deletions
This file was deleted.

firmware/lab01/.vscode/settings.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

firmware/lab01/Cargo.toml

Lines changed: 0 additions & 50 deletions
This file was deleted.

firmware/lab01/README.md

Whitespace-only changes.

firmware/lab01/build.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.
-225 KB
Binary file not shown.
-4.64 KB
Binary file not shown.

0 commit comments

Comments
 (0)