Skip to content

It's ok for production use now #376

It's ok for production use now

It's ok for production use now #376

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
tags: ["v*", "v*.*.*"]
pull_request:
branches: ["main"]
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
permissions:
contents: read
actions: read
jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "22.14"
cache: npm
- name: Install dependencies
run: npm ci --include=dev
- name: Typecheck
run: npm run typecheck
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["20.19", "22.14"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci --include=dev
- name: Test
env:
FORCE_ESBUILD: ${{ startsWith(matrix.node-version, '20') }}
run: npm test
build:
runs-on: ubuntu-latest
needs: [typecheck, test]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "22.14"
cache: npm
- name: Install dependencies
run: npm ci --include=dev
- name: Build library + types
run: npm run build
- name: Check version sync
run: bash ./scripts/check-version-sync.sh
- name: Check npm package archive
run: npm pack
- name: Upload JS artifacts
uses: actions/upload-artifact@v7
with:
name: js-dist-${{ github.run_id }}
if-no-files-found: error
path: |
dist/
types/
*.tgz
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Sync & check Python package
run: |
bash ./scripts/sync-assets.sh --no-build
cd python-wrapper
python -m pip install --upgrade pip build twine
python -m build
python -m twine check dist/*
- name: Upload Python artifacts
uses: actions/upload-artifact@v7
with:
name: python-dist-${{ github.run_id }}
if-no-files-found: error
path: python-wrapper/dist/*
desktop-build:
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.os }}
needs: [typecheck, test]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
bundle: appimage
- os: macos-latest
bundle: dmg
- os: windows-latest
bundle: msi
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "22.14"
cache: npm
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
src-tauri -> target
key: desktop-${{ matrix.os }}
- name: Install Linux dependencies (Tauri)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf
- name: Install dependencies
run: npm ci --include=dev
- name: Generate desktop icons
run: npx tauri icon src-tauri/icons/icon.png
- name: Verify required bundle icons
shell: bash
run: |
set -euo pipefail
test -f src-tauri/icons/icon.ico
test -f src-tauri/icons/128x128.png
test -f src-tauri/icons/32x32.png
- name: Build desktop executables
run: npx tauri build --bundles ${{ matrix.bundle }}
- name: Upload desktop artifacts
uses: actions/upload-artifact@v7
with:
name: desktop-bundles-${{ matrix.os }}-${{ github.run_id }}
if-no-files-found: error
path: src-tauri/target/release/bundle/**/*
create-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, desktop-build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Download JS artifacts
uses: actions/download-artifact@v8
with:
name: js-dist-${{ github.run_id }}
path: release-assets/js
- name: Download Python artifacts
uses: actions/download-artifact@v8
with:
name: python-dist-${{ github.run_id }}
path: release-assets/python
- name: Download desktop artifacts
uses: actions/download-artifact@v8
with:
pattern: desktop-bundles-*-${{ github.run_id }}
path: release-assets/desktop
merge-multiple: true
- name: Generate release notes
id: notes
shell: bash
run: |
set -euo pipefail
git fetch --force --tags origin
TAG="${GITHUB_REF_NAME}"
PREV_TAG="$(git tag --sort=-v:refname | grep -v "^${TAG}$" | head -n1 || true)"
if [ -n "${PREV_TAG}" ]; then
RANGE="${PREV_TAG}..${TAG}"
else
RANGE="${TAG}"
fi
{
echo 'NOTES<<EOF'
echo "## Changes"
git log --pretty=format:'- %s (%h)' "${RANGE}" -- . ':(exclude)VERSION' ':(exclude)package.json' ':(exclude)python-wrapper/pyproject.toml' || true
echo
echo
echo "## Artifacts"
find release-assets -type f | sort | sed 's#^#- #'
echo 'EOF'
} >> "${GITHUB_OUTPUT}"
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.notes.outputs.NOTES }}
fail_on_unmatched_files: true
files: |
release-assets/js/*.tgz
release-assets/python/**/*.whl
release-assets/python/**/*.tar.gz
release-assets/desktop/**/*.AppImage
release-assets/desktop/**/*.msi
release-assets/desktop/**/*.dmg
publish-npm:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Ensure tags are present
run: git fetch --force --tags origin
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Ensure modern npm for trusted publishing
run: npm install -g npm@11.5.1
- name: Install dependencies
run: npm ci
- name: Check version sync (incl. tag)
run: bash ./scripts/check-version-sync.sh
- name: Build library + types
run: npm run build
- name: Verify tarball before publish
run: |
npm pack
echo "Tarball created successfully for version $(npm version --json | jq -r .version)"
- name: Publish npm
shell: bash
env:
NPM_CONFIG_PROVENANCE: "true"
run: npm publish --access public --provenance
publish-pypi:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Download Python artifacts
uses: actions/download-artifact@v8
with:
name: python-dist-${{ github.run_id }}
path: python-wrapper/dist
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Ensure tags are present
run: git fetch --force --tags origin
- name: Check version sync (incl. tag)
run: bash ./scripts/check-version-sync.sh
- name: Verify Python distributions
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip twine
shopt -s nullglob
packages=(python-wrapper/dist/*.tar.gz python-wrapper/dist/*.whl python-wrapper/dist/*.zip)
if [ ${#packages[@]} -eq 0 ]; then
echo "No distribution files found in python-wrapper/dist"
ls -la python-wrapper/dist || true
exit 1
fi
python -m twine check "${packages[@]}"
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
packages=(python-wrapper/dist/*.tar.gz python-wrapper/dist/*.whl python-wrapper/dist/*.zip)
python -m pip install --upgrade pip twine
python -m twine upload --non-interactive -u "$TWINE_USERNAME" -p "$TWINE_PASSWORD" "${packages[@]}"