Skip to content

0.5.28

0.5.28 #185

Workflow file for this run

name: CI
on:
push:
branches:
- v0.5
tags:
- 'v*'
permissions:
contents: write
id-token: write
jobs:
test:
name: Integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- run: cd integration-tests && npm ci && npm run test
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-14-xlarge
target: aarch64-apple-darwin
- host: macos-14-large
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: true
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
use-cross: true
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
use-cross: true
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
use-cross: true
- host: ubuntu-latest
target: arm-unknown-linux-gnueabihf
use-cross: true
- host: ubuntu-latest
target: arm-unknown-linux-musleabihf
use-cross: true
name: Build - ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- name: Setup cmake
if: ${{ matrix.settings.use-cross }}
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: '3.18.x'
- name: Install cross
if: ${{ matrix.settings.use-cross }}
run: cargo install cross --locked
- name: Add msbuild to PATH
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
uses: microsoft/setup-msbuild@v2
- name: Install dependencies
run: npm ci
- name: Build (native)
if: ${{ !matrix.settings.use-cross }}
run: cargo build --message-format=json --release --target ${{ matrix.settings.target }} | npx neon dist --name libsql-js
shell: bash
- name: Build (cross)
if: ${{ matrix.settings.use-cross }}
run: cross build --message-format=json --release --target ${{ matrix.settings.target }} | npx neon dist --name libsql-js -m /target
shell: bash
- name: Pack platform package
run: npx neon pack-build -t ${{ matrix.settings.target }} -o dist
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: dist/*.tgz
if-no-files-found: error
publish:
name: Publish
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: 'https://registry.npmjs.org'
- name: Update npm
run: npm install -g npm@11
- name: Install dependencies
run: npm ci
- name: Compile TypeScript
run: npx tsc
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect platform tarballs
run: |
mkdir -p dist
for dir in artifacts/bindings-*; do
cp "$dir"/*.tgz dist/
done
ls -la dist/
shell: bash
- name: Set optionalDependencies
run: |
VERSION=$(node -p "require('./package.json').version")
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const targets = pkg.neon.targets;
pkg.optionalDependencies = {};
for (const [rustTarget, npmName] of Object.entries(targets)) {
pkg.optionalDependencies[npmName] = '${VERSION}';
}
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
echo "optionalDependencies set:"
node -p "JSON.stringify(require('./package.json').optionalDependencies, null, 2)"
shell: bash
- name: Publish
run: |
TAG_ARGS=""
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "Publishing stable release"
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "Publishing pre-release"
TAG_ARGS="--tag next"
else
echo "Not a release, skipping publish"
exit 0
fi
# Publish platform packages first
for tgz in ./dist/*.tgz; do
if [ -f "$tgz" ]; then
echo "Publishing $tgz..."
npm publish "$tgz" --access public --provenance $TAG_ARGS
fi
done
# Publish main package (skip prepack/neon install-builds since we set optionalDependencies above)
npm publish --access public --provenance --ignore-scripts $TAG_ARGS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}