-
Notifications
You must be signed in to change notification settings - Fork 26
Fix mimalloc arena alignment assertion for structure heap #143
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
base: main
Are you sure you want to change the base?
Changes from all commits
fda7c35
ab2470a
93ccaf0
309346a
2da75ad
631217f
e8d0a95
1e0c749
b31f5b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| name: Preview Build | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
|
|
@@ -13,101 +13,62 @@ on: | |
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: preview-build-pr-${{ github.event.issue.number || inputs.pr_number }} | ||
| group: preview-build-pr-${{ github.event.pull_request.number || inputs.pr_number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| trigger: | ||
| name: Trigger Preview Build | ||
| runs-on: ubuntu-latest | ||
| if: | | ||
| github.event_name == 'workflow_dispatch' || | ||
| (github.event.issue.pull_request && contains(github.event.comment.body, '/build-preview')) | ||
| outputs: | ||
| sha: ${{ steps.pr.outputs.sha }} | ||
| short_sha: ${{ steps.pr.outputs.short_sha }} | ||
| release_tag: ${{ steps.pr.outputs.release_tag }} | ||
| pr_number: ${{ steps.pr_number.outputs.number }} | ||
| pr_number: ${{ steps.pr.outputs.pr_number }} | ||
|
|
||
| steps: | ||
| - name: Set PR number | ||
| id: pr_number | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Check permissions | ||
| if: github.event_name == 'issue_comment' | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| username: context.payload.comment.user.login | ||
| username: context.actor | ||
| }); | ||
|
|
||
| if (!['admin', 'write'].includes(permission.permission)) { | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: '-1' | ||
| }); | ||
| core.setFailed('❌ Only collaborators with write access can trigger preview builds'); | ||
| core.setFailed(`${context.actor} does not have write access. Preview builds must be triggered manually via workflow_dispatch.`); | ||
| } | ||
|
|
||
| - name: Get PR information | ||
| id: pr | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: ${{ steps.pr_number.outputs.number }} | ||
| }); | ||
|
|
||
| const shortSha = pr.head.sha.substring(0, 8); | ||
| const releaseTag = `autobuild-preview-pr-${{ steps.pr_number.outputs.number }}-${shortSha}`; | ||
| let sha, prNumber; | ||
|
|
||
| core.setOutput('sha', pr.head.sha); | ||
| core.setOutput('short_sha', shortSha); | ||
| core.setOutput('release_tag', releaseTag); | ||
|
|
||
| - name: React to comment | ||
| if: github.event_name == 'issue_comment' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: 'eyes' | ||
| }); | ||
| if (context.eventName === 'pull_request') { | ||
| sha = context.payload.pull_request.head.sha; | ||
| prNumber = context.payload.pull_request.number; | ||
| } else { | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: ${{ inputs.pr_number || 0 }} | ||
| }); | ||
| sha = pr.head.sha; | ||
| prNumber = ${{ inputs.pr_number || 0 }}; | ||
| } | ||
|
|
||
| - name: Post starting message | ||
| if: github.event_name == 'issue_comment' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const body = "🔄 Preview build started\n\n" + | ||
| "**Release tag**: `${{ steps.pr.outputs.release_tag }}`\n" + | ||
| "**Workflow**: [View progress](" + context.serverUrl + "/" + context.repo.owner + "/" + context.repo.repo + "/actions/runs/" + context.runId + ")"; | ||
| const shortSha = sha.substring(0, 8); | ||
| const releaseTag = `autobuild-preview-pr-${prNumber}-${shortSha}`; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: ${{ steps.pr_number.outputs.number }}, | ||
| body: body | ||
| }); | ||
| core.setOutput('sha', sha); | ||
| core.setOutput('release_tag', releaseTag); | ||
| core.setOutput('pr_number', prNumber); | ||
|
|
||
| build: | ||
| name: Build | ||
|
|
@@ -122,68 +83,63 @@ jobs: | |
| llvm_version: '19' | ||
|
|
||
| notify: | ||
| name: Notify Completion | ||
| name: Update PR Comment | ||
| needs: [trigger, build] | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| if: needs.build.result == 'success' | ||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Post success comment | ||
| if: needs.build.result == 'success' | ||
| - name: Update preview build comment | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const marker = '<!-- preview-build-comment -->'; | ||
| const prNumber = ${{ needs.trigger.outputs.pr_number }}; | ||
| const releaseTag = '${{ needs.trigger.outputs.release_tag }}'; | ||
| const body = "✅ Preview build completed\n\n" + | ||
| "**Release**: [" + releaseTag + "](https://github.com/" + context.repo.owner + "/" + context.repo.repo + "/releases/tag/" + releaseTag + ")"; | ||
| const sha = '${{ needs.trigger.outputs.sha }}'; | ||
| const shortSha = sha.substring(0, 8); | ||
| const releaseUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/releases/tag/${releaseTag}`; | ||
| const newEntry = `| \`${shortSha}\` | [\`${releaseTag}\`](${releaseUrl}) | ${new Date().toISOString().replace('T', ' ').substring(0, 19)} UTC |`; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| // Find existing comment | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: ${{ needs.trigger.outputs.pr_number }}, | ||
| body: body | ||
| issue_number: prNumber, | ||
| per_page: 100 | ||
| }); | ||
| const existing = comments.find(c => c.body.includes(marker)); | ||
|
|
||
| // Build table | ||
| let previousRows = ''; | ||
| if (existing) { | ||
| const lines = existing.body.split('\n'); | ||
| const tableLines = lines.filter(l => l.startsWith('| `')); | ||
| previousRows = tableLines.length > 0 ? '\n' + tableLines.join('\n') : ''; | ||
| } | ||
|
|
||
| - name: React to failure | ||
| if: needs.build.result == 'failure' && github.event_name == 'issue_comment' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: '-1' | ||
| }); | ||
|
|
||
| - name: Post failure comment | ||
| if: needs.build.result == 'failure' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const body = "❌ Preview build failed\n\n" + | ||
| "Check the [workflow run](" + context.serverUrl + "/" + context.repo.owner + "/" + context.repo.repo + "/actions/runs/" + context.runId + ") for details."; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: ${{ needs.trigger.outputs.pr_number }}, | ||
| body: body | ||
| }); | ||
|
|
||
| - name: Post cancellation comment | ||
| if: needs.build.result == 'cancelled' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const body = "⚠️ Preview build was cancelled\n\n" + | ||
| "This may have been caused by a newer build being triggered for the same PR."; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: ${{ needs.trigger.outputs.pr_number }}, | ||
| body: body | ||
| }); | ||
| const body = [ | ||
| marker, | ||
| '## Preview Builds', | ||
| '', | ||
| '| Commit | Release | Date |', | ||
| '|--------|---------|------|', | ||
| newEntry + previousRows | ||
| ].join('\n'); | ||
|
Comment on lines
+114
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Table row extraction relies on specific markdown format. The filter This is acceptable for now but worth documenting or making more robust if the format evolves. 🤖 Prompt for AI Agents |
||
|
|
||
| if (existing) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: existing.id, | ||
| body: body | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| body: body | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,12 +27,7 @@ if [ -n "$ENABLE_SANITIZERS" ]; then | |
| export ENABLE_ASSERTS="ON"; | ||
| fi | ||
|
|
||
| export DEFAULT_MALLOC_HEAP_BREAKDOWN=${DEFAULT_MALLOC_HEAP_BREAKDOWN:-"OFF"} | ||
| if [ "$CMAKE_BUILD_TYPE" == "Debug" ]; then | ||
| export DEFAULT_MALLOC_HEAP_BREAKDOWN="ON" | ||
| fi | ||
|
|
||
| ENABLE_MALLOC_HEAP_BREAKDOWN=${ENABLE_MALLOC_HEAP_BREAKDOWN:-$DEFAULT_MALLOC_HEAP_BREAKDOWN} | ||
| ENABLE_MALLOC_HEAP_BREAKDOWN=${ENABLE_MALLOC_HEAP_BREAKDOWN:-"OFF"} | ||
|
|
||
| echo "Building for mac: [ $ENABLE_MALLOC_HEAP_BREAKDOWN ] [ $ENABLE_SANITIZERS ]" | ||
|
|
||
|
|
@@ -54,6 +49,7 @@ cmake \ | |
| -DENABLE_MALLOC_HEAP_BREAKDOWN=$ENABLE_MALLOC_HEAP_BREAKDOWN \ | ||
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -DUSE_BUN_JSC_ADDITIONS=ON \ | ||
| -DUSE_MIMALLOC=ON \ | ||
|
Comment on lines
50
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Minor: Duplicate CMake flag.
The Suggested cleanup -DENABLE_MALLOC_HEAP_BREAKDOWN=$ENABLE_MALLOC_HEAP_BREAKDOWN \
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DUSE_BUN_JSC_ADDITIONS=ON \
-DUSE_MIMALLOC=ON \🤖 Prompt for AI Agents |
||
| -DENABLE_ASSERTS="$ENABLE_ASSERTS" \ | ||
| -DUSE_BUN_EVENT_LOOP=ON \ | ||
| -DCMAKE_AR="$AR" \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Pagination may miss marker comment in highly active PRs.
With
per_page: 100, the marker comment won't be found if there are more than 100 comments on the PR. This is an edge case but could result in duplicate preview build comments.Consider paginating or using a higher limit if PRs with many comments are expected:
♻️ Optional: Add pagination or increase limit
🤖 Prompt for AI Agents