-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.43 KB
/
Copy pathci.yml
File metadata and controls
86 lines (74 loc) · 2.43 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
exclude:
- os: macos-latest
compiler: gcc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set compiler
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
echo "CC=gcc" >> $GITHUB_ENV
else
echo "CC=clang" >> $GITHUB_ENV
fi
- name: Build (release)
run: make release
- name: Run tests
continue-on-error: true
run: make clean && make test
- name: Check library size
run: |
if [ -f build/libr8e.a ]; then
size=$(wc -c < build/libr8e.a | tr -d ' ')
echo "Library size: ${size} bytes ($(( size / 1024 ))KB)"
if [ "$size" -gt 200000 ]; then
echo "::warning::Library size exceeds 200KB target"
fi
else
echo "::error::build/libr8e.a not found"
exit 1
fi
- name: Check for compiler warnings (-Werror)
continue-on-error: true
run: |
make clean
make release CFLAGS_EXTRA="-Werror"
- name: Report library size in summary
run: |
if [ -f build/libr8e.a ]; then
size=$(wc -c < build/libr8e.a | tr -d ' ')
echo "### Build: ${{ matrix.os }} / ${{ matrix.compiler }}" >> $GITHUB_STEP_SUMMARY
echo "Library size: **$(( size / 1024 ))KB** (${size} bytes)" >> $GITHUB_STEP_SUMMARY
fi
build-size-optimized:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build (size optimized)
run: make size
- name: Report library size
run: |
if [ -f build/libr8e.a ]; then
size=$(wc -c < build/libr8e.a | tr -d ' ')
echo "Size-optimized library: ${size} bytes ($(( size / 1024 ))KB)"
echo "### Binary Size" >> $GITHUB_STEP_SUMMARY
echo "| Build | Size |" >> $GITHUB_STEP_SUMMARY
echo "|-------|------|" >> $GITHUB_STEP_SUMMARY
echo "| Size-optimized (libr8e.a) | **$(( size / 1024 ))KB** (${size} bytes) |" >> $GITHUB_STEP_SUMMARY
else
echo "::error::build/libr8e.a not found"
exit 1
fi