Skip to content

Commit

Permalink
ci: add job to test rust bindings generation
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Mar 31, 2024
1 parent 9b6b627 commit 8e031af
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/rust-libc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Rust libc bindings

on: [push, pull_request]

jobs:
check-bindings:
name: Verify bindings generation
runs-on: ubuntu-20.04
container:
image: ghcr.io/managarm/mlibc-crossers:latest
steps:
- name: Install prerequisites
run: |
apt-get update
apt-get install -y ninja-build \
python3-setuptools python3-jsonschema \
python3-pexpect python3-pip python3-clang \
netbase clang lld rustfmt
pip install --break-system-packages -U xbstrap pyexpect meson
- name: Prepare directories
run: |
mkdir src/
mkdir src/mlibc/
mkdir build/
- name: Checkout
uses: actions/checkout@v2
with:
path: src/mlibc/
- name: Prepare src/
run: |
cp mlibc/ci/bootstrap.yml .
touch mlibc/checkedout.xbstrap
working-directory: src/
- name: Prepare build/
run: |
cat > bootstrap-site.yml << EOF
define_options:
arch: x86_64
compiler: gcc
EOF
xbstrap init ../src
working-directory: build/
- name: Build mlibc
run: 'xbstrap install mlibc-headers-only'
working-directory: build/
- name: Run generator
run: |
python3 ./scripts/rust-libc.py ../../build/packages/mlibc-headers-only/usr/include | rustfmt
working-directory: src/mlibc/

4 changes: 3 additions & 1 deletion scripts/rust-libc-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ignored_files:
- "bits/glibc/glibc_assert.h"
- "bits/glibc/glibc_signal.h"
- "bits/null.h"
- "bits/syscall.h"
- "net/ethernet.h"
- "net/if_arp.h"
- "net/if_ppp.h"
Expand Down Expand Up @@ -242,6 +243,7 @@ ignored_macros:
- "LONG_MAX"
- "LONG_MIN"
- "MAX"
- "MB_CUR_MAX"
- "MIN"
- "MOUNTED"
- "NULL"
Expand Down Expand Up @@ -2025,4 +2027,4 @@ force_macro_type:
- "B2500000"
- "B3000000"
- "B3500000"
- "B4000000"
- "B4000000"

0 comments on commit 8e031af

Please sign in to comment.