Skip to content

Commit b22d8c2

Browse files
authored
Merge pull request #66 from pfeifferj/ci/check-bindings-drift
ci: detect drift between committed and generated FFI bindings
2 parents 5c566d0 + e31c638 commit b22d8c2

5 files changed

Lines changed: 158 additions & 105 deletions

File tree

.github/workflows/bindings.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Bindings
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
generate:
12+
runs-on: ubuntu-latest
13+
container:
14+
image: archlinux
15+
steps:
16+
- name: Install Packages
17+
run: pacman -Syu rust clang gcc libarchive pkgconf diffutils --noconfirm --needed
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: build
23+
run: cargo build --features generate --target-dir target
24+
25+
- name: Check committed bindings are up to date
26+
run: diff --color=always -u alpm-sys/src/ffi.rs target/debug/build/alpm-sys-*/out/ffi_generated.rs
27+
28+
generate-git:
29+
runs-on: ubuntu-latest
30+
container:
31+
image: archlinux
32+
steps:
33+
- name: Install Packages
34+
run: pacman -Syu rust curl clang git base-devel libarchive meson asciidoc doxygen pkgconf fakechroot --noconfirm --needed
35+
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Install Pacman-git
40+
run: |
41+
git clone https://aur.archlinux.org/pacman-git
42+
chown -R nobody pacman-git
43+
cd pacman-git
44+
sudo -u nobody makepkg --nocheck
45+
sudo -u nobody makepkg --packagelist > list
46+
yes | pacman -U $(cat list)
47+
48+
- name: build
49+
run: cargo build --features generate,git
50+
51+
- name: Check committed git bindings are up to date
52+
run: diff --color=always -u alpm-sys/src/ffi_git.rs target/debug/build/alpm-sys-*/out/ffi_generated.rs

alpm-sys/bindgen

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ bindgen "${1:-/usr/include/alpm.h}" \
1616
--opaque-type alpm_handle_t \
1717
--opaque-type alpm_db_t \
1818
--opaque-type alpm_pkg_t \
19-
--opaque-type alpm_trans_t
19+
--opaque-type alpm_trans_t \
20+
--with-derive-eq \
21+
--with-derive-ord \
22+
--with-derive-hash

alpm-sys/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ fn main() {
8585
.derive_copy(true)
8686
.derive_hash(true)
8787
.derive_debug(true)
88-
.derive_partialeq(true)
89-
.derive_debug(true)
9088
.generate()
9189
.unwrap();
9290

0 commit comments

Comments
 (0)