Skip to content

workflows/release-binaries: Add schedule to run job once per month #73812

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 1 commit into from
Dec 13, 2023

Conversation

tstellar
Copy link
Collaborator

This will help catch any regressions introduced in the main branch before we start release testing.

This will help catch any regressions introduced in the main branch
before we start release testing.
@llvmbot
Copy link
Member

llvmbot commented Nov 29, 2023

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

Changes

This will help catch any regressions introduced in the main branch before we start release testing.


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

2 Files Affected:

  • (modified) .github/workflows/release-binaries.yml (+11-4)
  • (modified) .github/workflows/set-release-binary-outputs.sh (+24-11)
diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index 75d4f419ab1fdc1..4e3eaff97a87832 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -15,6 +15,9 @@ on:
         description: 'Tag to build'
         required: true
         type: string
+  schedule:
+    # * is a special character in YAML so you have to quote this string
+    - cron:  '0 8 1 * *'
 
 permissions:
   contents: read # Default everything to read-only
@@ -26,7 +29,7 @@ jobs:
     if: github.repository == 'llvm/llvm-project'
     outputs:
       release-version: ${{ steps.validate-tag.outputs.release-version }}
-      release: ${{ steps.validate-tag.outputs.release }}
+      flags: ${{ steps.validate-tag.outputs.flags }}
       build-dir: ${{ steps.validate-tag.outputs.build-dir }}
       rc-flags: ${{ steps.validate-tag.outputs.rc-flags }}
       ref: ${{ steps.validate-tag.outputs.ref }}
@@ -50,6 +53,11 @@ jobs:
         tag="${{ github.ref_name }}"
         trimmed=$(echo ${{ inputs.tag }} | xargs)
         [[ "$trimmed" != "" ]] && tag="$trimmed"
+        if [ "$tag" = "main" ]; then
+          # If tag is main, then we've been triggered by a scheduled so pass so
+          # use the head commit as the tag.
+          tag=`git rev-parse HEAD`
+        fi
         if [ -n "${{ inputs.upload }}" ]; then
           upload="${{ inputs.upload }}"
         else
@@ -71,7 +79,7 @@ jobs:
     - name: Checkout LLVM
       uses: actions/checkout@v4
       with:
-        ref: ${{ inputs.tag || github.ref_name }}
+        ref: ${{ needs.prepare.outputs.ref }}
 
     - name: Install Ninja
       uses: llvm/actions/install-ninja@main
@@ -140,8 +148,7 @@ jobs:
     - name: Build and test release
       run: |
         ${{ needs.prepare.outputs.build-dir }}/llvm-project/llvm/utils/release/test-release.sh \
-        -release ${{ needs.prepare.outputs.release }} \
-        ${{ needs.prepare.outputs.rc-flags }} \
+        ${{ needs.prepare.outputs.flags }} \
         -triple ${{ matrix.target.triple }} \
         -use-ninja \
         -no-checkout \
diff --git a/.github/workflows/set-release-binary-outputs.sh b/.github/workflows/set-release-binary-outputs.sh
index 8a7944e7e55fa06..9bc459a24e80194 100644
--- a/.github/workflows/set-release-binary-outputs.sh
+++ b/.github/workflows/set-release-binary-outputs.sh
@@ -16,19 +16,32 @@ if [[ "$github_user" != "tstellar" && "$github_user" != "tru" ]]; then
   echo "ERROR: User not allowed: $github_user"
   exit 1
 fi
-pattern='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
-echo "$tag" | grep -e $pattern
-if [ $? != 0 ]; then
-  echo "ERROR: Tag '$tag' doesn't match pattern: $pattern"
-  exit 1
+
+if echo $tag | grep -e '^[0-9a-f]\+$'; then
+  # This is a plain commit.
+  # TODO: Don't hardcode this.
+  release_version="18"
+  build_dir="$tag"
+  upload='false'
+  ref="$tag"
+  flags="-git-ref $tag -test-asserts"
+
+else
+
+  pattern='^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
+  echo "$tag" | grep -e $pattern
+  if [ $? != 0 ]; then
+    echo "ERROR: Tag '$tag' doesn't match pattern: $pattern"
+    exit 1
+  fi
+  release_version=`echo "$tag" | sed 's/llvmorg-//g'`
+  release=`echo "$release_version" | sed 's/-.*//g'`
+  build_dir=`echo "$release_version" | sed 's,^[^-]\+,final,' | sed 's,[^-]\+-rc\(.\+\),rc\1,'`
+  rc_flags=`echo "$release_version" | sed 's,^[^-]\+,-final,' | sed 's,[^-]\+-rc\(.\+\),-rc \1 -test-asserts,' | sed 's,--,-,'`
+  flags="-release $release $rc_flags"
 fi
-release_version=`echo "$tag" | sed 's/llvmorg-//g'`
-release=`echo "$release_version" | sed 's/-.*//g'`
-build_dir=`echo "$release_version" | sed 's,^[^-]\+,final,' | sed 's,[^-]\+-rc\(.\+\),rc\1,'`
-rc_flags=`echo "$release_version" | sed 's,^[^-]\+,-final,' | sed 's,[^-]\+-rc\(.\+\),-rc \1 -test-asserts,' | sed 's,--,-,'`
 echo "release-version=$release_version" >> $GITHUB_OUTPUT
-echo "release=$release" >> $GITHUB_OUTPUT
 echo "build-dir=$build_dir" >> $GITHUB_OUTPUT
-echo "rc-flags=$rc_flags" >> $GITHUB_OUTPUT
+echo "flags=$flags" >> $GITHUB_OUTPUT
 echo "upload=$upload" >> $GITHUB_OUTPUT
 echo "ref=$tag" >> $GITHUB_OUTPUT

@tru
Copy link
Collaborator

tru commented Nov 29, 2023

Ah this is nice. I think we should be able to manually dispatch the workflow from main as well, because we might want to trigger it a little before we branch so that we are sure it works.

@tstellar
Copy link
Collaborator Author

Ah this is nice. I think we should be able to manually dispatch the workflow from main as well, because we might want to trigger it a little before we branch so that we are sure it works.

This patch enables doing this too. We already had manual dispatch, but it only supported tags, with this PR, you can feed it an arbitrary commit.

@tstellar tstellar merged commit c5b3b5e into llvm:main Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants