summaryrefslogtreecommitdiff
path: root/lib/mlibc/.github/workflows/abidiff.yml
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:00 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 17:28:32 -0500
commitbd5969fc876a10b18613302db7087ef3c40f18e1 (patch)
tree7c2b8619afe902abf99570df2873fbdf40a4d1a1 /lib/mlibc/.github/workflows/abidiff.yml
parenta95b38b1b92b172e6cc4e8e56a88a30cc65907b0 (diff)
lib: Add mlibc
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/.github/workflows/abidiff.yml')
-rw-r--r--lib/mlibc/.github/workflows/abidiff.yml158
1 files changed, 158 insertions, 0 deletions
diff --git a/lib/mlibc/.github/workflows/abidiff.yml b/lib/mlibc/.github/workflows/abidiff.yml
new file mode 100644
index 0000000..036a7ec
--- /dev/null
+++ b/lib/mlibc/.github/workflows/abidiff.yml
@@ -0,0 +1,158 @@
+name: Check for ABI breaks
+
+on:
+ push:
+ branches-ignore:
+ - abi-break
+ pull_request:
+ branches-ignore:
+ - abi-break
+
+jobs:
+ run-abidiff:
+ name: Compare ABIs
+ runs-on: ubuntu-22.04
+ container:
+ image: ghcr.io/managarm/mlibc-crossers:latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ - name: Install prerequisites
+ run: |
+ apt-get update
+ apt-get install -y ninja-build qemu-user \
+ python3-setuptools python3-jsonschema \
+ python3-pip abigail-tools
+ pip install --break-system-packages -U xbstrap pyexpect meson
+
+ - name: Checkout base branch
+ if: ${{ github.base_ref }}
+ uses: actions/checkout@v2
+ with:
+ path: mlibc-base
+ ref: ${{ github.base_ref }}
+ submodules: true
+ fetch-depth: 4
+
+ - name: Checkout managarm/mlibc#master
+ if: ${{ github.base_ref == '' }}
+ uses: actions/checkout@v2
+ with:
+ path: mlibc-base
+ repository: managarm/mlibc
+ submodules: true
+ ref: master
+ fetch-depth: 4
+
+ - name: Checkout branch
+ uses: actions/checkout@v2
+ with:
+ path: mlibc-branch
+ submodules: true
+
+ - name: Determine base ref
+ run: |
+ master_hash="$(git -C mlibc-base rev-parse HEAD)"
+ branch_hash="$(git -C mlibc-branch rev-parse HEAD)"
+ printf '%s\n' "$master_hash" "$branch_hash"
+
+ if [ "$master_hash" = "$branch_hash" ]; then
+ git -C mlibc-base reset --hard HEAD^
+ fi
+
+ - name: Set up linux kernel headers
+ run: |
+ set -x
+ mkdir -p linux-headers-base/{src,build}
+ cp mlibc-base/ci/bootstrap.yml linux-headers-base/src/
+ (
+ cd linux-headers-base/build
+ xbstrap init ../src
+ xbstrap install linux-headers
+ )
+ mkdir -p linux-headers-branch/{src,build}
+ cp mlibc-branch/ci/bootstrap.yml linux-headers-branch/src/
+ (
+ cd linux-headers-branch/build
+ xbstrap init ../src
+ xbstrap install linux-headers
+ )
+ cat > linux-headers-base/build/bootstrap-site.yml << EOF
+ define_options:
+ arch: ${{matrix.arch}}
+ EOF
+ cp linux-headers-base/build/bootstrap-site.yml linux-headers-branch/build/bootstrap-site.yml
+
+ - name: Build and install both copies
+ run: |
+ set -xe
+ mkdir root-base root-branch
+ cat > linux-x86_64.cross-file <<-EOF
+ [binaries]
+ c = ['x86_64-linux-mlibc-gcc']
+ cpp = ['x86_64-linux-mlibc-g++']
+
+ [host_machine]
+ system = 'linux'
+ cpu_family = 'x86_64'
+ cpu = 'x86_64'
+ endian = 'little'
+ EOF
+ (
+ cd mlibc-branch
+ meson setup \
+ --cross-file=../linux-x86_64.cross-file \
+ --buildtype=debugoptimized \
+ -Dlinux_kernel_headers=$GITHUB_WORKSPACE/linux-headers-branch/build/packages/linux-headers/usr/include \
+ build
+ ninja -C build
+ DESTDIR="$GITHUB_WORKSPACE/root-branch" ninja -C build install
+ )
+ (
+ cd mlibc-base
+ meson setup \
+ --cross-file=../linux-x86_64.cross-file \
+ --buildtype=debugoptimized \
+ -Dlinux_kernel_headers=$GITHUB_WORKSPACE/linux-headers-branch/build/packages/linux-headers/usr/include \
+ build
+ ninja -C build
+ DESTDIR="$GITHUB_WORKSPACE/root-base" ninja -C build install
+ )
+ - name: Compare
+ run: |
+ # TODO(arsen): does this require handling for version suffixes?
+ set -e +x
+ exec 2>&1 # work around GHA foolishly decoupling stdout and stderr
+
+ exitcode=0
+ git -C mlibc-branch show -s --format=%s | grep -q abi-break || \
+ exitcode=1
+
+ echo ==== RUNNING ABIDIFF... ====
+ ( cd root-base; find . -type f -name '*.so'; ) | while read -r file
+ do
+ if ! file -- root-{base,branch}/"$file"; then
+ touch files-differ
+ continue
+ fi
+ abidiff \
+ --no-added-syms \
+ --suppr mlibc-branch/ci/abidiff_suppress.ini \
+ --hd1 root-base/usr/local/include/ \
+ --hd2 root-branch/usr/local/include/ \
+ root-{base,branch}/"$file" \
+ || touch files-differ
+ done
+
+ echo ==== CHECKING FOR EXTRA FILES... ====
+ ( cd root-branch; find . -type f -name '*.so'; ) | while read -r file
+ do
+ [ -e "root-base/$file" ] || file root-{base,branch}/"$file" \
+ || touch files-differ
+ done
+
+ if [ -e files-differ ]; then
+ echo SOME FILES/ABI DIFFER, SEE OUTPUT ABOVE
+ exit "$exitcode"
+ fi