more progress on release workflow

This commit is contained in:
Will Jones
2023-05-23 16:40:02 -07:00
parent 89aee07fa9
commit f5bb2a2096
15 changed files with 406 additions and 144 deletions

View File

View File

@@ -67,8 +67,10 @@ jobs:
- name: Build
run: |
npm ci
npm run build
npm run tsc
npm run build
npm run pack-build
npm install --no-save ./dist/vectordb-*.tgz
- name: Test
run: npm run test
macos:
@@ -94,8 +96,10 @@ jobs:
- name: Build
run: |
npm ci
npm run build
npm run tsc
npm run build
npm run pack-build
npm install --no-save ./dist/vectordb-*.tgz
- name: Test
run: |
npm run test

View File

@@ -1,118 +0,0 @@
name: Node Release
on:
pull_request:
paths:
- node/**
- .github/workflows/node_release.yml
jobs:
macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Install system dependencies
run: brew install protobuf
- name: Install rustup target
run: rustup target add aarch64-apple-darwin
- name: Build x86_64
run: cargo build --lib -p vectordb-node --release --target x86_64-apple-darwin
- name: Upload x86_64 dylib
uses: actions/upload-artifact@v3
with:
path: target/x86_64-apple-darwin/release/libvectordb_node.dylib
name: x86_64-apple-darwin.node
retention-days: 5
- name: Build aarch64
run: cargo build --lib -p vectordb-node --release --target aarch64-apple-darwin
- name: Upload aarch64 dylib
uses: actions/upload-artifact@v3
with:
path: target/aarch64-apple-darwin/release/libvectordb_node.dylib
name: aarch64-apple-darwin.node
retention-days: 5
linux-x64:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
steps:
- uses: actions/checkout@v3
- name: Install system dependencies
run: |
yum install -y openssl-devel
# protobuf is too old, so we directly download binaries
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
PB_VERSION=23.1
curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip
unzip protoc-$PB_VERSION-linux-x86_64.zip -d $HOME/.local
echo "${HOME}/.local/bin" >> $GITHUB_PATH
# TODO: replace this with something more modern
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build GNU x86_64
run: cargo build --lib -p vectordb-node --release --verbose
- name: Upload GNU x86_64 dylib
uses: actions/upload-artifact@v3
with:
path: target/x86_64-unknown-linux-gnu/release/libvectordb_node.so
name: x86_64-unknown-linux-gnu.node
retention-days: 5
draft-release:
runs-on: ubuntu-latest
needs:
- linux-x64
- macos
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Move libraries
run: mv *.node node/
# TODO: make sure we aren't rebuilding the library here.
- name: Build module
run: |
npm install
npm run build
working-directory: node
- name: Test module
run: |
npm run tsc
npm test
working-directory: node
- name: Zip module
run: |
rm -rf node/node_modules
zip -r vectordb-node.zip node
- name: Upload
uses: actions/upload-artifact@v3
with:
path: vectordb-node.zip
retention-days: 5
# - name: Create draft release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# draft: true
# generate_release_notes: true
# files:
# vectordb-node-$GITHUB_REF-node-v3-linux-x64.zip # x86_64-unknown-linux-gnu.node
# vectordb-node-$GITHUB_REF-node-v3-darwin-x64.zip # x86_64-apple-darwin.node
# vectordb-node-$GITHUB_REF-node-v3-linux-x64.zip # aarch64-apple-darwin.node
# TODO: create draft release
# use: https://github.com/softprops/action-gh-release
# format like: https://github.com/tungv/cypher.js/releases/tag/v1.0.0-beta.6
#
# test-linux-x64:
# runs-on: ubuntu-latest
# needs:
# - draft-release
# steps:
# -

123
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,123 @@
name: Prepare Release
# Based on https://github.com/dherman/neon-prebuild-example/blob/eaa4d33d682e5eb7abbc3da7aed153a1b1acb1b3/.github/workflows/publish.yml
on:
push:
tags:
- v*
# TODO:
# Create draft relase
# Build and upload artifacts
# * Build wheel and sdist
# * Build npm module
# * Build native node modules
# Test release
# Publish release
env:
NODE_VERSION: 18.x
NPM_REGISTRY: 'https://registry.npmjs.org'
jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true # hardcoded on for now
generate_release_notes: true
python:
runs-on: ubuntu-latest
needs: draft-release
defaults:
run:
shell: bash
working-directory: python
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10
- name: Build wheel
run: python setup.py sdist bdist_wheel
- uses: softprops/action-gh-release@v1
with:
files: |
python/dist/lancedb-*.tar.gz
python/dist/lancedb-*.whl
node:
runs-on: ubuntu-latest
needs: draft-release
defaults:
run:
shell: bash
working-directory: node
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: node/package-lock.json
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- name: Build
run: |
npm ci
npm run tsc
- uses: softprops/action-gh-release@v1
with:
files: node/vectordb-*.tgz
node-macos:
runs-on: macos-12
needs: draft-release
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install system dependencies
run: brew install protobuf
- name: Build MacOS native node modules
run: bash ci/build_macos_artifacts.sh ${{ matrix.target }}
- uses: softprops/action-gh-release@v1
with:
files: node/dist/vectordb-darwin*.tgz
# node-linux:
# runs-on: ubuntu-latest
# needs: draft-release
# strategy:
# matrix:
# target:
# - x86_64-unknown-linux-gnu:centos
# - aarch64-unknown-linux-gnu:centos
# - aarch64-unknown-linux-musl
# - x86_64-unknown-linux-musl
# steps:
# - name: Install system dependencies
# run: |
# yum install -y openssl-devel
# # protobuf is too old, so we directly download binaries
# PB_REL="https://github.com/protocolbuffers/protobuf/releases"
# PB_VERSION=23.1
# curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip
# unzip protoc-$PB_VERSION-linux-x86_64.zip -d $HOME/.local
# echo "${HOME}/.local/bin" >> $GITHUB_PATH