From 1bc10af02176dc22f30227ef61e24ad67f735578 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 12 Aug 2025 09:59:11 -0400 Subject: [PATCH 01/13] [CI] : Temporarily build against forked torch-mlir to ensure CI build fix is valid. --- .github/workflows/buildReleaseAndPublish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildReleaseAndPublish.yml b/.github/workflows/buildReleaseAndPublish.yml index ded3e45..993a737 100644 --- a/.github/workflows/buildReleaseAndPublish.yml +++ b/.github/workflows/buildReleaseAndPublish.yml @@ -32,8 +32,8 @@ jobs: - name: Checkout torch-mlir uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - repository: llvm/torch-mlir - ref: refs/heads/main + repository: sahas3/torch-mlir + ref: refs/heads/fix_linux_release_ci submodules: 'true' - name: Setup workspace From 7cdf9fd1d93e8abf01c9ec8f79030decd0a93b23 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Mon, 3 Nov 2025 07:37:38 -0500 Subject: [PATCH 02/13] [CI] : Delete old release assets due to GH policy of max 1000 assets per release. --- .github/workflows/deleteOldReleases.yml | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/deleteOldReleases.yml diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml new file mode 100644 index 0000000..a36704d --- /dev/null +++ b/.github/workflows/deleteOldReleases.yml @@ -0,0 +1,51 @@ +name: Delete Old Releases + +on: + schedule: + - cron: '0 10 * * *' # Daily at 10:00 UTC which is 2:00 AM PST (UTC-8) + workflow_dispatch: # Manual trigger + push: + +jobs: + clean_releases: + runs-on: ubuntu-latest + steps: + - name: Delete old releases + # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Don't run this in everyone's forks on schedule but allow to run via dispatch. + if: ${{ github.repository_owner == 'llvm' || github.event_name != 'schedule' }} + run: | + + # Define 60 days in seconds (60 * 24 * 60 * 60 = 5184000) + SECONDS_60_DAYS=5184000 + + # Store the list of asset ID and Name pairs in the variable + # "ASSET_ID ASSET_NAME" on each line + ASSETS_TO_DELETE=$(gh api --paginate repos/${{ github.repository }}/releases | \ + jq -r --argjson cutoff_seconds "$SECONDS_60_DAYS" ' + # Calculate the 60-day cutoff as now minus 60 days + . as $releases | (now - $cutoff_seconds) as $cutoff | + + # Iterate through every single asset in every release + $releases[].assets[] | + + # Convert the asset date string to a numeric timestamp + (.created_at | fromdateiso8601) as $asset_time | + + # Select assets where the asset_time is older than the cutoff + select($asset_time < $cutoff) | + + # Output the asset ID and Name, separated by a space + "\(.id) \(.name)" + ') + + # Process each asset using a loop to read two space-separated fields from the ASSETS_TO_DELETE variable. + while IFS=' ' read -r ID NAME; do + # Check if both ID and NAME were successfully read + if [ -n "$ID" ]; then + echo "Deleting old asset: ID $ID (Name: $NAME)" + gh api --method DELETE repos/${{ github.repository }}/releases/assets/$ID + fi + done <<< "$ASSETS_TO_DELETE" From c245d99066c2a4a7b356f00746f685f7795c4899 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Mon, 3 Nov 2025 07:58:13 -0500 Subject: [PATCH 03/13] [CI] : Fail CI if uploading artifacts fail. --- .github/workflows/buildReleaseAndPublish.yml | 1 + .github/workflows/buildReleaseAndPublishWindows.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/buildReleaseAndPublish.yml b/.github/workflows/buildReleaseAndPublish.yml index adbff44..5d211e3 100644 --- a/.github/workflows/buildReleaseAndPublish.yml +++ b/.github/workflows/buildReleaseAndPublish.yml @@ -71,3 +71,4 @@ jobs: allowUpdates: true replacesArtifacts: true makeLatest: true + artifactErrorsFailBuild: true diff --git a/.github/workflows/buildReleaseAndPublishWindows.yml b/.github/workflows/buildReleaseAndPublishWindows.yml index 932f675..3aa507d 100644 --- a/.github/workflows/buildReleaseAndPublishWindows.yml +++ b/.github/workflows/buildReleaseAndPublishWindows.yml @@ -80,3 +80,4 @@ jobs: allowUpdates: true replacesArtifacts: true makeLatest: true + artifactErrorsFailBuild: true From 09578bcd3633d0c81b3dbf449105453f02b554dc Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Mon, 3 Nov 2025 07:59:22 -0500 Subject: [PATCH 04/13] Revert "[CI] : Temporarily build against forked torch-mlir to ensure CI build fix is valid." This reverts commit 1bc10af02176dc22f30227ef61e24ad67f735578. --- .github/workflows/buildReleaseAndPublish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildReleaseAndPublish.yml b/.github/workflows/buildReleaseAndPublish.yml index 5d211e3..421a61d 100644 --- a/.github/workflows/buildReleaseAndPublish.yml +++ b/.github/workflows/buildReleaseAndPublish.yml @@ -32,8 +32,8 @@ jobs: - name: Checkout torch-mlir uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: - repository: sahas3/torch-mlir - ref: refs/heads/fix_linux_release_ci + repository: llvm/torch-mlir + ref: refs/heads/main submodules: 'true' - name: Setup workspace From 5d1fa6722568c74c8c1fe99c9a8271d282f6a41d Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Wed, 5 Nov 2025 14:10:08 -0500 Subject: [PATCH 05/13] Address feedback --- .github/workflows/deleteOldReleases.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index a36704d..9f3668e 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -3,14 +3,13 @@ name: Delete Old Releases on: schedule: - cron: '0 10 * * *' # Daily at 10:00 UTC which is 2:00 AM PST (UTC-8) - workflow_dispatch: # Manual trigger - push: + workflow_dispatch: jobs: - clean_releases: + delete_release_assets: runs-on: ubuntu-latest steps: - - name: Delete old releases + - name: Delete old release assets # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -19,12 +18,12 @@ jobs: run: | # Define 60 days in seconds (60 * 24 * 60 * 60 = 5184000) - SECONDS_60_DAYS=5184000 + 60_DAYS_IN_SECONDS=5184000 # Store the list of asset ID and Name pairs in the variable # "ASSET_ID ASSET_NAME" on each line ASSETS_TO_DELETE=$(gh api --paginate repos/${{ github.repository }}/releases | \ - jq -r --argjson cutoff_seconds "$SECONDS_60_DAYS" ' + jq -r --argjson cutoff_seconds "$60_DAYS_IN_SECONDS" ' # Calculate the 60-day cutoff as now minus 60 days . as $releases | (now - $cutoff_seconds) as $cutoff | From 733d2c5ba9842be462c4161f37224172d62b8702 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 09:39:07 -0500 Subject: [PATCH 06/13] Update the check to consider name in addition to ID as well. --- .github/workflows/deleteOldReleases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 9f3668e..7fd3e1a 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -43,7 +43,7 @@ jobs: # Process each asset using a loop to read two space-separated fields from the ASSETS_TO_DELETE variable. while IFS=' ' read -r ID NAME; do # Check if both ID and NAME were successfully read - if [ -n "$ID" ]; then + if [ -n "$ID" ] && [ -n "$NAME" ]; then echo "Deleting old asset: ID $ID (Name: $NAME)" gh api --method DELETE repos/${{ github.repository }}/releases/assets/$ID fi From a9e588bbb0fc4b7febffa7c31845d5c6774b9378 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 11:55:26 -0500 Subject: [PATCH 07/13] Simplify asset find + delete logic --- .github/workflows/deleteOldReleases.yml | 41 ++++++++----------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 7fd3e1a..606b2a2 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -7,7 +7,10 @@ on: jobs: delete_release_assets: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + permissions: + contents: reads + packages: write steps: - name: Delete old release assets # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable @@ -20,31 +23,13 @@ jobs: # Define 60 days in seconds (60 * 24 * 60 * 60 = 5184000) 60_DAYS_IN_SECONDS=5184000 - # Store the list of asset ID and Name pairs in the variable - # "ASSET_ID ASSET_NAME" on each line - ASSETS_TO_DELETE=$(gh api --paginate repos/${{ github.repository }}/releases | \ + # Find assets older than 60 days in the 'dev-wheels' release and pipe their names to xargs for deletion. + gh release view dev-wheels --json assets | \ jq -r --argjson cutoff_seconds "$60_DAYS_IN_SECONDS" ' - # Calculate the 60-day cutoff as now minus 60 days - . as $releases | (now - $cutoff_seconds) as $cutoff | - - # Iterate through every single asset in every release - $releases[].assets[] | - - # Convert the asset date string to a numeric timestamp - (.created_at | fromdateiso8601) as $asset_time | - - # Select assets where the asset_time is older than the cutoff - select($asset_time < $cutoff) | - - # Output the asset ID and Name, separated by a space - "\(.id) \(.name)" - ') - - # Process each asset using a loop to read two space-separated fields from the ASSETS_TO_DELETE variable. - while IFS=' ' read -r ID NAME; do - # Check if both ID and NAME were successfully read - if [ -n "$ID" ] && [ -n "$NAME" ]; then - echo "Deleting old asset: ID $ID (Name: $NAME)" - gh api --method DELETE repos/${{ github.repository }}/releases/assets/$ID - fi - done <<< "$ASSETS_TO_DELETE" + (now - $cutoff_seconds) as $cutoff | + # Iterate over the assets in the single release + .assets[] | + # Select assets older than the cutoff + select((.createdAt | fromdateiso8601) < $cutoff) | + .name + ' | xargs -L1 gh release delete-asset dev-wheels From b3da22b798978308c4b92d39cb6830aefed31d9e Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 12:44:12 -0500 Subject: [PATCH 08/13] Fix typo: reads -> read --- .github/workflows/deleteOldReleases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 606b2a2..f127c2b 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -9,7 +9,7 @@ jobs: delete_release_assets: runs-on: ubuntu-24.04 permissions: - contents: reads + contents: read packages: write steps: - name: Delete old release assets From 85aba77b930ec4a83f782bf0f2a8414934e7a6cf Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 12:46:28 -0500 Subject: [PATCH 09/13] Temporarily add a push trigger to try to run CI in forked repo. --- .github/workflows/deleteOldReleases.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index f127c2b..8060e47 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -4,6 +4,7 @@ on: schedule: - cron: '0 10 * * *' # Daily at 10:00 UTC which is 2:00 AM PST (UTC-8) workflow_dispatch: + push: jobs: delete_release_assets: @@ -21,15 +22,15 @@ jobs: run: | # Define 60 days in seconds (60 * 24 * 60 * 60 = 5184000) - 60_DAYS_IN_SECONDS=5184000 + CUTOFF_SECONDS=5184000 # Find assets older than 60 days in the 'dev-wheels' release and pipe their names to xargs for deletion. gh release view dev-wheels --json assets | \ - jq -r --argjson cutoff_seconds "$60_DAYS_IN_SECONDS" ' + jq -r --argjson cutoff_seconds "$CUTOFF_SECONDS" ' (now - $cutoff_seconds) as $cutoff | # Iterate over the assets in the single release .assets[] | # Select assets older than the cutoff select((.createdAt | fromdateiso8601) < $cutoff) | .name - ' | xargs -L1 gh release delete-asset dev-wheels + ' | xargs -r gh release delete-asset dev-wheels From ad43652ac9714dc9ff05745c57f1326780f9a4d9 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 13:19:43 -0500 Subject: [PATCH 10/13] Add explicit reference to github repo. --- .github/workflows/deleteOldReleases.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 8060e47..689f378 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -21,11 +21,11 @@ jobs: if: ${{ github.repository_owner == 'llvm' || github.event_name != 'schedule' }} run: | - # Define 60 days in seconds (60 * 24 * 60 * 60 = 5184000) + # Define cutoff in seconds with 60 days as the threshold (60 * 24 * 60 * 60 = 5184000) CUTOFF_SECONDS=5184000 # Find assets older than 60 days in the 'dev-wheels' release and pipe their names to xargs for deletion. - gh release view dev-wheels --json assets | \ + gh release view dev-wheels --repo ${{ github.repository }} --json assets | \ jq -r --argjson cutoff_seconds "$CUTOFF_SECONDS" ' (now - $cutoff_seconds) as $cutoff | # Iterate over the assets in the single release From 7f9e2b1e23093f498535480fd8fe033bb3157cfd Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 13:20:45 -0500 Subject: [PATCH 11/13] Remove github token. --- .github/workflows/deleteOldReleases.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 689f378..1c173a8 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -14,9 +14,9 @@ jobs: packages: write steps: - name: Delete old release assets - # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Don't run this in everyone's forks on schedule but allow to run via dispatch. if: ${{ github.repository_owner == 'llvm' || github.event_name != 'schedule' }} run: | From fd4195900da0f7a71fccee9d531a00db92962f84 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 13:21:48 -0500 Subject: [PATCH 12/13] [revert] : Remove github token. --- .github/workflows/deleteOldReleases.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 1c173a8..689f378 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -14,9 +14,9 @@ jobs: packages: write steps: - name: Delete old release assets - # # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Don't run this in everyone's forks on schedule but allow to run via dispatch. if: ${{ github.repository_owner == 'llvm' || github.event_name != 'schedule' }} run: | From 93f14beeb0a22ed9757c2ab9e08b7dfe960167d7 Mon Sep 17 00:00:00 2001 From: Sayan Saha Date: Tue, 11 Nov 2025 13:22:38 -0500 Subject: [PATCH 13/13] [revert] : Remove push trigger. --- .github/workflows/deleteOldReleases.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deleteOldReleases.yml b/.github/workflows/deleteOldReleases.yml index 689f378..ecd7522 100644 --- a/.github/workflows/deleteOldReleases.yml +++ b/.github/workflows/deleteOldReleases.yml @@ -4,7 +4,6 @@ on: schedule: - cron: '0 10 * * *' # Daily at 10:00 UTC which is 2:00 AM PST (UTC-8) workflow_dispatch: - push: jobs: delete_release_assets: