Add bun support #63
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: build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| types: | |
| - released | |
| workflow_dispatch: {} | |
| env: | |
| # See https://github.com/nodejs/release#release-schedule | |
| # Node.js v20 EOL = 2026-04-30. v22 EOL = 2027-04-30. v23 EOL = 2025-06-01. v24 EOL = 2028-04-30. | |
| NODE_BUILD_CMD: npx --no-install prebuild -r node -t 20.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex '_sqlite3' | |
| # Bun versions - see https://github.com/oven-sh/bun/releases | |
| BUN_BUILD_CMD: npx --no-install prebuild -r bun -t 1.1.0 --include-regex '_sqlite3' | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-22.04 | |
| - macos-13 | |
| - macos-14 | |
| - windows-2022 | |
| node: | |
| - 20 | |
| - 22 | |
| - 23 | |
| - 24 | |
| name: Testing Node ${{ matrix.node }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - if: ${{ startsWith(matrix.os, 'windows') }} | |
| run: pip.exe install setuptools | |
| - if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: brew install python-setuptools | |
| - if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }} | |
| run: python3 -m pip install setuptools | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| run: | | |
| sudo apt update | |
| sudo apt install -y gcc-10 g++-10 libreadline-dev libncurses5-dev | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 | |
| - run: npm install --ignore-scripts | |
| - run: npm run build-debug | |
| - run: npm test | |
| test-bun: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-22.04 | |
| - macos-13 | |
| - macos-14 | |
| bun: | |
| - 1.2.23 | |
| name: Testing Bun ${{ matrix.bun }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: ${{ matrix.bun }} | |
| - if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: brew install python-setuptools | |
| - if: ${{ !startsWith(matrix.os, 'macos') }} | |
| run: python3 -m pip install setuptools | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| run: | | |
| sudo apt update | |
| sudo apt install -y gcc-10 g++-10 libreadline-dev libncurses5-dev | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 | |
| - run: bun install --ignore-scripts | |
| - run: bun run build-debug | |
| - run: bun test | |
| publish: | |
| if: ${{ github.event_name == 'release' }} | |
| name: Publishing to NPM | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - prebuild | |
| - prebuild-alpine | |
| - prebuild-alpine-arm | |
| - prebuild-linux-x64 | |
| - prebuild-linux-arm | |
| - prebuild-bun | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| prebuild: | |
| if: ${{ github.event_name == 'release' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-13 | |
| - macos-14 | |
| - windows-2022 | |
| name: Prebuild on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| - if: ${{ startsWith(matrix.os, 'windows') }} | |
| run: pip.exe install setuptools | |
| - if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: brew install python-setuptools | |
| - run: npm install --ignore-scripts | |
| - run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }} | |
| - if: matrix.os == 'windows-2022' | |
| run: | | |
| ${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }} | |
| ${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }} | |
| prebuild-linux-x64: | |
| if: ${{ github.event_name == 'release' }} | |
| name: Prebuild on Linux x64 | |
| runs-on: ubuntu-latest | |
| container: node:20-bullseye | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - run: npm install --ignore-scripts | |
| - run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }} | |
| prebuild-alpine: | |
| if: ${{ github.event_name == 'release' }} | |
| name: Prebuild on alpine | |
| runs-on: ubuntu-latest | |
| container: node:20-alpine | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - run: apk add build-base git python3 py3-setuptools libstdc++ readline-dev ncurses-dev --update-cache | |
| - run: npm install --ignore-scripts | |
| - run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }} | |
| prebuild-alpine-arm: | |
| if: ${{ github.event_name == 'release' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - arm/v7 | |
| - arm64 | |
| name: Prebuild on alpine (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: docker/setup-qemu-action@v3 | |
| - run: | | |
| docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:20-alpine -c "\ | |
| apk add build-base git python3 py3-setuptools libstdc++ readline-dev ncurses-dev --update-cache && \ | |
| cd /tmp/project && \ | |
| npm install --ignore-scripts && \ | |
| ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}" | |
| prebuild-linux-arm: | |
| if: ${{ github.event_name == 'release' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - arm/v7 | |
| - arm64 | |
| name: Prebuild on Linux (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: docker/setup-qemu-action@v3 | |
| - run: | | |
| docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:20-bullseye -c "\ | |
| cd /tmp/project && \ | |
| npm install --ignore-scripts && \ | |
| ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}" | |
| prebuild-bun: | |
| if: ${{ github.event_name == 'release' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-13 | |
| - macos-14 | |
| - ubuntu-22.04 | |
| name: Prebuild Bun on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| needs: test-bun | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.2.23 | |
| - if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: brew install python-setuptools | |
| - if: ${{ !startsWith(matrix.os, 'macos') }} | |
| run: python3 -m pip install setuptools | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| run: | | |
| sudo apt update | |
| sudo apt install -y gcc-10 g++-10 libreadline-dev libncurses5-dev | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 | |
| - run: npm install --ignore-scripts | |
| - run: ${{ env.BUN_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }} |