Fix cross-platform nvml header includes #69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Node.js Package | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - image: ubuntu-latest | |
| kernel: linux-x64 | |
| # - image: windows-latest | |
| # kernel: win32-x64 | |
| # - image: macos-13 | |
| # kernel: darwin-x64 | |
| # - image: macos-latest | |
| # kernel: darwin-arm64 | |
| name: Build ${{ matrix.kernel }} | |
| runs-on: ${{ matrix.image }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' | |
| - run: | | |
| sudo apt-get install -y nvidia-driver-535 | |
| sudo apt-get install -y libnvidia-ml-dev | |
| if: matrix.kernel == 'linux-x64' | |
| - run: npm run install-dependencies | |
| - run: npm run prebuild | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.kernel }} | |
| path: prebuilds/${{ matrix.kernel }}/ | |
| if-no-files-found: error | |
| retention-days: 1 | |
| pack-module: | |
| name: Pack module | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| outputs: | |
| tgz_name: ${{ steps.pack.outputs.tgz_name }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v2 | |
| - uses: actions/download-artifact@v4 | |
| name: Bundle Prebuilds | |
| with: | |
| path: prebuilds/ | |
| - run: ls prebuilds | |
| - run: npm run install-dependencies | |
| - run: echo "tgz_name=$(npm pack)" >> "$GITHUB_OUTPUT" | |
| id: pack | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: package | |
| path: node-ps-data-*.tgz | |
| test: | |
| strategy: | |
| matrix: | |
| include: | |
| - image: ubuntu-latest | |
| kernel: linux-x64 | |
| - image: windows-latest | |
| kernel: win32-x64 | |
| - image: macos-13 | |
| kernel: darwin-x64 | |
| - image: macos-latest | |
| kernel: darwin-arm64 | |
| name: Test ${{ matrix.kernel }} | |
| runs-on: ${{ matrix.image }} | |
| needs: [pack-module] | |
| steps: | |
| - uses: actions/setup-node@v2 | |
| - uses: actions/checkout@v3 | |
| name: Fetch tests | |
| with: | |
| sparse-checkout: | | |
| test/ | |
| sparse-checkout-cone-mode: false | |
| - uses: actions/download-artifact@v4 | |
| name: Load bundled module | |
| id: download-module | |
| with: | |
| name: package | |
| - run: npm i ${{ needs.pack-module.outputs.tgz_name }} | |
| - name: Basic CPU Test | Build Test | |
| run: npm exec tsc ./test/test_cpu_basic.ts | |
| - name: Basic CPU Test | Run Test | |
| run: node ./test/test_cpu_basic.js | |
| - name: Basic Memory Test | Build Test | |
| run: npm exec tsc ./test/test_mem_basic.ts | |
| - name: Basic Memory Test | Run Test | |
| run: node ./test/test_mem_basic.js | |
| #- name: File Read / Write | Build Test | |
| # run: npm exec tsc ./test/test_readwrite.ts | |
| #- name: File Read / Write | Run Test | |
| # run: node ./test/test_readwrite.js | |
| publish-npm: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| needs: [test, pack-module] | |
| steps: | |
| - uses: actions/setup-node@v2 | |
| with: | |
| registry-url: https://registry.npmjs.org/ | |
| - uses: actions/download-artifact@v4 | |
| name: Bundle Prebuilds | |
| with: | |
| name: package | |
| - run: npm publish ${{ needs.pack-module.outputs.tgz_name }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.npm_token }} |