1name: LLVM Tests 2 3permissions: 4 contents: read 5 6on: 7 workflow_dispatch: 8 push: 9 branches: 10 - 'release/**' 11 paths: 12 - 'llvm/**' 13 - '.github/workflows/llvm-tests.yml' 14 - '.github/workflows/llvm-project-tests.yml' 15 pull_request: 16 branches: 17 - 'release/**' 18 paths: 19 - 'llvm/**' 20 - '.github/workflows/llvm-tests.yml' 21 - '.github/workflows/llvm-project-tests.yml' 22 23concurrency: 24 # Skip intermediate builds: always. 25 # Cancel intermediate builds: only if it is a pull request build. 26 group: ${{ github.workflow }}-${{ github.ref }} 27 cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} 28 29jobs: 30 check-all: 31 if: github.repository_owner == 'llvm' 32 name: Build and Test 33 uses: ./.github/workflows/llvm-project-tests.yml 34 with: 35 build_target: check-all 36 projects: clang;lld;libclc;lldb 37 38 abi-dump-setup: 39 if: github.repository_owner == 'llvm' 40 runs-on: ubuntu-latest 41 outputs: 42 BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }} 43 ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} 44 BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} 45 BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }} 46 LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }} 47 LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }} 48 LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }} 49 steps: 50 - name: Checkout source 51 uses: actions/checkout@v4 52 with: 53 fetch-depth: 250 54 55 - name: Get LLVM version 56 id: version 57 uses: ./.github/workflows/get-llvm-version 58 59 - name: Setup Variables 60 id: vars 61 run: | 62 # C++ ABI: 63 # 18.1.0 we aren't doing ABI checks. 64 # 18.1.1 We want to check 18.1.0. 65 # C ABI: 66 # 18.1.0 We want to check 17.0.x 67 # 18.1.1 We want to check 18.1.0 68 echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT" 69 if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then 70 { 71 echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.major }} - 1))" 72 echo "ABI_HEADERS=llvm-c" 73 } >> "$GITHUB_OUTPUT" 74 else 75 { 76 echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}" 77 echo "ABI_HEADERS=." 78 } >> "$GITHUB_OUTPUT" 79 fi 80 81 abi-dump: 82 if: github.repository_owner == 'llvm' 83 needs: abi-dump-setup 84 runs-on: ubuntu-latest 85 strategy: 86 matrix: 87 name: 88 - build-baseline 89 - build-latest 90 include: 91 - name: build-baseline 92 llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }} 93 ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MINOR }}.0 94 repo: llvm/llvm-project 95 - name: build-latest 96 llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }} 97 ref: ${{ github.sha }} 98 repo: ${{ github.repository }} 99 steps: 100 - name: Install Ninja 101 uses: llvm/actions/install-ninja@main 102 - name: Install abi-compliance-checker 103 run: | 104 sudo apt-get install abi-dumper autoconf pkg-config 105 - name: Install universal-ctags 106 run: | 107 git clone https://github.com/universal-ctags/ctags.git 108 cd ctags 109 ./autogen.sh 110 ./configure 111 sudo make install 112 - name: Download source code 113 uses: llvm/actions/get-llvm-project-src@main 114 with: 115 ref: ${{ matrix.ref }} 116 repo: ${{ matrix.repo }} 117 - name: Configure 118 run: | 119 mkdir install 120 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 llvm 121 - name: Build 122 # Need to run install-LLVM twice to ensure the symlink is installed (this is a bug). 123 run: | 124 ninja -C build install-LLVM 125 ninja -C build install-LLVM 126 ninja -C build install-llvm-headers 127 - name: Dump ABI 128 run: | 129 if [ "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" ]; then 130 nm ./install/lib/libLLVM.so | awk "/T _LLVM/ || /T LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" | cut -d ' ' -f 3 > llvm.symbols 131 # 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. 132 export EXTRA_ARGS="-symbols-list llvm.symbols" 133 else 134 touch llvm.symbols 135 fi 136 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.so 137 # Remove symbol versioning from dumps, so we can compare across major versions. 138 sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi 139 - name: Upload ABI file 140 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0 141 with: 142 name: ${{ matrix.name }} 143 path: ${{ matrix.ref }}.abi 144 145 - name: Upload symbol list file 146 if: matrix.name == 'build-baseline' 147 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0 148 with: 149 name: symbol-list 150 path: llvm.symbols 151 152 abi-compare: 153 if: github.repository_owner == 'llvm' 154 runs-on: ubuntu-latest 155 needs: 156 - abi-dump-setup 157 - abi-dump 158 steps: 159 - name: Download baseline 160 uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 161 with: 162 name: build-baseline 163 path: build-baseline 164 - name: Download latest 165 uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 166 with: 167 name: build-latest 168 path: build-latest 169 - name: Download symbol list 170 uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 171 with: 172 name: symbol-list 173 path: symbol-list 174 175 - name: Install abi-compliance-checker 176 run: sudo apt-get install abi-compliance-checker 177 - name: Compare ABI 178 run: | 179 if [ -s symbol-list/llvm.symbols ]; then 180 # This option doesn't seem to work with the ABI dumper, so passing it here. 181 export EXTRA_ARGS="-symbols-list symbol-list/llvm.symbols" 182 fi 183 # FIXME: Reading of gzip'd abi files on the GitHub runners stop 184 # working some time in March of 2021, likely due to a change in the 185 # runner's environment. 186 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" 187 - name: Upload ABI Comparison 188 if: always() 189 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0 190 with: 191 name: compat-report-${{ github.sha }} 192 path: compat_reports/ 193