workflows/premerge: Add macOS testing for release branch #3436
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: LLVM Premerge Checks | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| paths: | |
| - .github/workflows/premerge.yaml | |
| push: | |
| branches: | |
| - 'main' | |
| - 'release/**' | |
| jobs: | |
| premerge-checks-linux: | |
| if: github.repository_owner == 'llvm' | |
| runs-on: llvm-premerge-linux-runners | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout LLVM | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup ccache | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| max-size: "2000M" | |
| - name: Build and Test | |
| # Mark the job as a success even if the step fails so that people do | |
| # not get notified while the new premerge pipeline is in an | |
| # experimental state. | |
| # TODO(boomanaiden154): Remove this once the pipeline is stable and we | |
| # are ready for people to start recieving notifications. | |
| continue-on-error: true | |
| run: | | |
| modified_files=$(git diff --name-only HEAD~1...HEAD) | |
| modified_dirs=$(echo "$modified_files" | cut -d'/' -f1 | sort -u) | |
| echo $modified_files | |
| echo $modified_dirs | |
| . ./.ci/compute-projects.sh | |
| all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl" | |
| modified_projects="$(keep-modified-projects ${all_projects})" | |
| linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects})) | |
| linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq) | |
| linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq) | |
| linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test}) | |
| linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq) | |
| linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq) | |
| if [[ "${linux_projects}" == "" ]]; then | |
| echo "No projects to build" | |
| exit 0 | |
| fi | |
| echo "Building projects: ${linux_projects}" | |
| echo "Running project checks targets: ${linux_check_targets}" | |
| echo "Building runtimes: ${linux_runtimes}" | |
| echo "Running runtimes checks targets: ${linux_runtime_check_targets}" | |
| export CC=/opt/llvm/bin/clang | |
| export CXX=/opt/llvm/bin/clang++ | |
| ./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})" | |
| permerge-check-macos: | |
| runs-on: macos-14 | |
| if: >- | |
| (startswith(github.ref_name, 'release/') || | |
| startswith(github.base_ref, 'refs/heads/release/')) | |
| steps: | |
| - name: Checkout LLVM | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup ccache | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| max-size: "2000M" | |
| - name: Install Ninja | |
| uses: llvm/actions/install-ninja@main | |
| - name: Build and Test | |
| run: | | |
| git config --global --add safe.directory '*' | |
| modified_files=$(git diff --name-only HEAD~1...HEAD) | |
| modified_dirs=$(echo "$modified_files" | cut -d'/' -f1 | sort -u) | |
| echo $modified_files | |
| echo $modified_dirs | |
| . ./.ci/compute-projects.sh | |
| all_projects="clang clang-tools-extra lld lldb llvm mlir" | |
| modified_projects="$(keep-modified-projects ${all_projects})" | |
| mac_check_targets=$(check-targets ${modified_projects} | sort | uniq | tr '\n' ' ') | |
| mac_projects=$(add-dependencies ${modified_projects} | sort | uniq | tr '\n' ' ') | |
| mac_runtimes_to_test=$(compute-runtimes-to-test ${modified_projects}) | |
| mac_runtime_check_targets=$(check-targets ${mac_runtimes_to_test} | sort | uniq | tr '\n' ' ') | |
| mac_runtimes=$(echo ${mac_runtimes_to_test} | tr ' ' '\n' | sort | uniq | tr '\n' ' ') | |
| if [[ "${mac_projects}" == "" ]]; then | |
| echo "No projects to build" | |
| exit 0 | |
| fi | |
| echo "Projects to test: ${modified_projects}" | |
| echo "Runtimes to test: ${mac_runtimes_to_test}" | |
| echo "Building projects: ${mac_projects}" | |
| echo "Running project checks targets: ${mac_check_targets}" | |
| echo "Building runtimes: ${mac_runtimes}" | |
| echo "Running runtimes checks targets: ${mac_runtime_check_targets}" | |
| # -DLLVM_DISABLE_ASSEMBLY_FILES=ON is for | |
| # https://github.com/llvm/llvm-project/issues/81967 | |
| cmake -G Ninja \ | |
| -B build \ | |
| -S llvm \ | |
| -DLLVM_ENABLE_PROJECTS="$(echo ${mac_projects} | tr ' ' ';')" \ | |
| -DLLVM_ENABLE_RUNTIMES="$(echo ${mac_runtimes} | tr ' ' ';')" \ | |
| -DLLVM_DISABLE_ASSEMBLY_FILES=ON \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DLLVM_ENABLE_ASSERTIONS=ON \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| ninja -C build $mac_check_targets $mac_runtime_check_targets |