Skip to content

Build Custom Fibers #188

Build Custom Fibers

Build Custom Fibers #188

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 }}