|
| 1 | +name: libclang ABI Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'release/**' |
| 7 | + paths: |
| 8 | + - 'clang/**' |
| 9 | + - '.github/workflows/libclang-abi-tests.yml' |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - 'clang/**' |
| 13 | + - '.github/workflows/libclang-abi-tests.yml' |
| 14 | + |
| 15 | +jobs: |
| 16 | + abi-dump-setup: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} |
| 20 | + ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} |
| 21 | + ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }} |
| 22 | + BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} |
| 23 | + LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} |
| 24 | + LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }} |
| 25 | + LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }} |
| 26 | + steps: |
| 27 | + - name: Checkout source |
| 28 | + uses: actions/checkout@v1 |
| 29 | + with: |
| 30 | + fetch-depth: 1 |
| 31 | + |
| 32 | + - name: Get LLVM version |
| 33 | + id: version |
| 34 | + uses: llvm/actions/get-llvm-version@main |
| 35 | + |
| 36 | + - name: Setup Variables |
| 37 | + id: vars |
| 38 | + run: | |
| 39 | + if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then |
| 40 | + echo ::set-output name=BASELINE_VERSION_MAJOR::$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1)) |
| 41 | + echo ::set-output name=ABI_HEADERS::clang-c |
| 42 | + echo ::set-output name=ABI_LIBS::libclang.so |
| 43 | + else |
| 44 | + echo ::set-output name=BASELINE_VERSION_MAJOR::${{ steps.version.outputs.LLVM_VERSION_MAJOR }} |
| 45 | + echo ::set-output name=ABI_HEADERS::. |
| 46 | + echo ::set-output name=ABI_LIBS::libclang.so libclang-cpp.so |
| 47 | + fi |
| 48 | +
|
| 49 | + abi-dump: |
| 50 | + needs: abi-dump-setup |
| 51 | + runs-on: ubuntu-latest |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + name: |
| 55 | + - build-baseline |
| 56 | + - build-latest |
| 57 | + include: |
| 58 | + - name: build-baseline |
| 59 | + llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }} |
| 60 | + ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.0.0 |
| 61 | + repo: llvm/llvm-project |
| 62 | + - name: build-latest |
| 63 | + llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }} |
| 64 | + ref: ${{ github.sha }} |
| 65 | + repo: ${{ github.repository }} |
| 66 | + steps: |
| 67 | + - name: Install Ninja |
| 68 | + uses: llvm/actions/install-ninja@main |
| 69 | + - name: Install abi-compliance-checker |
| 70 | + run: | |
| 71 | + sudo apt-get install abi-dumper autoconf pkg-config |
| 72 | + - name: Install universal-ctags |
| 73 | + run: | |
| 74 | + git clone https://github.com/universal-ctags/ctags.git |
| 75 | + cd ctags |
| 76 | + ./autogen.sh |
| 77 | + ./configure |
| 78 | + sudo make install |
| 79 | + - name: Download source code |
| 80 | + uses: llvm/actions/get-llvm-project-src@main |
| 81 | + with: |
| 82 | + ref: ${{ matrix.ref }} |
| 83 | + repo: ${{ matrix.repo }} |
| 84 | + - name: Configure |
| 85 | + run: | |
| 86 | + mkdir install |
| 87 | + 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="-g -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g -Og" -DCMAKE_INSTALL_PREFIX=`pwd`/install llvm |
| 88 | + - name: Build |
| 89 | + run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers |
| 90 | + - name: Dump ABI |
| 91 | + run: | |
| 92 | + 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 }} |
| 93 | + for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do |
| 94 | + # Remove symbol versioning from dumps, so we can compare across major versions. |
| 95 | + sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi |
| 96 | + tar -czf $lib-${{ matrix.ref }}.abi.tar.gz $lib-${{ matrix.ref }}.abi |
| 97 | + done |
| 98 | + - name: Upload ABI file |
| 99 | + uses: actions/upload-artifact@v2 |
| 100 | + with: |
| 101 | + name: ${{ matrix.name }} |
| 102 | + path: "*${{ matrix.ref }}.abi.tar.gz" |
| 103 | + |
| 104 | + abi-compare: |
| 105 | + runs-on: ubuntu-latest |
| 106 | + needs: |
| 107 | + - abi-dump-setup |
| 108 | + - abi-dump |
| 109 | + steps: |
| 110 | + - name: Download baseline |
| 111 | + uses: actions/download-artifact@v1 |
| 112 | + with: |
| 113 | + name: build-baseline |
| 114 | + - name: Download latest |
| 115 | + uses: actions/download-artifact@v1 |
| 116 | + with: |
| 117 | + name: build-latest |
| 118 | + |
| 119 | + - name: Install abi-compliance-checker |
| 120 | + run: sudo apt-get install abi-compliance-checker |
| 121 | + - name: Compare ABI |
| 122 | + run: | |
| 123 | + for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do |
| 124 | + abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi.tar.gz -new build-latest/$lib*.abi.tar.gz |
| 125 | + done |
| 126 | + - name: Upload ABI Comparison |
| 127 | + if: always() |
| 128 | + uses: actions/upload-artifact@v2 |
| 129 | + with: |
| 130 | + name: compat-report-${{ github.sha }} |
| 131 | + path: compat_reports/ |
| 132 | + |
0 commit comments