Skip to content

Commit 46731cd

Browse files
working on Dockerfile for fibers
1 parent 7714135 commit 46731cd

File tree

3 files changed

+141
-22
lines changed

3 files changed

+141
-22
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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+
10+
jobs:
11+
build-fibers:
12+
strategy:
13+
matrix:
14+
include:
15+
- platform: linux
16+
arch: x64
17+
runs_on: ubuntu-22.04
18+
- platform: linux
19+
arch: arm64
20+
runs_on: ubuntu-22.04-arm
21+
runs-on: ${{ matrix.runs_on }}
22+
23+
env:
24+
NODE_VERSION: v20.18.3
25+
26+
steps:
27+
- name: Debug Matrix Values
28+
run: |
29+
echo "Matrix platform: ${{ matrix.platform }}"
30+
echo "Matrix arch: ${{ matrix.arch }}"
31+
32+
- name: Download Node archive
33+
run: |
34+
gh release download node-${{ env.NODE_VERSION }}-release \
35+
--repo asana/node \
36+
--pattern "node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz"
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract Node archive
41+
run: |
42+
mkdir -p node-install
43+
tar -C node-install -xJf node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz
44+
echo "$GITHUB_WORKSPACE/node-install/usr/local/bin" >> $GITHUB_PATH
45+
46+
- name: Verify Node Binary Architecture
47+
run: |
48+
echo "Node File:"
49+
file $GITHUB_WORKSPACE/node-install/usr/local/bin/node
50+
echo "Runner architecture:"
51+
uname -m
52+
53+
- name: Checkout node-fibers fork
54+
uses: actions/checkout@v3
55+
with:
56+
repository: asana/node-fibers
57+
ref: jackstrohm_node20_fibers
58+
path: node-fibers
59+
60+
#- name: Build node-fibers
61+
#working-directory: node-fibers
62+
#run: |
63+
#which node
64+
#node -v
65+
#node -p "process.arch"
66+
#npm install --nodedir="$GITHUB_WORKSPACE/node-install/usr/local"
67+
#npm test || true
68+
#rm bin/repl
69+
#find .
70+
71+
- name: Execute the Dockerfile
72+
working-directory: node-fibers
73+
run: |
74+
docker build -t node20_fibers_build -f ./Dockerfile.Fibers .
75+
76+
- name: Extract resources
77+
working-directory: node-fibers
78+
run: |
79+
docker create --name temp_node_fibers_extract node20_fibers_build
80+
docker cp temp_node_fibers_extract:/usr/src/node/node-fibers $GITHUB_WORKSPACE/node-fibers
81+
docker rm temp_node_fibers_extract
82+
83+
- name: Find and archive fibers.node
84+
run: |
85+
# Find the directory under bin/ that contains fibers.node
86+
FIBERS_PATH=$(find ./node-fibers/bin -type f -name fibers.node | head -n1)
87+
FIBERS_DIR=$(dirname "$FIBERS_PATH")
88+
ARCHIVE_NAME=$(basename "$FIBERS_DIR").tar.gz
89+
echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> $GITHUB_ENV
90+
tar -czf "$ARCHIVE_NAME" -C "$(dirname "$FIBERS_DIR")" "$(basename "$FIBERS_DIR")"
91+
92+
- name: Upload archive to release
93+
uses: softprops/action-gh-release@v1
94+
with:
95+
name: node-${{ env.NODE_VERSION }}-LATEST
96+
tag_name: node-${{ env.NODE_VERSION }}-release
97+
files: ${{ env.ARCHIVE_NAME }}
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-tarball.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,24 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
env:
31-
PYTHON_VERSION: '3.12'
31+
PYTHON_VERSION: '3.11'
3232
FLAKY_TESTS: keep_retrying
33-
CC: sccache clang
34-
CXX: sccache clang++
35-
SCCACHE_GHA_ENABLED: 'true'
3633

3734
permissions:
3835
contents: read
3936

4037
jobs:
4138
build-tarball:
4239
if: github.event.pull_request.draft == false
43-
runs-on: ubuntu-24.04
40+
runs-on: ubuntu-latest
4441
steps:
45-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4643
with:
4744
persist-credentials: false
4845
- name: Set up Python ${{ env.PYTHON_VERSION }}
49-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
46+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
5047
with:
5148
python-version: ${{ env.PYTHON_VERSION }}
52-
- name: Set up sccache
53-
uses: mozilla-actions/sccache-action@9e326ebed976843c9932b3aa0e021c6f50310eb4 # v0.0.6
54-
with:
55-
version: v0.8.1
5649
- name: Environment Information
5750
run: npx envinfo
5851
- name: Make tarball
@@ -64,29 +57,25 @@ jobs:
6457
mkdir tarballs
6558
mv *.tar.gz tarballs
6659
- name: Upload tarball artifact
67-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
60+
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
6861
with:
6962
name: tarballs
7063
path: tarballs
7164
test-tarball-linux:
7265
needs: build-tarball
73-
runs-on: ubuntu-24.04
66+
runs-on: ubuntu-latest
7467
steps:
75-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
7669
with:
7770
persist-credentials: false
7871
- name: Set up Python ${{ env.PYTHON_VERSION }}
79-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
72+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
8073
with:
8174
python-version: ${{ env.PYTHON_VERSION }}
82-
- name: Set up sccache
83-
uses: mozilla-actions/sccache-action@9e326ebed976843c9932b3aa0e021c6f50310eb4 # v0.0.6
84-
with:
85-
version: v0.8.1
8675
- name: Environment Information
8776
run: npx envinfo
8877
- name: Download tarball
89-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
78+
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
9079
with:
9180
name: tarballs
9281
path: tarballs
@@ -101,8 +90,8 @@ jobs:
10190
- name: Build
10291
run: |
10392
cd $TAR_DIR
104-
make build-ci -j4 V=1
93+
make build-ci -j2 V=1
10594
- name: Test
10695
run: |
10796
cd $TAR_DIR
108-
make run-ci -j4 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=spec' --measure-flakiness 9"
97+
make run-ci -j2 V=1 TEST_CI_ARGS="-p dots --node-args='--test-reporter=spec' --measure-flakiness 9"

Dockerfile.Fibers

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Stage 1
2+
FROM ubuntu:20.04 AS base
3+
4+
# Set non-interactive mode to avoid prompts during installation
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
# Install necessary dependencies
8+
RUN apt-get update
9+
RUN apt-get install -y software-properties-common
10+
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
11+
RUN apt-get update && apt-get install -y build-essential python3 python3-distutils g++-10 make curl git pkg-config libssl-dev libffi-dev libgmp-dev libtool autoconf automake cmake wget xz-utils unzip vim
12+
RUN rm -rf /var/lib/apt/lists/*
13+
14+
# Set g++ 10 as the default
15+
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
16+
17+
# Copy local Node.js source into the image
18+
WORKDIR /usr/src/node
19+
COPY . .
20+
21+
RUN which node
22+
RUN node -v
23+
RUN node -p "process.arch"
24+
RUN npm install --nodedir="$GITHUB_WORKSPACE/node-install/usr/local"
25+
RUN npm test || true
26+
RUN rm bin/repl
27+
RUN find .
28+
29+
30+
CMD ["bash"]
31+

0 commit comments

Comments
 (0)