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 BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}
37 LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
38 LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
39 LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
41 - name: Checkout source
42 uses: actions/checkout@v4
46 - name: Get LLVM version
48 uses: llvm/actions/get-llvm-version@main
50 - name: Setup Variables
53 remote_repo='https://github.com/llvm/llvm-project'
54 if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
55 major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))
56 baseline_ref="llvmorg-$major_version.0.0"
58 # If there is a minor release, we want to use that as the base line.
59 minor_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true)
60 if [ -n "$minor_ref" ]; then
61 baseline_ref="$minor_ref"
63 # Check if we have a release candidate
64 rc_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true)
65 if [ -n "$rc_ref" ]; then
66 baseline_ref="$rc_ref"
70 echo "BASELINE_VERSION_MAJOR=$major_version"
71 echo "BASELINE_REF=$baseline_ref"
72 echo "ABI_HEADERS=clang-c"
73 echo "ABI_LIBS=libclang.so"
77 echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}"
78 echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0"
80 echo "ABI_LIBS=libclang.so libclang-cpp.so"
85 if: github.repository_owner == 'llvm'
87 runs-on: ubuntu-latest
94 - name: build-baseline
95 llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
96 ref: ${{ needs.abi-dump-setup.outputs.BASELINE_REF }}
97 repo: llvm/llvm-project
99 llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}
100 ref: ${{ github.sha }}
101 repo: ${{ github.repository }}
103 - name: Install Ninja
104 uses: llvm/actions/install-ninja@main
105 - name: Install abi-compliance-checker
107 sudo apt-get install abi-dumper autoconf pkg-config
108 - name: Install universal-ctags
110 git clone https://github.com/universal-ctags/ctags.git
115 - name: Download source code
116 uses: llvm/actions/get-llvm-project-src@main
118 ref: ${{ matrix.ref }}
119 repo: ${{ matrix.repo }}
123 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
125 run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers
128 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 }}
129 for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do
130 # Remove symbol versioning from dumps, so we can compare across major versions.
131 sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi
133 - name: Upload ABI file
134 uses: actions/upload-artifact@v3
136 name: ${{ matrix.name }}
137 path: '*${{ matrix.ref }}.abi'
140 if: github.repository_owner == 'llvm'
141 runs-on: ubuntu-latest
146 - name: Download baseline
147 uses: actions/download-artifact@v3
151 - name: Download latest
152 uses: actions/download-artifact@v3
157 - name: Install abi-compliance-checker
158 run: sudo apt-get install abi-compliance-checker
161 for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do
162 abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi -new build-latest/$lib*.abi
164 - name: Upload ABI Comparison
166 uses: actions/upload-artifact@v3
168 name: compat-report-${{ github.sha }}
169 path: compat_reports/