Skip to content

Commit

Permalink
Bring everything up-to-date (#194)
Browse files Browse the repository at this point in the history
Ended up refactoring quite a bit while investigating a bug (_seems
prebuilds are failing on more and more setups_), figured a recap PR
might help...

- Fix outdated packages (that don't require more refactoring)
- Update node version in `test` to match that of `prebuild` action
- Update napi_versions to 8
- Update prebuildify target to 20
- Update (split) matrix
  - force tags where missing
  - add `win32-arm64`
- fix outdated image for linux-x64 (`centos7-devtoolset7` =>
`almalinux-devtoolset11`)
  - switch `linux-arm64-lts` to `linux-arm64`
- Update artifact names with `matrix.name` to avoid conflicts (merged on
download)
- Fix lint in tests

TODO:

- **Currently, this removes the `semantic-release` step in favor of a
`tree prebuilds` to finish debugging ([naming seems to have
changed](https://www.npmjs.com/package/@serialport/bindings-cpp?activeTab=code):
impact?), see action run:**
  - https://github.com/Nerivec/bindings-cpp/actions/runs/12331013585
- Can probably also add `dockcross/linux-riscv64`, which is becoming
more requested? (although not yet in `prebuild/docker-images`)

_Feel free to update/split as desired._

---------

Co-authored-by: Francis Gulotta <wizard@roborooter.com>
  • Loading branch information
Nerivec and reconbot authored Dec 23, 2024
1 parent 307c637 commit 5d157b1
Show file tree
Hide file tree
Showing 7 changed files with 4,743 additions and 16,228 deletions.
76 changes: 63 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,79 @@ jobs:
node: x64
command: prebuildify
args: --arch x64+arm64

- name: win32-x86
os: windows-2019
os: windows-latest
node: x86
command: prebuildify

- name: win32-x64
os: windows-2019
os: windows-latest
node: x64
command: prebuildify

- name: win32-arm64
os: windows-latest
node: x64
command: prebuildify
args: --arch arm64 --tag-armv 8

- name: linux-x64
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i almalinux-devtoolset11 --tag-libc --libc glibc

- name: linux-x64-musl
os: ubuntu-latest
node: x64
command: prebuildify-cross
# already has --tag-libc --libc musl
args: -i alpine

- name: linux-arm64
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i linux-arm64 --tag-libc --libc glibc

- name: linux-arm64-musl
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i centos7-devtoolset7 -i alpine
args: -i linux-arm64-musl --tag-libc --libc musl

- name: linux-arm
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i linux-armv7 -i linux-armv6 --tag-libc --libc glibc

- name: linux-arm-musl
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i linux-arm64-lts -i linux-armv7 -i linux-armv7l-musl -i linux-armv6
args: -i linux-armv7l-musl --tag-libc --libc musl

- name: android-arm
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i android-arm64 -i android-armv7
args: -i android-armv7

- name: android-arm64
os: ubuntu-latest
node: x64
command: prebuildify-cross
args: -i android-arm64

name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- if: matrix.node
uses: actions/setup-node@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ matrix.node }}
Expand All @@ -50,7 +98,7 @@ jobs:
- run: npm run ${{ matrix.command }} -- ${{ matrix.args }}
- uses: actions/upload-artifact@v4
with:
name: build-artifacts
name: build-artifacts-${{ matrix.name }}
path: prebuilds/
if-no-files-found: error
- if: failure()
Expand All @@ -63,14 +111,16 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build-artifacts
pattern: build-artifacts-*
merge-multiple: true
path: prebuilds
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run build
- run: npm run semantic-release
env:
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: tree -a prebuilds
# - run: npm run semantic-release
# env:
# GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20
- run: npm ci
- run: npm run lint
- run: npm run typecheck
Expand Down
2 changes: 1 addition & 1 deletion lib/bindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function testBinding(bindingName: string, Binding: BindingInterface, testPort?:
const port = await Binding.open(options)
const readError = shouldReject(port.read(Buffer.alloc(100), 0, 100))
await port.close()
const err: BindingsError = await readError
const err = await readError as BindingsError
assert.isTrue(err.canceled)
})
})
Expand Down
4 changes: 2 additions & 2 deletions lib/unix-read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ describe('unixRead', () => {
(mock as any).isOpen = false
makeFsReadError('EAGAIN')()
}
const err: BindingsError = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync }))
const err = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync })) as BindingsError
assert.isTrue(err.canceled)
})
it('rejects a disconnected error when fsread errors a disconnect error', async () => {
const readBuffer = Buffer.alloc(8, 0)
const fsReadAsync = makeFsReadError('EBADF')
const err = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync }))
const err = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync })) as Error & {disconnect: boolean}
assert.isTrue(err.disconnect)
})
})
2 changes: 1 addition & 1 deletion lib/unix-write.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('unixWrite', () => {
it('rejects a disconnect error when fswrite errors a disconnect error', async () => {
const writeBuffer = Buffer.alloc(8, 0)
const fsWriteAsync = makeFsWriteError('EBADF')
const err = await shouldReject(unixWrite({ binding: mock, buffer: writeBuffer, fsWriteAsync }))
const err = await shouldReject(unixWrite({ binding: mock, buffer: writeBuffer, fsWriteAsync })) as Error & {disconnect: boolean}
assert.isTrue(err.disconnect)
})
})
Loading

0 comments on commit 5d157b1

Please sign in to comment.