diff --git a/.github/workflows/release-node-bindings.yml b/.github/workflows/release-node-bindings.yml index 2d8ec40c..d59d1391 100644 --- a/.github/workflows/release-node-bindings.yml +++ b/.github/workflows/release-node-bindings.yml @@ -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 @@ -111,11 +111,11 @@ 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' @@ -123,21 +123,102 @@ jobs: 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) @@ -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 @@ -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