Skip to content

workflows/premerge: Add macOS testing for release branch #124303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jan 31, 2025

Conversation

tstellar
Copy link
Collaborator

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jan 24, 2025

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/124303.diff

1 Files Affected:

  • (modified) .github/workflows/premerge.yaml (+68)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 30f4fc807f3a57..bdbe0537c89a62 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -10,6 +10,7 @@ on:
   push:
     branches:
       - 'main'
+      - 'release/**'
 
 jobs:
   premerge-checks-linux:
@@ -70,3 +71,70 @@ jobs:
           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: >-
+      github.repository_owner == 'llvm' &&
+      (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

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable enough to me. I'm assuming this has been tested somewhere else given that it is gated on changes being in the release branch?

@@ -10,6 +10,7 @@ on:
push:
branches:
- 'main'
- 'release/**'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you only want this for post-submit testing on the release branch? Is this just for testing currently similar to what we're doing for Linux?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to do pre-commit and post-commit testing, which is what we are currently doing on the release branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

The plan is to enable premerge testing on the release branch around when we do it on main?

When exactly do you need this ready by? The LLVM 20 branch date? (Just so I can have a better idea of when we need the new premerge to be up and running).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to have the mac testing ready by the LLVM 20 branch date. For Windows and Linux we are already covered on the release branch by buildkite, so there is no rush to start using the new GitHub Actions workflow for those platforms.

If the new workflow isn't ready. I can patch the workflow file in the release branch to drop the:

   paths:
      - .github/workflows/premerge.yaml

And also disable the linux job.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'd like to have everything ready by then, but can't make any guarantees. We'll probably have to backport some patches to the release branch as once we validate the new premerge workflow, we want to stop running the Buildkite pipeline, but they should be lowrisk (only impacting CI), and I can help with that.

uses: llvm/actions/install-ninja@main
- name: Build and Test
run: |
git config --global --add safe.directory '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this was copied from the Linux build? Can you try a build without it?

@tstellar
Copy link
Collaborator Author

@boomanaiden154 I tested this in my fork and it is passing now.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if the job is passing on your end.

@tstellar tstellar merged commit b89617d into llvm:main Jan 31, 2025
9 checks passed
@tstellar tstellar added this to the LLVM 20.X Release milestone Jan 31, 2025
@tstellar
Copy link
Collaborator Author

/cherry-pick b89617d

@llvmbot
Copy link
Member

llvmbot commented Jan 31, 2025

/pull-request #125161

swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Jan 31, 2025
Also, remove the old pre-merge tests since Linux and Windows are tested on buildkite now.

(cherry picked from commit b89617d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants