-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (63 loc) · 2.43 KB
/
c-bindings.yml
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
name: C bindings
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
SHARED_OBJECT: target/release/libshogi_usi_parser_c.so
jobs:
build:
strategy:
matrix:
cargo-bloat-version:
- '0.11.0'
cbindgen-version:
- '0.23.0'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cargo version
run: cargo --version
- name: install nightly
run: rustup toolchain install nightly
- name: install cbindgen (v${{ matrix.cbindgen-version }})
run: cargo install cbindgen --version ${{ matrix.cbindgen-version }}
- name: install cargo-bloat (v${{ matrix.cargo-bloat-version }})
run: cargo install cargo-bloat --version ${{ matrix.cargo-bloat-version }}
- name: Build
run: make sharedlib
- name: Assert that headers are up to date
run: make check-include
- name: Assert that cdylib does not contain `panic_bounds_check`-related symbols
run: |
if nm ${SHARED_OBJECT} | grep --fixed-strings panic_bounds_check; [ $? -ne 1 ]; then
echo '`panic_bounds_check`-related symbols found in '${SHARED_OBJECT}
exit 1
fi
- name: Assert that cdylib does not contain the symbols `do_count_chars` and `pad_integral`
run: |
if nm ${SHARED_OBJECT} | grep --fixed-strings --regexp=do_count_chars --regexp=pad_integral; [ $? -ne 1 ]; then
echo '`do_count_chars` or `pad_integral` found in '${SHARED_OBJECT}
exit 1
fi
- name: Assert that cdylib does not contain the symbol `write_char`
run: |
if nm ${SHARED_OBJECT} | grep --fixed-strings write_char; [ $? -ne 1 ]; then
echo '`write_char` found in '${SHARED_OBJECT}
exit 1
fi
- name: '`readelf` (section headers)'
run: readelf --section-headers ${SHARED_OBJECT}
- name: Test
run: make c_tests
- name: cargo bloat (display, release)
run: cargo +nightly bloat --release --no-default-features --features alloc
- name: cargo bloat (display, per-crate, release)
run: cargo +nightly bloat --release --no-default-features --features alloc --crates
- name: cargo bloat (testing, release)
# Size <= 50KiB?
run: cargo +nightly bloat --release --no-default-features --features alloc --message-format json | jq --exit-status '."file-size" <= 51200'