Import CI tests from the release branch
authorTom Stellard <tstellar@redhat.com>
Tue, 26 Jul 2022 23:52:53 +0000 (16:52 -0700)
committerTom Stellard <tstellar@redhat.com>
Tue, 26 Jul 2022 23:53:24 +0000 (16:53 -0700)
The tests still only run on pushes or pull requests for the release
branch, but having it in the main branch means we don't have to copy
the tests every time we create a new release branch.

Reviewed By: asl

Differential Revision: https://reviews.llvm.org/D129526

.github/workflows/clang-tests.yml [new file with mode: 0644]
.github/workflows/libclang-abi-tests.yml [new file with mode: 0644]
.github/workflows/libclc-tests.yml [new file with mode: 0644]
.github/workflows/lld-tests.yml [new file with mode: 0644]
.github/workflows/lldb-tests.yml [new file with mode: 0644]
.github/workflows/llvm-project-tests.yml [new file with mode: 0644]
.github/workflows/llvm-tests.yml [new file with mode: 0644]
.github/workflows/version-check.py [new file with mode: 0755]
.github/workflows/version-check.yml [new file with mode: 0644]

diff --git a/.github/workflows/clang-tests.yml b/.github/workflows/clang-tests.yml
new file mode 100644 (file)
index 0000000..fb2d04b
--- /dev/null
@@ -0,0 +1,37 @@
+name: Clang Tests
+
+on:
+  workflow_dispatch:
+  push:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'clang/**'
+      - '.github/workflows/clang-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!llvm/**'
+  pull_request:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'clang/**'
+      - '.github/workflows/clang-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!llvm/**'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+  check_clang:
+    if: github.repository_owner == 'llvm'
+    name: Test clang,lldb,libclc
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: check-clang
+      projects: clang;lldb;libclc
diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml
new file mode 100644 (file)
index 0000000..90e816b
--- /dev/null
@@ -0,0 +1,168 @@
+name: libclang ABI Tests
+
+on:
+  workflow_dispatch:
+  push:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'clang/**'
+      - '.github/workflows/libclang-abi-tests.yml'
+  pull_request:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'clang/**'
+      - '.github/workflows/libclang-abi-tests.yml'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+
+jobs:
+  abi-dump-setup:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-latest
+    outputs:
+      BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
+      ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
+      ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }}
+      BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
+      BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}
+      LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
+      LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
+      LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 250
+
+      - name: Get LLVM version
+        id: version
+        uses: llvm/actions/get-llvm-version@main
+
+      - name: Setup Variables
+        id: vars
+        run: |
+          minor_version=0
+          remote_repo='https://github.com/llvm/llvm-project'
+          if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
+            major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))
+            baseline_ref="llvmorg-$major_version.0.0"
+
+            # If there is a minor release, we want to use that as the base line.
+            minor_ref=`git ls-remote --refs -t $remote_repo llvmorg-$major_version.[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true`
+            if [ -n "$minor_ref" ]; then
+               baseline_ref=$minor_ref
+            else
+              # Check if we have a release candidate
+              rc_ref=`git ls-remote --refs -t $remote_repo llvmorg-$major_version.[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true`
+              if [ -n "$rc_ref" ]; then
+                baseline_ref=$rc_ref
+              fi
+            fi
+            echo ::set-output name=BASELINE_VERSION_MAJOR::$major_version
+            echo ::set-output name=BASELINE_REF::$baseline_ref
+            echo ::set-output name=ABI_HEADERS::clang-c
+            echo ::set-output name=ABI_LIBS::libclang.so
+          else
+            echo ::set-output name=BASELINE_VERSION_MAJOR::${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
+            echo ::set-output name=BASELINE_REF::llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0
+            echo ::set-output name=ABI_HEADERS::.
+            echo ::set-output name=ABI_LIBS::libclang.so libclang-cpp.so
+          fi
+
+
+  abi-dump:
+    if: github.repository_owner == 'llvm'
+    needs: abi-dump-setup
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        name:
+          - build-baseline
+          - build-latest
+        include:
+          - name: build-baseline
+            llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
+            ref: ${{ needs.abi-dump-setup.outputs.BASELINE_REF }}
+            repo: llvm/llvm-project
+          - name: build-latest
+            llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}
+            ref: ${{ github.sha }}
+            repo: ${{ github.repository }}
+    steps:
+    - name: Install Ninja
+      uses: llvm/actions/install-ninja@main
+    - name: Install abi-compliance-checker
+      run: |
+        sudo apt-get install abi-dumper autoconf pkg-config
+    - name: Install universal-ctags
+      run: |
+        git clone https://github.com/universal-ctags/ctags.git
+        cd ctags
+        ./autogen.sh
+        ./configure
+        sudo make install
+    - name: Download source code
+      uses: llvm/actions/get-llvm-project-src@main
+      with:
+        ref: ${{ matrix.ref }}
+        repo: ${{ matrix.repo }}
+    - name: Configure
+      run: |
+        mkdir install
+        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
+    - name: Build
+      run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers
+    - name: Dump ABI
+      run: |
+        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 }}
+        # Remove symbol versioning from dumps, so we can compare across major
+        # versions.  We don't need to do this for libclang.so since its ABI
+        # is stable across major releases and the symbol versions don't change.
+        if [ -e libclang-cpp.so-${{ matrix.ref }}.abi ]; then
+          sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' libclang-cpp.so-${{ matrix.ref }}.abi
+        fi
+    - name: Upload ABI file
+      uses: actions/upload-artifact@v2
+      with:
+        name: ${{ matrix.name }}
+        path: "*${{ matrix.ref }}.abi"
+
+  abi-compare:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-latest
+    needs:
+      - abi-dump-setup
+      - abi-dump
+    steps:
+      - name: Download baseline
+        uses: actions/download-artifact@v1
+        with:
+          name: build-baseline
+      - name: Download latest
+        uses: actions/download-artifact@v1
+        with:
+          name: build-latest
+
+      - name: Install abi-compliance-checker
+        run: sudo apt-get install abi-compliance-checker
+      - name: Compare ABI
+        run: |
+          for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do
+            abi-compliance-checker -lib $lib -old build-baseline/$lib*.abi -new build-latest/$lib*.abi
+          done
+      - name: Upload ABI Comparison
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: compat-report-${{ github.sha }}
+          path: compat_reports/
+
diff --git a/.github/workflows/libclc-tests.yml b/.github/workflows/libclc-tests.yml
new file mode 100644 (file)
index 0000000..f4d11e2
--- /dev/null
@@ -0,0 +1,39 @@
+name: libclc Tests
+
+on:
+  workflow_dispatch:
+  push:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'libclc/**'
+      - '.github/workflows/libclc-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!clang/**'
+      - '!llvm/**'
+  pull_request:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'libclc/**'
+      - '.github/workflows/libclc-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!clang/**'
+      - '!llvm/**'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+  check_libclc:
+    if: github.repository_owner == 'llvm'
+    name: Test libclc
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: ''
+      projects: clang;libclc
diff --git a/.github/workflows/lld-tests.yml b/.github/workflows/lld-tests.yml
new file mode 100644 (file)
index 0000000..b071aff
--- /dev/null
@@ -0,0 +1,37 @@
+name: LLD Tests
+
+on:
+  workflow_dispatch:
+  push:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'lld/**'
+      - '.github/workflows/lld-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!llvm/**'
+  pull_request:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'lld/**'
+      - '.github/workflows/lld-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!llvm/**'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+  check_lld:
+    if: github.repository_owner == 'llvm'
+    name: Test lld
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: check-lld
+      projects: lld
diff --git a/.github/workflows/lldb-tests.yml b/.github/workflows/lldb-tests.yml
new file mode 100644 (file)
index 0000000..20a4643
--- /dev/null
@@ -0,0 +1,40 @@
+name: lldb Tests
+
+on:
+  workflow_dispatch:
+  push:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'lldb/**'
+      - '.github/workflows/lldb-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!clang/**'
+      - '!llvm/**'
+  pull_request:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'lldb/**'
+      - '.github/workflows/lldb-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+      - '!clang/**'
+      - '!llvm/**'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+
+jobs:
+  build_lldb:
+    if: github.repository_owner == 'llvm'
+    name: Build lldb
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: ''
+      projects: clang;lldb
diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml
new file mode 100644 (file)
index 0000000..70c2528
--- /dev/null
@@ -0,0 +1,73 @@
+name: LLVM Project Tests
+
+on:
+  workflow_dispatch:
+    inputs:
+      build_target:
+        required: false
+      projects:
+        required: false
+  workflow_call:
+    inputs:
+      build_target:
+        required: true
+        type: string
+
+      projects:
+        required: true
+        type: string
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  # If the group name here is the same as the group name in the workflow that includes
+  # this one, then the action will try to wait on itself and get stuck.
+  group: llvm-project-${{ github.workflow }}-${{ inputs.projects}}${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+  lit-tests:
+    name: Lit Tests
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os:
+          - ubuntu-latest
+          # Use windows-2019 due to:
+          # https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
+          - windows-2019
+          # We're using a specific version of macOS due to:
+          # https://github.com/actions/virtual-environments/issues/5900
+          # We need addtional testing to see if our workaround works for
+          # new macOS builds.
+          - macOS-10.15
+    steps:
+      - name: Setup Windows
+        if: startsWith(matrix.os, 'windows')
+        uses: llvm/actions/setup-windows@main
+        with:
+          arch: amd64
+      - name: Install Ninja
+        uses: llvm/actions/install-ninja@main
+      - uses: actions/checkout@v3
+        with:
+          fetch-depth: 250
+      - name: Build and Test
+        uses: llvm/actions/build-test-llvm-project@main
+        env:
+          # Workaround for https://github.com/actions/virtual-environments/issues/5900.
+          # This should be a no-op for non-mac OSes
+          PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//11
+        with:
+          cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF'
+          build_target:  '${{ inputs.build_target }}'
+
+      - name: Build and Test libclc
+        if: "!startsWith(matrix.os, 'windows') && contains(inputs.projects, 'libclc')"
+        run: |
+          # Make sure all of LLVM libraries that llvm-config needs are built.
+          ninja -C build
+          cmake -G Ninja -S libclc -B libclc-build -DLLVM_CONFIG=`pwd`/build/bin/llvm-config -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"
+          ninja -C libclc-build
+          ninja -C libclc-build test
diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml
new file mode 100644 (file)
index 0000000..83091da
--- /dev/null
@@ -0,0 +1,195 @@
+name: LLVM Tests
+
+on:
+  workflow_dispatch:
+  push:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'llvm/**'
+      - '.github/workflows/llvm-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+  pull_request:
+    ignore-forks: true
+    branches:
+      - 'release/**'
+    paths:
+      - 'llvm/**'
+      - '.github/workflows/llvm-tests.yml'
+      - '.github/workflows/llvm-project-tests.yml'
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+
+jobs:
+  check_all:
+    if: github.repository_owner == 'llvm'
+    name: Test llvm,clang,libclc
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: check-all
+      projects: clang;libclc
+
+  # These need to be separate from the check_all job, becuase there is not enough disk
+  # space to build all these projects on Windows.
+  build_lldb:
+    if: github.repository_owner == 'llvm'
+    name: Build lldb
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: ''
+      projects: clang;lldb
+
+  check_lld:
+    if: github.repository_owner == 'llvm'
+    name: Test lld
+    uses: ./.github/workflows/llvm-project-tests.yml
+    with:
+      build_target: check-lld
+      projects: lld
+
+  abi-dump-setup:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-latest
+    outputs:
+      BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
+      ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
+      BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
+      LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
+      LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
+      LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
+    steps:
+      - name: Checkout source
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 250
+
+      - name: Get LLVM version
+        id: version
+        uses: llvm/actions/get-llvm-version@main
+
+      - name: Setup Variables
+        id: vars
+        run: |
+          if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
+            echo ::set-output name=BASELINE_VERSION_MAJOR::$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))
+            echo ::set-output name=ABI_HEADERS::llvm-c
+          else
+            echo ::set-output name=BASELINE_VERSION_MAJOR::${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
+            echo ::set-output name=ABI_HEADERS::.
+          fi
+
+  abi-dump:
+    if: github.repository_owner == 'llvm'
+    needs: abi-dump-setup
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        name:
+          - build-baseline
+          - build-latest
+        include:
+          - name: build-baseline
+            llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
+            ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.0.0
+            repo: llvm/llvm-project
+          - name: build-latest
+            llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}
+            ref: ${{ github.sha }}
+            repo: ${{ github.repository }}
+    steps:
+    - name: Install Ninja
+      uses: llvm/actions/install-ninja@main
+    - name: Install abi-compliance-checker
+      run: |
+        sudo apt-get install abi-dumper autoconf pkg-config
+    - name: Install universal-ctags
+      run: |
+        git clone https://github.com/universal-ctags/ctags.git
+        cd ctags
+        ./autogen.sh
+        ./configure
+        sudo make install
+    - name: Download source code
+      uses: llvm/actions/get-llvm-project-src@main
+      with:
+        ref: ${{ matrix.ref }}
+        repo: ${{ matrix.repo }}
+    - name: Configure
+      run: |
+        mkdir install
+        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
+    - name: Build
+      # Need to run install-LLVM twice to ensure the symlink is installed (this is a bug).
+      run: |
+        ninja -C build install-LLVM
+        ninja -C build install-LLVM
+        ninja -C build install-llvm-headers
+    - name: Dump ABI
+      run: |
+        if [ "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c" ]; then
+          nm ./install/lib/libLLVM.so | awk "/T _LLVM/ || /T LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" | cut -d ' ' -f 3 > llvm.symbols
+          # 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.
+          export EXTRA_ARGS="-symbols-list llvm.symbols"
+        else
+          touch llvm.symbols
+        fi
+        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
+        # Remove symbol versioning from dumps, so we can compare across major versions.
+        sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi
+    - name: Upload ABI file
+      uses: actions/upload-artifact@v1
+      with:
+        name: ${{ matrix.name }}
+        path: ${{ matrix.ref }}.abi
+
+    - name: Upload symbol list file
+      if: matrix.name == 'build-baseline'
+      uses: actions/upload-artifact@v1
+      with:
+        name: symbol-list
+        path: llvm.symbols
+
+  abi-compare:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-latest
+    needs:
+      - abi-dump-setup
+      - abi-dump
+    steps:
+      - name: Download baseline
+        uses: actions/download-artifact@v1
+        with:
+          name: build-baseline
+      - name: Download latest
+        uses: actions/download-artifact@v1
+        with:
+          name: build-latest
+      - name: Download symbol list
+        uses: actions/download-artifact@v1
+        with:
+          name: symbol-list
+
+      - name: Install abi-compliance-checker
+        run: sudo apt-get install abi-compliance-checker
+      - name: Compare ABI
+        run: |
+          if [ -s symbol-list/llvm.symbols ]; then
+            # This option doesn't seem to work with the ABI dumper, so passing it here.
+            export EXTRA_ARGS="-symbols-list symbol-list/llvm.symbols"
+          fi
+          # FIXME: Reading of gzip'd abi files on the GitHub runners stop
+          # working some time in March of 2021, likely due to a change in the
+          # runner's environment.
+          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"
+      - name: Upload ABI Comparison
+        if: always()
+        uses: actions/upload-artifact@v1
+        with:
+          name: compat-report-${{ github.sha }}
+          path: compat_reports/
diff --git a/.github/workflows/version-check.py b/.github/workflows/version-check.py
new file mode 100755 (executable)
index 0000000..74c061e
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/python3
+
+from git import Repo
+import re
+import sys
+
+version = sys.argv[1]
+
+repo = Repo()
+
+tag = repo.git.describe(tags = True, abbrev=0)
+m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)', tag)
+if not m:
+    print("error: Tag is not valid: ", tag)
+    sys.exit(1)
+
+expected_major = m.group(1)
+expected_minor = m.group(2)
+expected_patch = int(m.group(3)) + 1
+expected_version = f"{expected_major}.{expected_minor}.{expected_patch}"
+
+m = re.match("[0-9]+\.[0-9]+\.[0-9]+", version)
+if not m:
+    print("error: Version is not valid: ", version)
+    sys.exit(1)
+
+if version != expected_version:
+    print("error: Expected version", expected_version, "but found version", version)
+    sys.exit(1)
+
+print("Versions match:", version, expected_version)
+sys.exit(0)
diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml
new file mode 100644 (file)
index 0000000..8f89db3
--- /dev/null
@@ -0,0 +1,29 @@
+name: LLVM Project Version Check
+
+on:
+  push:
+    branches:
+      - 'release/**'
+  pull_request:
+    branches:
+      - 'release/**'
+
+
+jobs:
+  version_check:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Fetch LLVM sources
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Install dependencies
+        run: |
+          pip install -r ./llvm/utils/git/requirements.txt
+
+      - name: Version Check
+        run: |
+          version=`grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' llvm/CMakeLists.txt  | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g'`
+          .github/workflows/version-check.py $version