Skip to content

Commit

Permalink
i#1973 musl: Add CI workflow (#7197)
Browse files Browse the repository at this point in the history
The workflow constructs an Alpine Linux chroot environment in place and
build DynamoRIO in it, serving as compatibility verification against
musl. Tests are disabled in CI since only half of them pass.

Issue: #1973
  • Loading branch information
ziyao233 authored Feb 5, 2025
1 parent 7e692b0 commit f679328
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 3 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/ci-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,84 @@ jobs:
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
to: [email protected]
from: Github Action CI

# 64-bit Linux build with gcc and musl.
# TODO i#1973: Fix failing cases and enable tests in CI.
x86-64-alpine-3_21:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
path: ${{ github.workspace }}/DynamoRIO

# Cancel any prior runs for a PR (but do not cancel master branch runs).
- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name == 'pull_request' }}

- run: git fetch --no-tags --depth=1 origin master
working-directory: ${{ github.workspace }}/DynamoRIO

# Create an Alpine Linux 3.21.2 chroot environment for building
- name: Create Build Environment
run: |
curl -L https://dl-cdn.alpinelinux.org/v3.21/main/x86_64/apk-tools-static-2.14.6-r2.apk | \
tar xzv sbin/apk.static
sudo mkdir -p alpine-root/etc/apk
echo "https://dl-cdn.alpinelinux.org/v3.21/main/" | \
sudo tee alpine-root/etc/apk/repositories
# Meta-package build-base simplifies dependencies, but it pulls in
# fortify-headers. Alpine ships an out-of-date version whose headers
# contain unnecessary includes, causing naming conflicts.
# TODO i#1973: simplify dependency with build-base after fixing
# the compatibility problem.
# Supply --allow-untrusted since we're creating a rootfs from scratch
# thus don't have any public key available.
sudo sbin/apk.static -p alpine-root -U --initdb --allow-untrusted add \
alpine-base binutils bash cmake doxygen file g++ git libunwind-dev \
lz4-dev lz4-static linux-headers make musl-dev musl-libintl perl \
patch xz-dev zlib-dev zlib-static
cd alpine-root
sudo mount -o bind /dev/ dev
sudo mount -t proc proc proc
sudo mount -t sysfs sys sys
sudo mount -o bind ${{ github.workspace }}/DynamoRIO root
- name: Run Suite
working-directory: ${{ github.workspace }}
run: |
sudo --preserve-env=CI_TRIGGER,CI_BRANCH,DYNAMORIO_MUSL \
chroot alpine-root sh -c 'cd &&
./suite/runsuite_wrapper.pl automated_ci 64_only'
env:
DYNAMORIO_MUSL: yes
CI_TRIGGER: ${{ github.event_name }}
CI_BRANCH: ${{ github.ref }}

- name: Send failure mail to dynamorio-devs
if: failure() && github.ref == 'refs/heads/master'
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_USERNAME}}
password: ${{secrets.DYNAMORIO_NOTIFICATION_EMAIL_PASSWORD}}
subject: |
[${{github.repository}}] ${{github.workflow}} FAILED
on ${{github.event_name}} at ${{github.ref}}
body: |
Github Actions CI workflow run FAILED!
Workflow: ${{github.workflow}}/x86-32-ubuntu22
Repository: ${{github.repository}}
Branch ref: ${{github.ref}}
SHA: ${{github.sha}}
Triggering actor: ${{github.actor}}
Triggering event: ${{github.event_name}}
Run Id: ${{github.run_id}}
See more details on github.com/DynamoRIO/dynamorio/actions/runs/${{github.run_id}}
to: [email protected]
from: Github Action CI
13 changes: 10 additions & 3 deletions suite/runsuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,16 @@ set(build_tests "BUILD_TESTS:BOOL=ON")
if (arg_automated_ci)
# XXX i#1801, i#1962: under clang we have several failing tests. Until those are
# fixed, our CI clang suite only builds and does not run tests.
if (UNIX AND NOT APPLE AND "$ENV{DYNAMORIO_CLANG}" MATCHES "yes")
set(run_tests OFF)
message("Detected a CI clang suite: disabling running of tests")
# TODO i#1973: our musl port passes only half of the tests. Enable tests in CI
# when it's ready.
if (UNIX AND NOT APPLE)
if ("$ENV{DYNAMORIO_CLANG}" MATCHES "yes")
set(run_tests OFF)
message("Detected a CI clang suite: disabling running of tests")
elseif ("$ENV{DYNAMORIO_MUSL}" MATCHES "yes")
set(run_tests OFF)
message("Detected a CI musl suite: disabling running of tests")
endif ()
endif ()
if ("$ENV{CI_TARGET}" STREQUAL "package")
# We don't want flaky tests to derail package deployment. We've already run
Expand Down

0 comments on commit f679328

Please sign in to comment.