diff --git a/.github/workflows/build-node-fibers.yml b/.github/workflows/build-node-fibers.yml new file mode 100644 index 00000000000000..697163b712a288 --- /dev/null +++ b/.github/workflows/build-node-fibers.yml @@ -0,0 +1,87 @@ +name: Build node-fibers with prebuilt Node + +on: + workflow_dispatch: + workflow_run: + workflows: [Build Node] + types: + - completed + +jobs: + build-fibers: + strategy: + matrix: + include: + - platform: linux + arch: x64 + runs_on: ubuntu-22.04 + - platform: linux + arch: arm64 + runs_on: ubuntu-22.04-arm + runs-on: ${{ matrix.runs_on }} + + env: + NODE_VERSION: v20.18.3 + + steps: + - name: Debug Matrix Values + run: | + echo "Matrix platform: ${{ matrix.platform }}" + echo "Matrix arch: ${{ matrix.arch }}" + + - name: Download Node archive + run: | + gh release download node-${{ env.NODE_VERSION }}-release \ + --repo asana/node \ + --pattern "node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Node archive + run: | + mkdir -p node-install + tar -C node-install -xJf node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz + echo "$GITHUB_WORKSPACE/node-install/usr/local/bin" >> $GITHUB_PATH + + - name: Verify Node Binary Architecture + run: | + echo "Node File:" + file $GITHUB_WORKSPACE/node-install/usr/local/bin/node + echo "Runner architecture:" + uname -m + + - name: Checkout node-fibers fork + uses: actions/checkout@v3 + with: + repository: asana/node-fibers + ref: jackstrohm_node20_fibers + path: node-fibers + + - name: Build node-fibers + working-directory: node-fibers + run: | + which node + node -v + node -p "process.arch" + npm install --nodedir="$GITHUB_WORKSPACE/node-install/usr/local" + npm test || true + rm bin/repl + find . + + - name: Find and archive fibers.node + run: | + # Find the directory under bin/ that contains fibers.node + FIBERS_PATH=$(find ./node-fibers/bin -type f -name fibers.node | head -n1) + FIBERS_DIR=$(dirname "$FIBERS_PATH") + ARCHIVE_NAME=$(basename "$FIBERS_DIR").tar.gz + echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> $GITHUB_ENV + tar -czf "$ARCHIVE_NAME" -C "$(dirname "$FIBERS_DIR")" "$(basename "$FIBERS_DIR")" + + - name: Upload archive to release + uses: softprops/action-gh-release@v1 + with: + name: node-${{ env.NODE_VERSION }}-LATEST + tag_name: node-${{ env.NODE_VERSION }}-release + files: ${{ env.ARCHIVE_NAME }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-node.yml b/.github/workflows/build-node.yml new file mode 100644 index 00000000000000..e97959697d3edb --- /dev/null +++ b/.github/workflows/build-node.yml @@ -0,0 +1,105 @@ +name: Build Node + +on: + push: + branches: + - v20.18.3 + - workflows-for-v20.18.3 + pull_request: + paths: .github/workflows/build-node.yml + +jobs: + build-node: + name: Build ${{ matrix.platform }}-${{ matrix.arch }} + strategy: + matrix: + include: + - platform: linux + arch: x64 + runs_on: ubuntu-22.04 + - platform: linux + arch: arm64 + runs_on: ubuntu-22.04-arm + runs-on: ${{ matrix.runs_on }} + + env: + S3_BUCKET: your-bucket-name + AWS_REGION: us-east-1 + + steps: + - name: Checkout Node fork + uses: actions/checkout@v3 + with: + repository: Asana/node + path: node + ref: ${{ github.event_name == 'pull_request' && format('refs/pull/{0}/merge', github.event.pull_request.number) || github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Node Version + id: extract-node-version + run: | + NODE_MAJOR_VERSION=$(grep '#define NODE_MAJOR_VERSION' node/src/node_version.h | awk '{print $3}') + NODE_MINOR_VERSION=$(grep '#define NODE_MINOR_VERSION' node/src/node_version.h | awk '{print $3}') + NODE_PATCH_VERSION=$(grep '#define NODE_PATCH_VERSION' node/src/node_version.h | awk '{print $3}') + NODE_VERSION="v${NODE_MAJOR_VERSION}.${NODE_MINOR_VERSION}.${NODE_PATCH_VERSION}" + echo "NODE_VERSION=${NODE_VERSION}" >> $GITHUB_ENV + + - name: Set build metadata + id: meta + working-directory: node + run: | + TIMESTAMP=$(date -u +%Y-%m-%dT%H-%M) + SHORT_SHA=$(git rev-parse --short HEAD) + echo "BUILD_ID=${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_ENV + echo "build_id=${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_OUTPUT + + - name: Install dependencies (Linux) + if: matrix.platform == 'linux' + run: | + sudo apt-get update + sudo apt-get install -y python3 g++ make curl tar xz-utils + + - name: Build Node (linux) + working-directory: node + if: matrix.platform == 'linux' + run: | + ./configure --experimental-enable-pointer-compression + make -j4 install DESTDIR=$GITHUB_WORKSPACE/node-install + + - name: Build Node (darwin) + working-directory: node + if: matrix.platform == 'darwin' + run: | + ./configure --experimental-enable-pointer-compression --without-snapshot + make -j2 install DESTDIR=$GITHUB_WORKSPACE/node-install + + - name: Archive Node + run: | + mkdir -p artifacts + FILENAME=node-${NODE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}-${{ steps.meta.outputs.build_id }}.tar.xz + FILENAME_LATEST=node-${NODE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz + tar -C node-install -cJf artifacts/$FILENAME . + cp artifacts/$FILENAME artifacts/$FILENAME_LATEST + echo "NODE_ARCHIVE=$FILENAME" >> $GITHUB_ENV + echo "NODE_ARCHIVE_LATEST=$FILENAME_LATEST" >> $GITHUB_ENV + + - name: Upload Node archive + uses: actions/upload-artifact@v4 + with: + name: node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ steps.meta.outputs.build_id }} + path: artifacts/${{ env.NODE_ARCHIVE }} + + - name: Upload Node archive latest + uses: actions/upload-artifact@v4 + with: + name: node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST + path: artifacts/${{ env.NODE_ARCHIVE_LATEST }} + + - name: Upload Node archive to release + uses: softprops/action-gh-release@v1 + with: + name: node-${{ env.NODE_VERSION }}-LATEST + tag_name: node-${{ env.NODE_VERSION }}-release + files: ./artifacts/${{ env.NODE_ARCHIVE_LATEST }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/stage_for_s3.bash b/stage_for_s3.bash new file mode 100755 index 00000000000000..d1642b91543bd0 --- /dev/null +++ b/stage_for_s3.bash @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +mkdir stage +cd stage || exit + +TIMESTAMP=$(date '+%Y%m%d.%H%M') + +echo "Current timestamp is $TIMESTAMP" + +gh release download -p "*.gz" +gh release download -p "*.xz" + +curl "https://asana-oss-cache.s3.us-east-1.amazonaws.com/node-fibers/fibers-5.0.4.pc.tgz" --output fibers-5.0.4.tar.gz +tar -xzf fibers-5.0.4.tar.gz + +find . -name "*.gz" | while read -r a +do + tar -xzf "$a" -C package/bin + rm "$a" +done + +tar -czf temp.tgz package/ +rm -fr package +SHORT_HASH=$(cat temp.tgz | sha1sum | cut -c1-4) +echo "HASH: $SHORT_HASH" +UNIQUE="pc-${TIMESTAMP}-${SHORT_HASH}" + +mv temp.tgz "fibers-5.0.4-${UNIQUE}.tgz" + +for file in *.tar.xz; do + if [[ "$file" == *-LATEST.tar.xz ]]; then + base="${file%-LATEST.tar.xz}" + new_name="${base}-${UNIQUE}.tar.xz" + + echo "Renaming: $file -> $new_name" + mv "$file" "$new_name" + + if [[ "$new_name" =~ node-v([0-9.]+)-(darwin|linux)-(arm64|x64)-pc.*\.tar\.xz$ ]]; then + version="${BASH_REMATCH[1]}" + os="${BASH_REMATCH[2]}" + arch="${BASH_REMATCH[3]}" + target_dir="node-v${version}-${os}-${arch}" + + echo "Target Dir: $target_dir" + mkdir "$target_dir" + tar -xzf "$new_name" -C "$target_dir" + mv "$target_dir/usr/local/*" "$target_dir" + rm -fr "$target_dir/usr/local" + + tar -cJf "$new_name" "$target_dir" + + rm -fr "$target_dir" + + echo "✅ Done: Archive now contains:" + tar -tf "$new_name" | head + + else + echo "Warning: Skipped $new_name due to unexpected filename format." + fi + fi +done + + +cd .. +mv stage "node-${UNIQUE}" + +echo "Files are in node-${UNIQUE}, please upload to s3" + + + diff --git a/tools/dep_updaters/update-openssl.sh b/tools/dep_updaters/update-openssl.sh index bef379b707a04e..444b5cce272456 100755 --- a/tools/dep_updaters/update-openssl.sh +++ b/tools/dep_updaters/update-openssl.sh @@ -174,7 +174,8 @@ main() { * ) echo "unknown command: $1" help 1 - exit 1 + # shellcheck disable=SC2317 + exit 1 ;; esac }