brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · cb7dad7 Raw
159 lines · yaml
1name: libclang ABI Tests2 3permissions:4  contents: read5 6on:7  workflow_dispatch:8  push:9    branches:10      - 'release/**'11    paths:12      - 'clang/**'13      - '.github/workflows/libclang-abi-tests.yml'14  pull_request:15    branches:16      - 'release/**'17    paths:18      - 'clang/**'19      - '.github/workflows/libclang-abi-tests.yml'20 21concurrency: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/') }}26 27jobs:28  abi-dump-setup:29    if: github.repository_owner == 'llvm'30    runs-on: ubuntu-24.0431    outputs: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 }}39    steps:40      - name: Checkout source41        uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.042        with:43          fetch-depth: 25044 45      - name: Get LLVM version46        id: version47        uses: ./.github/workflows/get-llvm-version48 49      - name: Setup Variables50        id: vars51        run: |52          remote_repo='https://github.com/llvm/llvm-project'53          if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then54            major_version=$(( ${{ steps.version.outputs.major }} - 1))55            baseline_ref="llvmorg-$major_version.1.0"56 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" ]; then60               baseline_ref="$minor_ref"61            else62              # Check if we have a release candidate63              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" ]; then65                baseline_ref="$rc_ref"66              fi67            fi68            {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"73            } >> "$GITHUB_OUTPUT"74          else75            {76              echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}"77              echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.major }}.1.0"78              echo "ABI_HEADERS=."79              echo "ABI_LIBS=libclang.so libclang-cpp.so"80            } >> "$GITHUB_OUTPUT"81          fi82 83  abi-dump:84    if: github.repository_owner == 'llvm'85    needs: abi-dump-setup86    runs-on: ubuntu-24.0487    container:88      image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:9138b6aea737d935e92ad2afdf5d49325880f9b187b5b979b135ac80cd456135" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:9524b37c503f89    strategy:90      matrix:91        name:92          - build-baseline93          - build-latest94        include:95          - name: build-baseline96            llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}97            ref: ${{ needs.abi-dump-setup.outputs.BASELINE_REF }}98            repo: llvm/llvm-project99          - name: build-latest100            llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}101            ref: ${{ github.sha }}102            repo: ${{ github.repository }}103    steps:104      - name: Download source code105        uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0106        with:107          ref: ${{ matrix.ref }}108          repository: ${{ matrix.repo }}109      - name: Configure110        run: |111          mkdir install112          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 llvm113      - name: Build114        run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers115      - name: Dump ABI116        run: |117          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 }}118          for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do119            # Remove symbol versioning from dumps, so we can compare across major versions.120            sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi121          done122      - name: Upload ABI file123        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0124        with:125          name: ${{ matrix.name }}126          path: '*${{ matrix.ref }}.abi'127 128  abi-compare:129    if: github.repository_owner == 'llvm'130    runs-on: ubuntu-24.04131    container:132      image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:9138b6aea737d935e92ad2afdf5d49325880f9b187b5b979b135ac80cd456135" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:9524b37c503f133    needs:134      - abi-dump-setup135      - abi-dump136    steps:137      - name: Download baseline138        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0139        with:140          name: build-baseline141          path: build-baseline142      - name: Download latest143        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0144        with:145          name: build-latest146          path: build-latest147 148      - name: Compare ABI149        run: |150          for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do151            abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi -new build-latest/$lib*.abi152          done153      - name: Upload ABI Comparison154        if: always()155        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0156        with:157          name: compat-report-${{ github.sha }}158          path: compat_reports/159