Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: native testing for arm64 #43

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e082031
remove qemu
kevaundray Jun 30, 2024
b2013a5
remove qemu for windows
kevaundray Jun 30, 2024
0c37e72
update runner name
kevaundray Jun 30, 2024
0ff3eb9
remove other builds and use choco to install latest git
kevaundray Jun 30, 2024
9b44524
try manually installing git -- CI says choco is not installed
kevaundray Jun 30, 2024
6e45e71
remove full installer -- windows cuts off the connection
kevaundray Jun 30, 2024
ee56b4d
try checking for windows native version of git (arm64)
kevaundray Jun 30, 2024
59098be
try looking for wsl git
kevaundray Jun 30, 2024
3dba5c7
website says we can use winget
kevaundray Jun 30, 2024
afd151c
install choco
kevaundray Jun 30, 2024
ad78198
install git using choco
kevaundray Jun 30, 2024
2120f21
refreshenv after installing choco
kevaundray Jun 30, 2024
a4b79c3
manually add choco to path
kevaundray Jun 30, 2024
e71fa1a
try to use the full path to choco
kevaundray Jun 30, 2024
9b1a3d6
add back build and remove refreshenv
kevaundray Jun 30, 2024
ccd5feb
try to manually refresh the environment
kevaundray Jun 30, 2024
1dc7169
remove build again
kevaundray Jun 30, 2024
d5beb2b
add import-module
kevaundray Jun 30, 2024
42cbdfb
try to manually add git to path (choc should install it in the offici…
kevaundray Jun 30, 2024
61f07c7
try putting gitpath in GITHUB_PATH
kevaundray Jun 30, 2024
4438649
try just adding git to the path
kevaundray Jun 30, 2024
1da7e00
add yarn and add back git install using choco
kevaundray Jun 30, 2024
1d5af1c
add nodejs in choco
kevaundray Jun 30, 2024
b0d8476
install yarn after npm is installed
kevaundray Jun 30, 2024
93d99a9
Try to use setup-node
kevaundray Jun 30, 2024
a285694
try using choc action
kevaundray Jun 30, 2024
b2e2afc
cleanup + refreshenv
kevaundray Jun 30, 2024
422d0d3
Import-Module
kevaundray Jun 30, 2024
d4ab03a
add git to path again
kevaundray Jun 30, 2024
6c48bff
restore other steps
kevaundray Jun 30, 2024
d41fc1d
rename file
kevaundray Jun 30, 2024
228ad48
Merge branch 'master' into kw/use-linux-arm64
kevaundray Jun 30, 2024
38ae307
list files
kevaundray Jun 30, 2024
ae72335
remove cache
kevaundray Jun 30, 2024
06cbeb8
set shell as bash (should use git bash)
kevaundray Jun 30, 2024
930fa10
use pwsh (git bash not working)
kevaundray Jun 30, 2024
33883cc
ad diagnostic information
kevaundray Jun 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 103 additions & 54 deletions .github/workflows/release-node-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-13
target: x86_64-apple-darwin
- host: macos-14
target: aarch64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-pc-windows-msvc
# - host: macos-13
# target: x86_64-apple-darwin
# - host: macos-14
# target: aarch64-apple-darwin
# - host: ubuntu-latest
# target: x86_64-unknown-linux-gnu
# - host: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# - host: ubuntu-latest
# target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: aarch64-pc-windows-msvc

Expand Down Expand Up @@ -111,33 +111,114 @@ jobs:
target: aarch64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
- host: linux-arm64
target: aarch64-unknown-linux-gnu
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
- host: win-arm64
target: aarch64-pc-windows-msvc
node:
- '20'

name: Test - ${{ matrix.settings.target }} - node@${{ matrix.node }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4

# Windows arm64 doesn't have git it seems or choco.
# We install choco and then git
- name: Install Chocolatey
if: matrix.settings.host == 'win-arm64'
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

- name: Add Chocolatey to PATH
if: matrix.settings.host == 'win-arm64'
shell: powershell
run: |
$chocoPath = "C:\ProgramData\chocolatey\bin"
$env:Path = "$chocoPath;$env:Path"
echo "$chocoPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Verify Chocolatey installation
if: matrix.settings.host == 'win-arm64'
shell: powershell
run: choco --version

- name: Install Git using Chocolatey Action
if: matrix.settings.host == 'win-arm64'
uses: crazy-max/ghaction-chocolatey@v2
with:
ref: ${{ inputs.ref }}
args: install git -y

- name: Add Git to PATH and verify installation
if: matrix.settings.host == 'win-arm64'
shell: powershell
run: |
$gitPath = "C:\Program Files\Git\cmd"
$env:Path = "$gitPath;$env:Path"
echo "$gitPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
git --version

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Install Yarn
if: matrix.settings.host == 'win-arm64'
run: |
npm install -g yarn
echo "$(npm config get prefix)/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Verify Yarn installation
if: matrix.settings.host == 'win-arm64'
run: |
yarn --version

- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install dependencies
run: yarn install
working-directory: bindings/node

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: bindings/node

- name: List files
run: Get-ChildItem -Force -Recurse | Select-Object Mode, LastWriteTime, Length, FullName
shell: powershell

- name: Diagnostic Information
shell: pwsh
run: |
Write-Host "Node.js version and architecture:"
node -p "process.arch + ' ' + process.version"

Write-Host "`nNODE_MODULE_VERSION:"
node -p "process.versions.modules"

Write-Host "`nSystem Type:"
systeminfo | findstr "System Type"

Write-Host "`nDirectory contents:"
Get-ChildItem -Force -Recurse .\bindings\node | Select-Object FullName, Length, LastWriteTime

Write-Host "`nFile details:"
Get-Item .\bindings\node\peerdas-kzg.win32-arm64-msvc.node | Select-Object *

Write-Host "`nTrying to load the module in Node.js REPL:"
node -e "try { require('./bindings/node/peerdas-kzg.win32-arm64-msvc.node'); console.log('Module loaded successfully'); } catch (error) { console.error('Error loading module:', error.message); }"

Write-Host "`nChecking for missing DLLs:"
Get-Content .\bindings\node\peerdas-kzg.win32-arm64-msvc.node | Select-String -Pattern "\.dll" -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value } | Sort-Object -Unique

# Native testing for macOS (both Intel and ARM)
- name: Test bindings (macOS)
Expand All @@ -151,52 +232,22 @@ jobs:
run: yarn test
working-directory: bindings/node

# Emulated testing for aarch64 Linux
- name: Set up QEMU
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Test bindings (Linux ARM64)
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
uses: addnab/docker-run-action@v3
with:
image: node:${{ matrix.node }}-slim
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
run: |
cd bindings/node
yarn config set supportedArchitectures.cpu "arm64"
yarn config set supportedArchitectures.libc "glibc"
yarn install
yarn test
run: yarn test
working-directory: bindings/node

# Native testing for x86_64 Windows
- name: Test bindings (Windows x86_64)
if: matrix.settings.target == 'x86_64-pc-windows-msvc'
run: yarn test
working-directory: bindings/node
# TODO: Its kind of hard to test windows on arm64 w yarn
# The approach of using linaro/wine-arm64 is the most promising
# We can add it back after some debugging
# - name: Test bindings (Windows ARM64)
# if: matrix.settings.target == 'aarch64-pc-windows-msvc'
# uses: addnab/docker-run-action@v3
# with:
# image: linaro/wine-arm64
# options: '-v ${{ github.workspace }}:/build -w /build'
# run: |
# echo "Download node windows-arm64"
# NODE_VERSION=20.0.0
# wget -q https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-win-arm64.zip
# unzip -q node-*.zip
# mv node-*-win-arm64 /node

# cd bindings/node
# echo "Run tests"
# wine-arm64 /node/node.exe --version
# wine-arm64 /node/npm.cmd install -g yarn
# wine-arm64 /node/yarn.cmd install
# wine-arm64 /node/yarn.cmd test

# Native testing for arm64 Windows
- name: Test bindings (Windows arm64)
if: matrix.settings.target == 'aarch64-pc-windows-msvc'
run: yarn test
working-directory: bindings/node

publish:
name: Publish
Expand All @@ -214,8 +265,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
cache-dependency-path: 'bindings/node'
- name: Install dependencies
run: yarn install
- name: Download all artifacts
Expand Down
Loading