|
| 1 | +name: npm-addon-linux-aarch64 |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: npm-addon-linux-aarch64-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + id-token: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + npm-addon-linux-aarch64: |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + os: [ubuntu-latest] |
| 21 | + python-version: ["3.8"] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Set up QEMU |
| 29 | + uses: docker/setup-qemu-action@v2 |
| 30 | + with: |
| 31 | + platforms: arm64 |
| 32 | + |
| 33 | + - name: Setup Python ${{ matrix.python-version }} |
| 34 | + uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.python-version }} |
| 37 | + |
| 38 | + - name: Show .npmrc |
| 39 | + shell: bash |
| 40 | + run: | |
| 41 | + echo $PWD |
| 42 | + echo $HOME |
| 43 | +
|
| 44 | + find $HOME -name .npmrc |
| 45 | +
|
| 46 | + - uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + registry-url: 'https://registry.npmjs.org' |
| 49 | + |
| 50 | + - name: Show .npmrc |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + echo $PWD |
| 54 | + echo $HOME |
| 55 | +
|
| 56 | + find $HOME -name .npmrc |
| 57 | +
|
| 58 | + cat /home/runner/work/_temp/.npmrc |
| 59 | + cp -v /home/runner/work/_temp/.npmrc ./ |
| 60 | +
|
| 61 | + - name: Build sherpa-onnx |
| 62 | + uses: addnab/docker-run-action@v3 |
| 63 | + with: |
| 64 | + image: quay.io/pypa/manylinux2014_aarch64 |
| 65 | + options: | |
| 66 | + --platform linux/arm64 |
| 67 | + --volume ${{ github.workspace }}/:/shared/ |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + cp /shared/.npmrc ~/ |
| 71 | +
|
| 72 | + cat ~/.npmrc |
| 73 | +
|
| 74 | + echo $HOME |
| 75 | + uname -a |
| 76 | + cat /etc/*release |
| 77 | + gcc --version |
| 78 | + cmake --version |
| 79 | +
|
| 80 | + curl -sL https://rpm.nodesource.com/setup_16.x | bash - |
| 81 | + yum install -y nodejs |
| 82 | +
|
| 83 | + node --version |
| 84 | +
|
| 85 | + cd /shared |
| 86 | +
|
| 87 | + mkdir build |
| 88 | + cd build |
| 89 | + cmake \ |
| 90 | + -DCMAKE_INSTALL_PREFIX=./install \ |
| 91 | + -DBUILD_SHARED_LIBS=ON \ |
| 92 | + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ |
| 93 | + -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ |
| 94 | + -DSHERPA_ONNX_ENABLE_BINARY=OFF \ |
| 95 | + .. |
| 96 | +
|
| 97 | + make -j |
| 98 | + make install |
| 99 | + cd .. |
| 100 | +
|
| 101 | + d=$PWD |
| 102 | + export SHERPA_ONNX_INSTALL_DIR=$d/build/install |
| 103 | +
|
| 104 | + ls -lh /shared/build |
| 105 | +
|
| 106 | + pushd scripts/node-addon-api/ |
| 107 | + npm i |
| 108 | +
|
| 109 | + ./node_modules/.bin/cmake-js compile --log-level verbose |
| 110 | + popd |
| 111 | +
|
| 112 | + owner=${{ github.repository_owner }} |
| 113 | + export owner |
| 114 | +
|
| 115 | + echo "---" |
| 116 | + ls -lh build/install/lib/ |
| 117 | + sudo chown -R runner ./build |
| 118 | + echo "---" |
| 119 | + ls -lh build/install/lib/ |
| 120 | + echo "---" |
| 121 | +
|
| 122 | + .github/scripts/node-addon/run.sh |
| 123 | +
|
| 124 | + ls -lh ./sherpa-onnx-node |
| 125 | +
|
| 126 | + export NODE_AUTH_TOKEN=${{ secrets.NPM_TOKEN }} |
| 127 | +
|
| 128 | + cd ./sherpa-onnx-node |
| 129 | + cp -v /shared/.npmrc ./ |
| 130 | + npm install |
| 131 | + npm ci |
| 132 | + ls -lh |
| 133 | + # see https://docs.npmjs.com/generating-provenance-statements |
| 134 | + npm publish --provenance --access public |
0 commit comments