Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions .github/workflows/js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ name: JS

on:
workflow_dispatch:
pull_request:
paths:
- "Makefile"
- "wasm/Makefile"
- "wasm/*.ts"
- "wasm/*.c"
- "src/*.c"
- "include/*.h"
- .github/workflows/js.yaml
push:
tags:
- "v*"
Expand Down Expand Up @@ -49,16 +58,40 @@ jobs:
- name: Upload npm package as artifact
uses: actions/upload-artifact@v7
with:
path: ./wasm/libspot*.tgz
name: libspot.tgz
name: libspot-tgz
path: wasm/libspot*.tgz

- name: Upload library files as artifact
uses: actions/upload-artifact@v7
with:
path: ./wasm/dist
name: libspot

- name: Publish to npmjs
# - name: Publish to npmjs
# if: github.ref_type == 'tag'
# run: bun publish
# working-directory: ./wasm

publish:
needs: build
runs-on: ubuntu-latest
environment:
name: npmjs
env:
# bun publish respects the NPM_CONFIG_TOKEN
NPM_CONFIG_TOKEN: ${{ secrets.NPMJS_GRANULAR_TOKEN }}
steps:
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 24
- name: Download archive
uses: actions/download-artifact@v8
with:
name: libspot-tgz
- name: Stage publish (dry-run)
if: github.ref_type != 'tag'
run: npm stage publish --dry-run libspot*.tgz
- name: Stage publish
if: github.ref_type == 'tag'
run: bun publish
working-directory: ./wasm
run: npm stage publish libspot*.tgz
8 changes: 8 additions & 0 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ name: Python

on:
workflow_dispatch:
pull_request:
paths:
- "Makefile"
- "python/*.py"
- "python/*.c"
- "src/*.c"
- "include/*.h"
- .github/workflows/python.yaml
push:
tags:
- "v*"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


LIB := libspot
VERSION := 3.0.1
VERSION := 3.0.2
# revision should be incremented when releasing an updated package
# of the same upstream version, and it should reset to 1 when
# bumping the version.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "libspot-docs"
version = "3.0.1"
version = "3.0.2"
description = "Born to flag outliers"
authors = [
{ name = "Alban Siffer", email = "31479857+asiffer@users.noreply.github.com" },
Expand Down
8 changes: 4 additions & 4 deletions src/spot.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ double spot_probability(struct Spot const *spot, double z) {
* @param size size of the output buffer
* @return char* pointer to the output buffer
*/
static char *strncpy(char *dst, const char *src, unsigned long size) {
static char *copy(char *dst, const char *src, unsigned long size) {
if (size == 0) {
return dst;
}
Expand Down Expand Up @@ -203,14 +203,14 @@ static const char *errors[] = {
void libspot_error(enum LibspotError err, char *buffer, unsigned long size) {
if ((err >= ERR_MEMORY_ALLOCATION_FAILED) && (err <= ERR_DATA_IS_NAN)) {
int index = err - ERR_MEMORY_ALLOCATION_FAILED;
strncpy(buffer, errors[index], size);
copy(buffer, errors[index], size);
}
}

void libspot_version(char *buffer, unsigned long size) {
strncpy(buffer, version, size);
copy(buffer, version, size);
}

void libspot_license(char *buffer, unsigned long size) {
strncpy(buffer, license, size);
copy(buffer, license, size);
}
1 change: 1 addition & 0 deletions wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ binary.ts: libspot.wasm
tgz: libspot-$(VERSION).tgz

libspot-$(VERSION).tgz: dist/libspot.js types/index.d.ts
@sed -i 's/"version": *"[^"]*"/"version": "$(VERSION)"/' package.json
@bun pm pack

test:
Expand Down
892 changes: 0 additions & 892 deletions wasm/binary.ts

This file was deleted.

50 changes: 0 additions & 50 deletions wasm/main.ts

This file was deleted.

2 changes: 1 addition & 1 deletion wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libspot",
"version": "3.0.0",
"version": "3.0.2",
"repository": {
"type": "git",
"url": "git+https://github.com/asiffer/libspot.git",
Expand Down
Loading