forked from TryGhost/node-sqlite3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from gristlabs/build-binaries
prepare for adding prebuild binaries to releases
- Loading branch information
Showing
78 changed files
with
1,619 additions
and
2,186 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Contributing | ||
|
||
General guidelines for contributing to node-sqlite3 | ||
|
||
## Install Help | ||
|
||
If you've landed here due to a failed install of `node-sqlite3` then feel free to create a [new issue](https://github.com/tryghost/node-sqlite3/issues/new) to ask for help. The most likely problem is that we do not yet provide pre-built binaries for your particular platform and so the `node-sqlite3` install attempted a source compile but failed because you are missing the [dependencies for node-gyp](https://github.com/nodejs/node-gyp#installation). Provide as much detail on your problem as possible and we'll try to help. Include: | ||
|
||
- Logs of failed install (preferably from running `npm install sqlite3 --loglevel=info`) | ||
- Version of `node-sqlite3` you tried to install | ||
- Node version you are running | ||
- Operating system and architecture you are running, e.g. `Windows 7 64 bit`. | ||
|
||
The release process is documented in the wiki: https://github.com/TryGhost/node-sqlite3/wiki/Release-process |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 🐛 Bug report | ||
description: Report a reproducible issue | ||
labels: ["bug"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
## Welcome 👋 | ||
Thank you for taking the time to fill out a bug report 🙂 | ||
The more information you provide, the easier & quicker it is for us to diagnose the problem. | ||
Please search the existing issues and recent releases to make sure your problem hasn't already been solved. | ||
- type: textarea | ||
id: summary | ||
attributes: | ||
label: Issue Summary | ||
description: Explain what's wrong | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: reproduction | ||
attributes: | ||
label: Steps to Reproduce | ||
description: Also tell us, what did you expect to happen? | ||
placeholder: | | ||
1. This is the first step... | ||
2. This is the second step, etc. | ||
validations: | ||
required: true | ||
- type: input | ||
id: version | ||
attributes: | ||
label: Version | ||
description: What version of `node-sqlite3` are you using? | ||
validations: | ||
required: true | ||
- type: input | ||
id: node | ||
attributes: | ||
label: Node.js Version | ||
validations: | ||
required: true | ||
- type: input | ||
id: os | ||
attributes: | ||
label: How did you install the library? | ||
description: Provide details of your operating system and architecture | ||
validations: | ||
required: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: 📖 API documentation | ||
url: https://github.com/TryGhost/node-sqlite3/wiki/API | ||
about: Documentation for the `node-sqlite3` API |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ✨ Feature request | ||
description: Request a desired feature | ||
labels: ["feature request"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
## Welcome 👋 | ||
Thank you for taking the time to fill out a feature request | ||
The more information you provide, the easier it is for us to understand your use case. | ||
- type: textarea | ||
id: summary | ||
attributes: | ||
label: Summary | ||
description: Explain your use case. How would this improve your life? | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: reproduction | ||
attributes: | ||
label: Proposed implementation | ||
description: Give an API proposal. How would the feature work? | ||
placeholder: | | ||
The Database class has a new function called... | ||
validations: | ||
required: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: ⚙️ Installation problem | ||
description: Report an issue installing the library | ||
labels: ["install problem"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
## Welcome 👋 | ||
Thank you for taking the time to fill out a report with installing 🙂 | ||
The more information you provide, the easier & quicker it is for us to diagnose the problem. | ||
Please search the existing issues and recent releases to make sure your problem hasn't already been solved. | ||
- type: textarea | ||
id: summary | ||
attributes: | ||
label: Issue Summary | ||
description: Explain what's wrong | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: logs | ||
attributes: | ||
label: Relevant logs or output | ||
placeholder: | | ||
Error when installing `sqlite3` due to... | ||
validations: | ||
required: true | ||
- type: input | ||
id: version | ||
attributes: | ||
label: Version | ||
description: What version of `node-sqlite3` are you using? | ||
validations: | ||
required: true | ||
- type: input | ||
id: node | ||
attributes: | ||
label: Node.js Version | ||
validations: | ||
required: true | ||
- type: input | ||
id: os | ||
attributes: | ||
label: How did you install the library? | ||
description: Provide details of your operating system and architecture | ||
validations: | ||
required: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
name: CI | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- grist-main | ||
- grist-main-dev | ||
tags: | ||
- '*' | ||
env: | ||
FORCE_COLOR: 1 | ||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- macos-latest | ||
- ubuntu-20.04 | ||
- windows-latest | ||
host: | ||
- x64 | ||
target: | ||
- x64 | ||
node: | ||
- 14 | ||
- 16 | ||
- 18 | ||
include: | ||
- os: windows-latest | ||
node: 16 | ||
host: x86 | ||
target: x86 | ||
# This is a self-hosted runner, github doesn't have this architecture yet. | ||
- os: macos-m1 | ||
node: 16 | ||
host: arm64 | ||
target: arm64 | ||
name: ${{ matrix.os }} (node=${{ matrix.node }}, host=${{ matrix.host }}, target=${{ matrix.target }}) | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
architecture: ${{ matrix.host }} | ||
|
||
- name: Add yarn (self-hosted) | ||
if: matrix.os == 'macos-m1' | ||
run: npm install -g yarn | ||
|
||
- name: Add msbuild to PATH | ||
uses: microsoft/setup-msbuild@v1.1 | ||
if: contains(matrix.os, 'windows') | ||
with: | ||
msbuild-architecture: ${{ matrix.target }} | ||
|
||
- name: Install dependencies | ||
run: yarn install --ignore-scripts | ||
|
||
- name: Add env vars | ||
shell: bash | ||
run: | | ||
echo "V=1" >> $GITHUB_ENV | ||
if [ "${{ matrix.target }}" = "x86" ]; then | ||
echo "TARGET=ia32" >> $GITHUB_ENV | ||
else | ||
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV | ||
fi | ||
- name: Add Linux env vars | ||
if: contains(matrix.os, 'ubuntu') | ||
run: | | ||
echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV | ||
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV | ||
- name: Configure build | ||
run: yarn node-pre-gyp configure --target_arch=${{ env.TARGET }} | ||
|
||
- name: Build binaries | ||
run: yarn node-pre-gyp build --target_arch=${{ env.TARGET }} | ||
|
||
- name: Print binary info | ||
if: contains(matrix.os, 'ubuntu') | ||
run: | | ||
ldd lib/binding/*/node_sqlite3.node | ||
echo "---" | ||
nm lib/binding/*/node_sqlite3.node | grep "GLIBC_" | c++filt || true | ||
echo "---" | ||
file lib/binding/napi-v*/* | ||
- name: Run tests | ||
run: yarn test | ||
|
||
- name: Package prebuilt binaries | ||
run: yarn node-pre-gyp package --target_arch=${{ env.TARGET }} | ||
|
||
- name: Upload binaries to commit artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: matrix.node == 16 | ||
with: | ||
name: prebuilt-binaries | ||
path: build/stage/*/* | ||
retention-days: 7 | ||
|
||
- name: Upload binaries to GitHub Release | ||
run: yarn node-pre-gyp-github publish | ||
if: matrix.node == 16 && startsWith(github.ref, 'refs/tags/') | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }} | ||
build-qemu: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: | ||
- 16 | ||
target: | ||
- linux/arm64 | ||
variant: | ||
- bullseye | ||
- alpine3.15 | ||
include: | ||
# musl x64 builds | ||
- target: linux/amd64 | ||
variant: alpine3.15 | ||
node: 16 | ||
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }}) | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build binaries and test | ||
run: | | ||
docker buildx build \ | ||
--file ./tools/BinaryBuilder.Dockerfile \ | ||
--load \ | ||
--tag sqlite-builder \ | ||
--platform ${{ matrix.target }} \ | ||
--no-cache \ | ||
--build-arg VARIANT=${{ matrix.variant }} \ | ||
--build-arg NODE_VERSION=${{ matrix.node }} \ | ||
. | ||
CONTAINER_ID=$(docker create -it sqlite-builder) | ||
docker cp $CONTAINER_ID:/usr/src/build/build/ ./build | ||
- name: Upload binaries to commit artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: matrix.node == 16 | ||
with: | ||
name: prebuilt-binaries | ||
path: build/stage/*/* | ||
retention-days: 7 | ||
|
||
- name: Upload binaries to GitHub Release | ||
run: yarn install --ignore-scripts && yarn node-pre-gyp-github publish | ||
if: matrix.node == 16 && startsWith(github.ref, 'refs/tags/') | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }} |
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.