Skip to content

Commit 304ff1d

Browse files
testing workflows
1 parent e7509cc commit 304ff1d

10 files changed

Lines changed: 719 additions & 0 deletions
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build node-fibers with prebuilt Node
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_run:
6+
workflows: [Build Node]
7+
types:
8+
- completed
9+
pull_request:
10+
paths: .github/workflows/build-node-fibers.yml
11+
push:
12+
branches:
13+
- v20.18.3
14+
- workflows-for-v20.18.3
15+
16+
jobs:
17+
build-fibers:
18+
strategy:
19+
matrix:
20+
include:
21+
- platform: linux
22+
arch: x64
23+
runs_on: ubuntu-latest
24+
- platform: linux
25+
arch: arm64
26+
runs_on: ubuntu-24.04-arm
27+
runs-on: ${{ matrix.runs_on }}
28+
29+
env:
30+
NODE_VERSION: v20.18.3
31+
32+
steps:
33+
- name: Debug Matrix Values
34+
run: |
35+
echo "Matrix platform: ${{ matrix.platform }}"
36+
echo "Matrix arch: ${{ matrix.arch }}"
37+
38+
- name: Download Node archive
39+
run: |
40+
gh release download node-${{ env.NODE_VERSION }}-release \
41+
--repo asana/node \
42+
--pattern "node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz"
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Extract Node archive
47+
run: |
48+
mkdir -p node-install
49+
tar -C node-install -xJf node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz
50+
echo "$GITHUB_WORKSPACE/node-install/usr/local/bin" >> $GITHUB_PATH
51+
52+
- name: Verify Node Binary Architecture
53+
run: |
54+
echo "Node File:"
55+
file $GITHUB_WORKSPACE/node-install/usr/local/bin/node
56+
echo "Runner architecture:"
57+
uname -m
58+
59+
- name: Checkout node-fibers fork
60+
uses: actions/checkout@v3
61+
with:
62+
repository: asana/node-fibers
63+
ref: jackstrohm_node20_fibers
64+
path: node-fibers
65+
66+
- name: Build node-fibers
67+
working-directory: node-fibers
68+
run: |
69+
which node
70+
node -v
71+
node -p "process.arch"
72+
npm install --nodedir="$GITHUB_WORKSPACE/node-install/usr/local"
73+
npm test || true
74+
rm bin/repl
75+
find .
76+
77+
78+
- name: Upload fibers.node archive latest
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: node-fibers-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST
82+
path: node-fibers/bin/*
83+
84+
- name: Upload fibers.node archive to release
85+
uses: softprops/action-gh-release@v1
86+
with:
87+
name: node-fibers-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST
88+
tag_name: node-fibers-${{ env.NODE_VERSION }}-release
89+
files: node-fibers/bin/*
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+

.github/workflows/build-node.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build Node
2+
3+
on:
4+
push:
5+
branches:
6+
- v20.18.3
7+
- workflows-for-v20.18.3
8+
pull_request:
9+
paths: .github/workflows/build-node.yml
10+
11+
jobs:
12+
build-node:
13+
name: Build ${{ matrix.platform }}-${{ matrix.arch }}
14+
strategy:
15+
matrix:
16+
include:
17+
- platform: linux
18+
arch: x64
19+
runs_on: ubuntu-latest
20+
- platform: linux
21+
arch: arm64
22+
runs_on: ubuntu-24.04-arm
23+
runs-on: ${{ matrix.runs_on }}
24+
25+
env:
26+
S3_BUCKET: your-bucket-name
27+
AWS_REGION: us-east-1
28+
29+
steps:
30+
- name: Checkout Node fork
31+
uses: actions/checkout@v3
32+
with:
33+
repository: Asana/node
34+
path: node
35+
ref: ${{ github.event_name == 'pull_request' && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.ref_name }}
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract Node Version
39+
id: extract-node-version
40+
run: |
41+
NODE_MAJOR_VERSION=$(grep '#define NODE_MAJOR_VERSION' node/src/node_version.h | awk '{print $3}')
42+
NODE_MINOR_VERSION=$(grep '#define NODE_MINOR_VERSION' node/src/node_version.h | awk '{print $3}')
43+
NODE_PATCH_VERSION=$(grep '#define NODE_PATCH_VERSION' node/src/node_version.h | awk '{print $3}')
44+
NODE_VERSION="v${NODE_MAJOR_VERSION}.${NODE_MINOR_VERSION}.${NODE_PATCH_VERSION}"
45+
echo "NODE_VERSION=${NODE_VERSION}" >> $GITHUB_ENV
46+
47+
- name: Set build metadata
48+
id: meta
49+
working-directory: node
50+
run: |
51+
TIMESTAMP=$(date -u +%Y-%m-%dT%H-%M)
52+
SHORT_SHA=$(git rev-parse --short HEAD)
53+
echo "BUILD_ID=${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_ENV
54+
echo "build_id=${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_OUTPUT
55+
56+
- name: Install dependencies (Linux)
57+
if: matrix.platform == 'linux'
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y python3 g++ make curl tar xz-utils
61+
62+
- name: Build Node
63+
working-directory: node
64+
run: |
65+
./configure --experimental-enable-pointer-compression
66+
make -j4 install DESTDIR=$GITHUB_WORKSPACE/node-install
67+
68+
- name: Archive Node
69+
run: |
70+
mkdir -p artifacts
71+
FILENAME=node-${NODE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}-${{ steps.meta.outputs.build_id }}.tar.xz
72+
FILENAME_LATEST=node-${NODE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz
73+
tar -C node-install -cJf artifacts/$FILENAME .
74+
cp artifacts/$FILENAME artifacts/$FILENAME_LATEST
75+
echo "NODE_ARCHIVE=$FILENAME" >> $GITHUB_ENV
76+
echo "NODE_ARCHIVE_LATEST=$FILENAME_LATEST" >> $GITHUB_ENV
77+
78+
- name: Upload Node archive
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ steps.meta.outputs.build_id }}
82+
path: artifacts/${{ env.NODE_ARCHIVE }}
83+
84+
- name: Upload Node archive latest
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST
88+
path: artifacts/${{ env.NODE_ARCHIVE_LATEST }}
89+
90+
- name: Upload Node archive to release
91+
uses: softprops/action-gh-release@v1
92+
with:
93+
name: node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST
94+
tag_name: node-${{ env.NODE_VERSION }}-release
95+
files: ./artifacts/${{ env.NODE_ARCHIVE_LATEST }}
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From 787f44c3e4cb934bab327ba03e3cb6f2b5896b15 Mon Sep 17 00:00:00 2001
2+
From: Sean Wentzel <sean@asana.com>
3+
Date: Fri, 5 Jan 2024 11:53:12 -0800
4+
Subject: [PATCH 1/6] revert
5+
https://github.com/v8/v8/commit/dacc2fee0f815823782a7e432c79c2a7767a4765
6+
7+
---
8+
deps/v8/src/base/platform/platform.h | 6 ++++++
9+
deps/v8/src/execution/thread-id.cc | 7 ++++++-
10+
2 files changed, 12 insertions(+), 1 deletion(-)
11+
12+
diff --git a/deps/v8/src/base/platform/platform.h b/deps/v8/src/base/platform/platform.h
13+
index e801ec78c2..b3d2aedf9c 100644
14+
--- a/deps/v8/src/base/platform/platform.h
15+
+++ b/deps/v8/src/base/platform/platform.h
16+
@@ -554,7 +554,13 @@ class V8_BASE_EXPORT Thread {
17+
static LocalStorageKey CreateThreadLocalKey();
18+
static void DeleteThreadLocalKey(LocalStorageKey key);
19+
static void* GetThreadLocal(LocalStorageKey key);
20+
+ static int GetThreadLocalInt(LocalStorageKey key) {
21+
+ return static_cast<int>(reinterpret_cast<intptr_t>(GetThreadLocal(key)));
22+
+ }
23+
static void SetThreadLocal(LocalStorageKey key, void* value);
24+
+ static void SetThreadLocalInt(LocalStorageKey key, int value) {
25+
+ SetThreadLocal(key, reinterpret_cast<void*>(static_cast<intptr_t>(value)));
26+
+ }
27+
static bool HasThreadLocal(LocalStorageKey key) {
28+
return GetThreadLocal(key) != nullptr;
29+
}
30+
diff --git a/deps/v8/src/execution/thread-id.cc b/deps/v8/src/execution/thread-id.cc
31+
index ec4e95ad5d..a32d15e22f 100644
32+
--- a/deps/v8/src/execution/thread-id.cc
33+
+++ b/deps/v8/src/execution/thread-id.cc
34+
@@ -11,7 +11,8 @@ namespace internal {
35+
36+
namespace {
37+
38+
-thread_local int thread_id = 0;
39+
+DEFINE_LAZY_LEAKY_OBJECT_GETTER(base::Thread::LocalStorageKey, GetThreadIdKey,
40+
+ base::Thread::CreateThreadLocalKey())
41+
42+
std::atomic<int> next_thread_id{1};
43+
44+
@@ -19,14 +20,18 @@ std::atomic<int> next_thread_id{1};
45+
46+
// static
47+
ThreadId ThreadId::TryGetCurrent() {
48+
+ int thread_id = base::Thread::GetThreadLocalInt(*GetThreadIdKey());
49+
return thread_id == 0 ? Invalid() : ThreadId(thread_id);
50+
}
51+
52+
// static
53+
int ThreadId::GetCurrentThreadId() {
54+
+ auto key = *GetThreadIdKey();
55+
+ int thread_id = base::Thread::GetThreadLocalInt(key);
56+
if (thread_id == 0) {
57+
thread_id = next_thread_id.fetch_add(1);
58+
CHECK_LE(1, thread_id);
59+
+ base::Thread::SetThreadLocalInt(key, thread_id);
60+
}
61+
return thread_id;
62+
}
63+
--
64+
2.48.0
65+

0 commit comments

Comments
 (0)