diff options
Diffstat (limited to 'lib/mlibc/.github')
-rw-r--r-- | lib/mlibc/.github/workflows/abidiff.yml | 158 | ||||
-rw-r--r-- | lib/mlibc/.github/workflows/ci.yml | 123 | ||||
-rw-r--r-- | lib/mlibc/.github/workflows/detect-bad-ifs.yml | 17 | ||||
-rw-r--r-- | lib/mlibc/.github/workflows/detect-missing-mlibc-config.yml | 10 | ||||
-rw-r--r-- | lib/mlibc/.github/workflows/fixups.yml | 24 |
5 files changed, 332 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 diff --git a/lib/mlibc/.github/workflows/ci.yml b/lib/mlibc/.github/workflows/ci.yml new file mode 100644 index 0000000..d8b0360 --- /dev/null +++ b/lib/mlibc/.github/workflows/ci.yml @@ -0,0 +1,123 @@ +name: Continuous Integration + +on: [push, pull_request] + +jobs: + build-mlibc: + strategy: + matrix: + arch: [x86_64, riscv64, aarch64, x86] + builds: [mlibc, mlibc-static, mlibc-shared, mlibc-ansi-only, mlibc-headers-only] + name: Build mlibc + runs-on: ubuntu-22.04 + container: + image: ghcr.io/managarm/mlibc-crossers:latest + steps: + - name: Install prerequisites + run: | + apt-get update + apt-get install -y ninja-build qemu-user \ + python3-setuptools python3-jsonschema \ + python3-pexpect python3-pip netbase + 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: ${{matrix.arch}} + EOF + xbstrap init ../src + working-directory: build/ + - name: Build mlibc + run: 'xbstrap install ${{matrix.builds}}' + working-directory: build/ + - name: Test mlibc + run: 'meson test -v -C pkg-builds/${{matrix.builds}}' + working-directory: build/ + + compile-sysdeps: + strategy: + matrix: + sysdeps: [dripos, lemon, aero, ironclad, lyre, keyronex, managarm] + name: Compile sysdeps + runs-on: ubuntu-22.04 + container: + image: ghcr.io/managarm/mlibc-crossers:latest + steps: + - name: Install prerequisites + run: | + apt-get update + apt-get install -y ninja-build qemu-user \ + python3-setuptools python3-jsonschema \ + python3-pip + pip install --break-system-packages -U xbstrap meson + - if: ${{ matrix.sysdeps == 'managarm' }} + name: Checkout bootstrap-managarm + uses: actions/checkout@v2 + with: + repository: 'managarm/bootstrap-managarm' + path: src/ + - name: Checkout + uses: actions/checkout@v2 + with: + path: src/mlibc/ + - if: ${{ matrix.sysdeps == 'managarm' }} + name: Set up managarm subprojects directory + run: | + mkdir -p src/mlibc/subprojects build + ( + cd build + xbstrap init ../src + xbstrap regenerate libdrm + ) + - if: ${{ matrix.sysdeps == 'managarm' }} + name: Clone managarm/managarm + uses: actions/checkout@v4 + with: + repository: 'managarm/managarm' + path: 'src/mlibc/subprojects/managarm' + - if: ${{ matrix.sysdeps == 'managarm' }} + name: Clone managarm/bragi + uses: actions/checkout@v4 + with: + repository: 'managarm/bragi' + path: 'src/mlibc/subprojects/bragi' + - if: ${{ matrix.sysdeps == 'managarm' }} + name: Install bragi + run: | + pip install --break-system-packages -U bragi + - name: Set up linux kernel headers + run: | + mkdir -p build/mlibc/ + cp src/mlibc/ci/bootstrap.yml src/ + ( + cd build + xbstrap init ../src + xbstrap install linux-headers + ) + - name: Compile sysdeps + run: | + meson setup \ + "-Dc_args=['-fno-stack-protector', '-U__linux__', '-Wno-error=maybe-uninitialized', '-D__${{matrix.sysdeps}}__']" \ + "-Dcpp_args=['-fno-stack-protector', '-U__linux__', '-Wno-error=maybe-uninitialized', '-D__${{matrix.sysdeps}}__']" \ + "-Dbuild_tests=true" \ + "-Db_sanitize=undefined" \ + "-Dlinux_kernel_headers=$(pwd)/packages/linux-headers/usr/include" \ + --cross-file ../src/mlibc/ci/${{matrix.sysdeps}}.cross-file compile-${{matrix.sysdeps}} \ + "../src/mlibc/" + ninja -C compile-${{matrix.sysdeps}} + working-directory: build/ diff --git a/lib/mlibc/.github/workflows/detect-bad-ifs.yml b/lib/mlibc/.github/workflows/detect-bad-ifs.yml new file mode 100644 index 0000000..c738d29 --- /dev/null +++ b/lib/mlibc/.github/workflows/detect-bad-ifs.yml @@ -0,0 +1,17 @@ +name: Detect ifdef/defined (mis)use + +on: [push, pull_request] + +jobs: + find-misuse: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + printf '(^#ifn?def[[:space:]]+|defined[[:space:]]*[(][[:space:]]*)((%s)([^_A-Za-z0-9]|$))\0' \ + "$(printf '%s' "$(awk '/#mesondefine/ { print $2 }' mlibc-config.h.in)" | tr '\n' '|')" \ + | { ! xargs -0I '{}' grep --color=always -PR '{}' \ + || { echo 'found misuse'; exit 1; }; } + + +# vim: set sw=2 : diff --git a/lib/mlibc/.github/workflows/detect-missing-mlibc-config.yml b/lib/mlibc/.github/workflows/detect-missing-mlibc-config.yml new file mode 100644 index 0000000..f396121 --- /dev/null +++ b/lib/mlibc/.github/workflows/detect-missing-mlibc-config.yml @@ -0,0 +1,10 @@ +name: Detect missing mlibc-config.h + +on: [push, pull_request] + +jobs: + find-misuse: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: chmod +x ./scripts/check-options-header-include.sh && ./scripts/check-options-header-include.sh diff --git a/lib/mlibc/.github/workflows/fixups.yml b/lib/mlibc/.github/workflows/fixups.yml new file mode 100644 index 0000000..08bdf93 --- /dev/null +++ b/lib/mlibc/.github/workflows/fixups.yml @@ -0,0 +1,24 @@ +name: Check if PR has fixups + +on: + pull_request: + +jobs: + find-fixups: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: | + set -e -o pipefail + + git rev-list 'HEAD^..HEAD' \ + | while read -r COMMIT; do + printf 'pondering commit %s\n' "$COMMIT" + git show -s "$COMMIT" + if git show -s --format='%s' "$COMMIT" | grep -q '^fixup! '; then + exit 1 + fi + done + printf 'ready to merge!\n' |