Skip to content

Commit 631217f

Browse files
committed
fix build and auto build preview
1 parent 2da75ad commit 631217f

File tree

3 files changed

+36
-86
lines changed

3 files changed

+36
-86
lines changed

.github/workflows/build-preview.yml

Lines changed: 31 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Preview Build
22

33
on:
4-
issue_comment:
5-
types: [created]
4+
pull_request:
5+
types: [opened, synchronize, reopened]
66
workflow_dispatch:
77
inputs:
88
pr_number:
@@ -16,98 +16,61 @@ permissions:
1616
issues: write
1717

1818
concurrency:
19-
group: preview-build-pr-${{ github.event.issue.number || inputs.pr_number }}
19+
group: preview-build-pr-${{ github.event.pull_request.number || inputs.pr_number }}
2020
cancel-in-progress: true
2121

2222
jobs:
2323
trigger:
2424
name: Trigger Preview Build
2525
runs-on: ubuntu-latest
26-
if: |
27-
github.event_name == 'workflow_dispatch' ||
28-
(github.event.issue.pull_request && contains(github.event.comment.body, '/build-preview'))
2926
outputs:
3027
sha: ${{ steps.pr.outputs.sha }}
3128
short_sha: ${{ steps.pr.outputs.short_sha }}
3229
release_tag: ${{ steps.pr.outputs.release_tag }}
33-
pr_number: ${{ steps.pr_number.outputs.number }}
30+
pr_number: ${{ steps.pr.outputs.pr_number }}
3431

3532
steps:
36-
- name: Set PR number
37-
id: pr_number
38-
run: |
39-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
40-
echo "number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT
41-
else
42-
echo "number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT
43-
fi
44-
45-
- name: Check permissions
46-
if: github.event_name == 'issue_comment'
33+
- name: Check org membership
34+
if: github.event_name == 'pull_request'
4735
uses: actions/github-script@v7
4836
with:
4937
script: |
50-
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
51-
owner: context.repo.owner,
52-
repo: context.repo.repo,
53-
username: context.payload.comment.user.login
54-
});
55-
56-
if (!['admin', 'write'].includes(permission.permission)) {
57-
await github.rest.reactions.createForIssueComment({
58-
owner: context.repo.owner,
59-
repo: context.repo.repo,
60-
comment_id: context.payload.comment.id,
61-
content: '-1'
38+
try {
39+
await github.rest.orgs.checkMembershipForUser({
40+
org: 'oven-sh',
41+
username: context.actor
6242
});
63-
core.setFailed('❌ Only collaborators with write access can trigger preview builds');
43+
} catch (e) {
44+
core.setFailed(`${context.actor} is not a member of oven-sh. Preview builds must be triggered manually via workflow_dispatch.`);
6445
}
6546
6647
- name: Get PR information
6748
id: pr
6849
uses: actions/github-script@v7
6950
with:
7051
script: |
71-
const { data: pr } = await github.rest.pulls.get({
72-
owner: context.repo.owner,
73-
repo: context.repo.repo,
74-
pull_number: ${{ steps.pr_number.outputs.number }}
75-
});
52+
let sha, prNumber;
7653
77-
const shortSha = pr.head.sha.substring(0, 8);
78-
const releaseTag = `autobuild-preview-pr-${{ steps.pr_number.outputs.number }}-${shortSha}`;
54+
if (context.eventName === 'pull_request') {
55+
sha = context.payload.pull_request.head.sha;
56+
prNumber = context.payload.pull_request.number;
57+
} else {
58+
const { data: pr } = await github.rest.pulls.get({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
pull_number: ${{ inputs.pr_number || 0 }}
62+
});
63+
sha = pr.head.sha;
64+
prNumber = ${{ inputs.pr_number || 0 }};
65+
}
7966
80-
core.setOutput('sha', pr.head.sha);
67+
const shortSha = sha.substring(0, 8);
68+
const releaseTag = `autobuild-preview-pr-${prNumber}-${shortSha}`;
69+
70+
core.setOutput('sha', sha);
8171
core.setOutput('short_sha', shortSha);
8272
core.setOutput('release_tag', releaseTag);
83-
84-
- name: React to comment
85-
if: github.event_name == 'issue_comment'
86-
uses: actions/github-script@v7
87-
with:
88-
script: |
89-
await github.rest.reactions.createForIssueComment({
90-
owner: context.repo.owner,
91-
repo: context.repo.repo,
92-
comment_id: context.payload.comment.id,
93-
content: 'eyes'
94-
});
95-
96-
- name: Post starting message
97-
if: github.event_name == 'issue_comment'
98-
uses: actions/github-script@v7
99-
with:
100-
script: |
101-
const body = "🔄 Preview build started\n\n" +
102-
"**Release tag**: `${{ steps.pr.outputs.release_tag }}`\n" +
103-
"**Workflow**: [View progress](" + context.serverUrl + "/" + context.repo.owner + "/" + context.repo.repo + "/actions/runs/" + context.runId + ")";
104-
105-
await github.rest.issues.createComment({
106-
owner: context.repo.owner,
107-
repo: context.repo.repo,
108-
issue_number: ${{ steps.pr_number.outputs.number }},
109-
body: body
110-
});
73+
core.setOutput('pr_number', prNumber);
11174
11275
build:
11376
name: Build
@@ -146,18 +109,6 @@ jobs:
146109
body: body
147110
});
148111
149-
- name: React to failure
150-
if: needs.build.result == 'failure' && github.event_name == 'issue_comment'
151-
uses: actions/github-script@v7
152-
with:
153-
script: |
154-
await github.rest.reactions.createForIssueComment({
155-
owner: context.repo.owner,
156-
repo: context.repo.repo,
157-
comment_id: context.payload.comment.id,
158-
content: '-1'
159-
});
160-
161112
- name: Post failure comment
162113
if: needs.build.result == 'failure'
163114
uses: actions/github-script@v7
@@ -179,7 +130,7 @@ jobs:
179130
with:
180131
script: |
181132
const body = "⚠️ Preview build was cancelled\n\n" +
182-
"This may have been caused by a newer build being triggered for the same PR.";
133+
"This may have been caused by a newer commit being pushed to the same PR.";
183134
184135
await github.rest.issues.createComment({
185136
owner: context.repo.owner,

Source/bmalloc/mimalloc/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ set(MI_BUILD_STATIC OFF CACHE BOOL "Build mimalloc static library" FORCE)
66
set(MI_BUILD_OBJECT ON CACHE BOOL "Build mimalloc object library" FORCE)
77
set(MI_BUILD_TESTS OFF CACHE BOOL "Build mimalloc tests" FORCE)
88

9+
if (USE_BUN_JSC_ADDITIONS)
10+
set(MI_USE_CXX ON CACHE BOOL "Use C++ compiler for mimalloc (avoids GCC stdatomic.h incompatibility with clang)" FORCE)
11+
endif ()
12+
913
WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
1014

1115
add_subdirectory(mimalloc)

mac-release.bash

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ if [ -n "$ENABLE_SANITIZERS" ]; then
2727
export ENABLE_ASSERTS="ON";
2828
fi
2929

30-
export DEFAULT_MALLOC_HEAP_BREAKDOWN=${DEFAULT_MALLOC_HEAP_BREAKDOWN:-"OFF"}
31-
if [ "$CMAKE_BUILD_TYPE" == "Debug" ]; then
32-
export DEFAULT_MALLOC_HEAP_BREAKDOWN="ON"
33-
fi
34-
35-
ENABLE_MALLOC_HEAP_BREAKDOWN=${ENABLE_MALLOC_HEAP_BREAKDOWN:-$DEFAULT_MALLOC_HEAP_BREAKDOWN}
30+
ENABLE_MALLOC_HEAP_BREAKDOWN=${ENABLE_MALLOC_HEAP_BREAKDOWN:-"OFF"}
3631

3732
echo "Building for mac: [ $ENABLE_MALLOC_HEAP_BREAKDOWN ] [ $ENABLE_SANITIZERS ]"
3833

0 commit comments

Comments
 (0)