|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + release: |
| 11 | + types: |
| 12 | + - released |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + test: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: |
| 20 | + - ubuntu-latest |
| 21 | + - macos-latest |
| 22 | + - windows-latest |
| 23 | + node: |
| 24 | + - 14 |
| 25 | + - 16 |
| 26 | + - 18 |
| 27 | + # These fail with a useless error message |
| 28 | + exclude: |
| 29 | + - os: windows-latest |
| 30 | + node: 16 |
| 31 | + - os: windows-latest |
| 32 | + node: 18 |
| 33 | + fail-fast: false |
| 34 | + name: Testing Node ${{ matrix.node }} on ${{ matrix.os }} |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v3 |
| 38 | + with: |
| 39 | + submodules: true |
| 40 | + fetch-depth: 0 |
| 41 | + - uses: actions/setup-node@v3 |
| 42 | + with: |
| 43 | + node-version: ${{ matrix.node }} |
| 44 | + - name: Update node-gyp |
| 45 | + if: ${{ matrix.os == 'windows-latest' && matrix.node == '14' }} |
| 46 | + run: | |
| 47 | + $WhereNode = Get-Command node | Select-Object -ExpandProperty Definition |
| 48 | + $NodeDirPath = Split-Path $WhereNode -Parent |
| 49 | + $NodeModulesPath = $NodeDirPath + "\node_modules\npm\node_modules\npm-lifecycle" |
| 50 | + cd $NodeModulesPath |
| 51 | + |
| 52 | + - run: npm install |
| 53 | + - run: npm test |
| 54 | + |
| 55 | + publish: |
| 56 | + if: ${{ github.event_name == 'release' }} |
| 57 | + name: Publishing to NPM |
| 58 | + runs-on: ubuntu-latest |
| 59 | + needs: test |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v3 |
| 62 | + with: |
| 63 | + submodules: true |
| 64 | + fetch-depth: 0 |
| 65 | + - uses: actions/setup-node@v3 |
| 66 | + with: |
| 67 | + node-version: 18 |
| 68 | + registry-url: https://registry.npmjs.org |
| 69 | + - run: npm publish --access public |
| 70 | + env: |
| 71 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 72 | + |
| 73 | + prebuild: |
| 74 | + strategy: |
| 75 | + matrix: |
| 76 | + os: |
| 77 | + - ubuntu-latest |
| 78 | + - macos-latest |
| 79 | + - windows-latest |
| 80 | + fail-fast: false |
| 81 | + name: Prebuild on ${{ matrix.os }} |
| 82 | + runs-on: ${{ matrix.os }} |
| 83 | + needs: publish |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v3 |
| 86 | + with: |
| 87 | + submodules: true |
| 88 | + fetch-depth: 0 |
| 89 | + - uses: actions/setup-node@v3 |
| 90 | + with: |
| 91 | + node-version: 18 |
| 92 | + - run: npm install --ignore-scripts |
| 93 | + - run: npx --no-install prebuild -r node -t 10.0.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 -t 18.0.0 -u ${{ secrets.GH_TOKEN }} |
| 94 | + # Prebuilding for Electron 13+ on Windows fails with |
| 95 | + # win_delay_load_hook.cc |
| 96 | + # conversions.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class v8::Local<class v8::ArrayBuffer> __cdecl v8::ArrayBuffer::New(class v8::Isolate *,class std::shared_ptr<class v8::BackingStore>)" (__imp_?New@ArrayBuffer@v8@@SA?AV?$Local@VArrayBuffer@v8@@@2@PEAVIsolate@2@V?$shared_ptr@VBackingStore@v8@@@std@@@Z) referenced in function "void __cdecl node_tree_sitter::InitConversions(class v8::Local<class v8::Object>)" (?InitConversions@node_tree_sitter@@YAXV?$Local@VObject@v8@@@v8@@@Z) [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj] |
| 97 | + - if: matrix.os != 'windows-latest' |
| 98 | + run: npx --no-install prebuild -r electron -t 21.0.0 -t 22.0.0 -t 23.0.0 -u ${{ secrets.GH_TOKEN }} |
| 99 | + # - if: matrix.os == 'windows-latest' |
| 100 | + # run: npx --no-install prebuild -r electron -t 21.0.0 -t 22.0.0 -t 23.0.0 --arch ia32 -u ${{ secrets.GH_TOKEN }} |
| 101 | + - if: matrix.os == 'macos-latest' |
| 102 | + run: npx --no-install prebuild -r electron -t 21.0.0 -t 22.0.0 -t 23.0.0 --arch arm64 -u ${{ secrets.GH_TOKEN }} |
0 commit comments