1 name: libclang ABI Tests
13 - '.github/workflows/libclang-abi-tests.yml'
19 - '.github/workflows/libclang-abi-tests.yml'
22 # Skip intermediate builds: always.
23 # Cancel intermediate builds: only if it is a pull request build.
24 group: ${{ github.workflow }}-${{ github.ref }}
25 cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
29 if: github.repository_owner == 'llvm'
30 runs-on: ubuntu-latest
32 BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
33 ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
34 ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }}
35 BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
36 LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }}
37 LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }}
38 LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }}
40 - name: Checkout source
41 uses: actions/checkout@v4
45 - name: Get LLVM version
47 uses: ./.github/workflows/get-llvm-version
49 - name: Setup Variables
52 remote_repo='https://github.com/llvm/llvm-project'
53 if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then
54 major_version=$(( ${{ steps.version.outputs.major }} - 1))
55 baseline_ref="llvmorg-$major_version.1.0"
57 # If there is a minor release, we want to use that as the base line.
58 minor_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true)
59 if [ -n "$minor_ref" ]; then
60 baseline_ref="$minor_ref"
62 # Check if we have a release candidate
63 rc_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true)
64 if [ -n "$rc_ref" ]; then
65 baseline_ref="$rc_ref"
69 echo "BASELINE_VERSION_MAJOR=$major_version"
70 echo "BASELINE_REF=$baseline_ref"
71 echo "ABI_HEADERS=clang-c"
72 echo "ABI_LIBS=libclang.so"
76 echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}"
77 echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.major }}.1.0"
79 echo "ABI_LIBS=libclang.so libclang-cpp.so"
84 if: github.repository_owner == 'llvm'
86 runs-on: ubuntu-latest
93 - name: build-baseline
94 llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
95 ref: ${{ needs.abi-dump-setup.outputs.BASELINE_REF }}
96 repo: llvm/llvm-project
98 llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}
99 ref: ${{ github.sha }}
100 repo: ${{ github.repository }}
102 - name: Install Ninja
103 uses: llvm/actions/install-ninja@main
104 - name: Install abi-compliance-checker
106 sudo apt-get install abi-dumper autoconf pkg-config
107 - name: Install universal-ctags
109 git clone https://github.com/universal-ctags/ctags.git
114 - name: Download source code
115 uses: llvm/actions/get-llvm-project-src@main
117 ref: ${{ matrix.ref }}
118 repo: ${{ matrix.repo }}
122 cmake -B build -S llvm -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX="$(pwd)"/install llvm
124 run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers
127 parallel abi-dumper -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o {}-${{ matrix.ref }}.abi ./build/lib/{} ::: ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}
128 for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do
129 # Remove symbol versioning from dumps, so we can compare across major versions.
130 sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi
132 - name: Upload ABI file
133 uses: actions/upload-artifact@v3
135 name: ${{ matrix.name }}
136 path: '*${{ matrix.ref }}.abi'
139 if: github.repository_owner == 'llvm'
140 runs-on: ubuntu-latest
145 - name: Download baseline
146 uses: actions/download-artifact@v3
150 - name: Download latest
151 uses: actions/download-artifact@v3
156 - name: Install abi-compliance-checker
157 run: sudo apt-get install abi-compliance-checker
160 for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do
161 abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi -new build-latest/$lib*.abi
163 - name: Upload ABI Comparison
165 uses: actions/upload-artifact@v3
167 name: compat-report-${{ github.sha }}
168 path: compat_reports/