Skip to content

Commit e6df89d

Browse files
authored
fix(core): build native libs against glibc 2.24 (#1428)
1 parent 9f3ab71 commit e6df89d

File tree

2 files changed

+47
-21
lines changed

2 files changed

+47
-21
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,50 @@ jobs:
3131
include:
3232
# For Linux targets, use Buildjet's builders to get the oldest supported glibc version
3333
- platform: linux-x64
34-
runner: buildjet-4vcpu-ubuntu-2004
34+
runner: buildjet-4vcpu-ubuntu-2204
3535
target: x86_64-unknown-linux-gnu
36+
container: quay.io/pypa/manylinux_2_24_x86_64
37+
out-file: libtemporal_sdk_typescript_bridge.so
3638
- platform: linux-arm
3739
runner: buildjet-4vcpu-ubuntu-2204-arm
3840
target: aarch64-unknown-linux-gnu
41+
container: quay.io/pypa/manylinux_2_24_aarch64
42+
out-file: libtemporal_sdk_typescript_bridge.so
3943
- platform: macos-x64
4044
runner: macos-12
4145
target: x86_64-apple-darwin
46+
out-file: libtemporal_sdk_typescript_bridge.dylib
4247
- platform: macos-arm
4348
runner: macos-14
4449
target: aarch64-apple-darwin
50+
out-file: libtemporal_sdk_typescript_bridge.dylib
4551
- platform: windows-x64
4652
runner: windows-latest
4753
target: x86_64-pc-windows-msvc
54+
out-file: temporal_sdk_typescript_bridge.dll
4855
name: Compile Native Binaries (${{ matrix.platform }})
4956
runs-on: ${{ matrix.runner }}
57+
container: ${{ matrix.container }}
58+
env:
59+
# This is required to allow continuing usage of Node 16 for actions,
60+
# as Node 20 won't run on the docker image we use for linux builds
61+
# (Node 20 require glibc 2.28+, but container image has glibc 2.24).
62+
# https://github.blog/changelog/2024-05-17-updated-dates-for-actions-runner-using-node20-instead-of-node16-by-default/
63+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
5064
defaults:
5165
run:
5266
shell: bash
5367
steps:
5468
- name: 'Checkout code'
55-
uses: actions/checkout@v4
69+
# FIXME: v4+ requires Node 20
70+
uses: actions/checkout@v3
5671
with:
5772
submodules: recursive
5873

5974
- name: 'Cache index.node'
6075
id: cached-artifact
61-
uses: actions/cache@v4
76+
# FIXME: v4+ requires Node 20
77+
uses: actions/cache@v3
6278
with:
6379
path: ./packages/core-bridge/releases
6480
key: corebridge-artifactcache-${{ matrix.platform }}-${{ hashFiles('./packages/core-bridge/**/Cargo.lock', './packages/core-bridge/**/*.rs') }}
@@ -71,19 +87,17 @@ jobs:
7187

7288
- name: Install protoc
7389
if: steps.cached-artifact.outputs.cache-hit != 'true'
74-
uses: arduino/setup-protoc@v3
90+
# FIXME: v3+ requires Node 20
91+
uses: arduino/setup-protoc@v2
7592
with:
7693
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
7794
version: '23.x'
7895
repo-token: ${{ secrets.GITHUB_TOKEN }}
7996

80-
- name: Print libc version
81-
if: (steps.cached-artifact.outputs.cache-hit != 'true') && startsWith(matrix.platform, 'linux')
82-
run: ldd --version
83-
8497
- name: Rust Cargo and Build cache
8598
if: steps.cached-artifact.outputs.cache-hit != 'true'
86-
uses: Swatinem/rust-cache@v2
99+
# FIXME: v2.7.2+ requires Node 20
100+
uses: Swatinem/rust-cache@v2.7.1
87101
with:
88102
workspaces: packages/core-bridge -> target
89103
prefix-key: corebridge-buildcache
@@ -98,13 +112,17 @@ jobs:
98112
set -x
99113
cargo build --release --target ${{ matrix.target }}
100114
mkdir -p ./releases/${{ matrix.target }}
101-
# FIXME: This is aweful. Surely there's a better way, but I'm out of ideas.
102-
native_lib_file=$(
103-
ls target/${{ matrix.target }}/release/{lib,}temporal_sdk_typescript_bridge.{dylib,so,dll} 2>/dev/null || true
104-
)
105-
cp $native_lib_file ./releases/${{ matrix.target }}/index.node
115+
cp target/${{ matrix.target }}/release/${{ matrix.out-file }} ./releases/${{ matrix.target }}/index.node
106116
107-
- uses: actions/upload-artifact@v4
117+
- name: Print required GLIBC version
118+
if: startsWith(matrix.platform, 'linux')
119+
working-directory: ./packages/core-bridge
120+
run: |
121+
objdump -T ./releases/${{ matrix.target }}/index.node |
122+
grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -V | tail -1
123+
124+
# FIXME: v4+ requires Node 20
125+
- uses: actions/upload-artifact@v3
108126
with:
109127
name: corebridge-native-${{ matrix.platform }}
110128
# Actual file will be named ${{ matrix.target }}/index.node
@@ -135,7 +153,8 @@ jobs:
135153
submodules: recursive
136154

137155
- name: Download core-bridge native libraries
138-
uses: actions/download-artifact@v4
156+
# Need v3 here to stay compatible with the compile-native-binaries job.
157+
uses: actions/download-artifact@v3-node20
139158
with:
140159
path: ./packages/core-bridge/releases/tmp
141160

@@ -222,7 +241,8 @@ jobs:
222241
submodules: recursive
223242

224243
- name: Download core-bridge native libraries
225-
uses: actions/download-artifact@v4
244+
# Need v3 here to stay compatible with the compile-native-binaries job.
245+
uses: actions/download-artifact@v3-node20
226246
with:
227247
name: corebridge-native-${{ matrix.platform }}
228248
path: ./packages/core-bridge/releases
@@ -544,7 +564,9 @@ jobs:
544564
if: env.IS_MAIN_OR_RELEASE == 'true'
545565
run: npx vercel deploy packages/docs/build -t ${{ secrets.VERCEL_TOKEN }} --name typescript --scope temporal --prod --yes
546566

547-
- name: Deploy draft docs
548-
# Don't run on forks, since secrets won't be available, and command will fail
549-
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.ref != 'refs/heads/main'
550-
run: npx vercel deploy packages/docs/build -t ${{ secrets.VERCEL_TOKEN }} --name typescript --scope temporal --yes
567+
# FIXME: This is not working properly, and should probably be done only from the main branch anyway
568+
# (and "Deploy prod docs" should only be done when we publish a new release)
569+
# - name: Deploy draft docs
570+
# # Don't run on forks, since secrets won't be available, and command will fail
571+
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.ref != 'refs/heads/main'
572+
# run: npx vercel deploy packages/docs/build -t ${{ secrets.VERCEL_TOKEN }} --name typescript --scope temporal --yes

packages/core-bridge/scripts/build.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ const forceBuild = args['--force'];
5555
const buildRelease = args['--release'] || process.env.BUILD_CORE_RELEASE !== undefined;
5656

5757
function compile(requestedTarget) {
58+
if (!fs.existsSync('sdk-core/Cargo.toml')) {
59+
throw new Error('Missing sdk-core/Cargo.toml. Did you forget to run `git submodule update --init --recursive`?');
60+
}
61+
5862
const target = requestedTarget ?? getPrebuiltTargetName();
5963
console.log('Compiling bridge', { target, buildRelease });
6064

0 commit comments

Comments
 (0)