brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.8 KiB · 58eb6fa Raw
173 lines · yaml
1name: LLVM ABI Tests2 3permissions:4  contents: read5 6on:7  workflow_dispatch:8  push:9    branches:10      - 'release/**'11    paths:12      - 'llvm/**'13      - '.github/workflows/llvm-abi-tests.yml'14  pull_request:15    branches:16      - 'release/**'17    paths:18      - 'llvm/**'19      - '.github/workflows/llvm-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      BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}35      BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}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          # C++ ABI:53          # 18.1.0 we aren't doing ABI checks.54          # 18.1.1 We want to check 18.1.0.55          # C ABI:56          # 18.1.0 We want to check 17.0.x57          # 18.1.1 We want to check 18.1.058          echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"59          if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then60            {61              echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.major }} - 1))"62              echo "ABI_HEADERS=llvm-c"63            } >> "$GITHUB_OUTPUT"64          else65            {66              echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}"67              echo "ABI_HEADERS=."68            } >> "$GITHUB_OUTPUT"69          fi70 71  abi-dump:72    if: github.repository_owner == 'llvm'73    needs: abi-dump-setup74    runs-on: ubuntu-24.0475    container:76      image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:9138b6aea737d935e92ad2afdf5d49325880f9b187b5b979b135ac80cd456135" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:bb0bd382ab2b"77    strategy:78      matrix:79        name:80          - build-baseline81          - build-latest82        include:83          - name: build-baseline84            llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}85            ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MINOR }}.086            repo: llvm/llvm-project87          - name: build-latest88            llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}89            ref: ${{ github.sha }}90            repo: ${{ github.repository }}91    steps:92      - name: Download source code93        uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.094        with:95          ref: ${{ matrix.ref }}96          repository: ${{ matrix.repo }}97      - name: Configure98        run: |99          mkdir install100          cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX="$(pwd)"/install llvm101      - name: Build102        # Need to run install-LLVM twice to ensure the symlink is installed (this is a bug).103        run: |104          ninja -C build install-LLVM105          ninja -C build install-LLVM106          ninja -C build install-llvm-headers107      - name: Dump ABI108        run: |109          if [ "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" ]; then110            nm ./install/lib/libLLVM.so | awk "/T _LLVM/ || /T LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" | cut -d ' ' -f 3 > llvm.symbols111            # Even though the -symbols-list option doesn't seem to filter out the symbols, I believe it speeds up processing, so I'm leaving it in.112            export EXTRA_ARGS="-symbols-list llvm.symbols"113          else114            touch llvm.symbols115          fi116          abi-dumper $EXTRA_ARGS -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o ${{ matrix.ref }}.abi ./install/lib/libLLVM.so117          # Remove symbol versioning from dumps, so we can compare across major versions.118          sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi119      - name: Upload ABI file120        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0121        with:122          name: ${{ matrix.name }}123          path: ${{ matrix.ref }}.abi124 125      - name: Upload symbol list file126        if: matrix.name == 'build-baseline'127        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0128        with:129          name: symbol-list130          path: llvm.symbols131 132  abi-compare:133    if: github.repository_owner == 'llvm'134    runs-on: ubuntu-24.04135    container:136      image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:9138b6aea737d935e92ad2afdf5d49325880f9b187b5b979b135ac80cd456135" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:bb0bd382ab2b137    needs:138      - abi-dump-setup139      - abi-dump140    steps:141      - name: Download baseline142        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0143        with:144          name: build-baseline145          path: build-baseline146      - name: Download latest147        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0148        with:149          name: build-latest150          path: build-latest151      - name: Download symbol list152        uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0153        with:154          name: symbol-list155          path: symbol-list156 157      - name: Compare ABI158        run: |159          if [ -s symbol-list/llvm.symbols ]; then160            # This option doesn't seem to work with the ABI dumper, so passing it here.161            export EXTRA_ARGS="-symbols-list symbol-list/llvm.symbols"162          fi163          # FIXME: Reading of gzip'd abi files on the GitHub runners stop164          # working some time in March of 2021, likely due to a change in the165          # runner's environment.166          abi-compliance-checker $EXTRA_ARGS -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c"167      - name: Upload ABI Comparison168        if: always()169        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # 5.0.0170        with:171          name: compat-report-${{ github.sha }}172          path: compat_reports/173