Skip to content

Commit

Permalink
Merge pull request #71 from jonmmease/jonmmease/bump_version_fix
Browse files Browse the repository at this point in the history
Cleanup and build JavaScript package in GItHub action
  • Loading branch information
jonmmease authored Apr 29, 2024
2 parents b2ebdc4 + 0685d87 commit 56a842b
Show file tree
Hide file tree
Showing 15 changed files with 9,294 additions and 685 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: JavaScript

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build-vega-renderer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.20.1
cache: true
- name: Cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ hashFiles('pixi.lock', 'Cargo.lock') }}-build-vega-renderer
path: |
~/.cargo
target
.pixi
- name: Build package
run: |
pixi run pack-vega-renderer
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: vegafusion-wasm-packages
path: avenger-vega-renderer/packed/avenger-vega-renderer-*.tgz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ __pycache__/
/examples/deno_png/chart.png
/avenger-vega-renderer/test/failures/
/avenger-vega-renderer/lib/
/avenger-vega-renderer/packed/*
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 26 additions & 4 deletions automation/bump_version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import click
from pathlib import Path
import toml
import json

root = Path(__file__).parent.parent.absolute()

Expand All @@ -14,11 +15,22 @@ def bump_version(version):
cargo_packages = [
"avenger",
"avenger-vega",
"avenger-vega-renderer",
"avenger-wgpu",
"avenger-vega-test-data",
"avenger-python",
]

# Handle package.json files
package_jsons = [
"avenger-vega-renderer"
]

# Handle pyproject.toml files
pyproject_tomls = [
"avenger-python"
]

for package in cargo_packages:
cargo_toml_path = (root / package / "Cargo.toml")
cargo_toml = toml.loads(cargo_toml_path.read_text())
Expand All @@ -42,11 +54,21 @@ def bump_version(version):
cargo_toml_path.write_text(toml.dumps(cargo_toml))
print(f"Updated version in {cargo_toml_path}")

for package_json_dir in package_jsons:
for fname in ["package.json", "package-lock.json"]:
package_json_path = root / package_json_dir / fname
package_json = json.loads(package_json_path.read_text())
package_json["version"] = version
package_json_path.write_text(json.dumps(package_json, indent=2))
print(f"Updated version in {package_json_path}")

# pyproject.toml
pyproject_toml_path = (root / "avenger-python" / "pyproject.toml")
pyproject_toml = toml.loads(pyproject_toml_path.read_text())
pyproject_toml["project"]["version"] = version
pyproject_toml_path.write_text(toml.dumps(pyproject_toml))
for toml_dir in pyproject_tomls:
pyproject_toml_path = (root / toml_dir / "pyproject.toml")
pyproject_toml = toml.loads(pyproject_toml_path.read_text())
pyproject_toml["project"]["version"] = version
pyproject_toml_path.write_text(toml.dumps(pyproject_toml))
print(f"Updated version in {pyproject_toml_path}")


if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions avenger-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-python"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
license = "BSD-3-Clause"
description = "Python API to Avenger visualization framework"
Expand All @@ -17,17 +17,17 @@ pollster = "0.3"
[dependencies.avenger]
path = "../avenger"
features = [ "pyo3",]
version = "0.0.3"
version = "0.0.4"

[dependencies.avenger-vega]
path = "../avenger-vega"
features = [ "pyo3",]
version = "0.0.3"
version = "0.0.4"

[dependencies.avenger-wgpu]
path = "../avenger-wgpu"
features = [ "pyo3",]
version = "0.0.3"
version = "0.0.4"

[dependencies.pyo3]
workspace = true
Expand Down
2 changes: 1 addition & 1 deletion avenger-python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "avenger"
version = "0.0.3"
version = "0.0.4"
readme = "README.md"
description = "A Visualization Engine and Renderer"

Expand Down
50 changes: 36 additions & 14 deletions avenger-vega-renderer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,58 @@
[package]
name = "avenger-vega-renderer"
version = "0.1.0"
version = "0.0.4"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]
crate-type = [ "cdylib", "rlib",]

[features]
deno = ["avenger-wgpu/deno"]
deno = [ "avenger-wgpu/deno",]

[dependencies]
console_error_panic_hook = { version = "0.1.1" }
avenger-vega = { path = "../avenger-vega" }
avenger = { path = "../avenger" }
avenger-wgpu = { path = "../avenger-wgpu", default-features = false }
wgpu = { version = "0.19.3", default-features = false, features = ["wgsl", "webgl", "webgpu"]}
lazy_static = "1.4.0"
serde_json = "1.0.114"
csscolorparser = "0.6.2"
lyon_path = "*"
itertools = "0.12.0"
wasm-bindgen = { version = "=0.2.92" }
wasm-bindgen-futures = "0.4.42"
gloo-utils = { version = "0.2.0", features = ["serde"] }
serde-wasm-bindgen = "0.6.5"
js-sys = "0.3.69"
web-sys = { version = "0.3.69", features = [
"Document", "Window", "Element", "Performance", "OffscreenCanvas", "OffscreenCanvasRenderingContext2d", "TextMetrics", "ImageData"
] }
unicode-segmentation = "*"

[dependencies.console_error_panic_hook]
version = "0.1.1"

[dependencies.avenger-vega]
path = "../avenger-vega"
version = "0.0.4"

[dependencies.avenger]
path = "../avenger"
version = "0.0.4"

[dependencies.avenger-wgpu]
path = "../avenger-wgpu"
default-features = false
version = "0.0.4"

[dependencies.wgpu]
version = "0.19.3"
default-features = false
features = [ "wgsl", "webgl", "webgpu",]

[dependencies.wasm-bindgen]
version = "=0.2.92"

[dependencies.gloo-utils]
version = "0.2.0"
features = [ "serde",]

[dependencies.web-sys]
version = "0.3.69"
features = [ "Document", "Window", "Element", "Performance", "OffscreenCanvas", "OffscreenCanvasRenderingContext2d", "TextMetrics", "ImageData",]

[dependencies.image]
workspace = true
default-features = false
features = ["png"]
features = [ "png",]
4 changes: 2 additions & 2 deletions avenger-vega-renderer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions avenger-vega-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "avenger-vega-renderer",
"version": "0.1.0",
"version": "0.0.4",
"description": "",
"main": "js/index.js",
"files": [
Expand All @@ -20,4 +20,4 @@
"keywords": [],
"author": "",
"license": "ISC"
}
}
2 changes: 1 addition & 1 deletion avenger-vega-test-data/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-vega-test-data"
version = "0.0.3"
version = "0.0.4"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions avenger-vega/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-vega"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
description = "Utilities for importing Vega scenegraphs into Avenger"
license = "BSD-3-Clause"
Expand Down Expand Up @@ -33,7 +33,7 @@ workspace = true

[dependencies.avenger]
path = "../avenger"
version = "0.0.3"
version = "0.0.4"

[dependencies.thiserror]
workspace = true
Expand Down
24 changes: 11 additions & 13 deletions avenger-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger-wgpu"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
description = "WGPU rendering engine for the Avenger visualization framework"
license = "BSD-3-Clause"
Expand All @@ -9,8 +9,8 @@ license = "BSD-3-Clause"
crate-type = [ "cdylib", "rlib",]

[features]
default = ["cosmic-text", "rayon"]
cosmic-text = ["dep:cosmic-text", "lazy_static"]
default = [ "cosmic-text", "rayon",]
cosmic-text = [ "dep:cosmic-text", "lazy_static",]
deno = []

[dependencies]
Expand All @@ -33,7 +33,7 @@ rstest = "0.18.2"

[dependencies.avenger]
path = "../avenger"
version = "0.0.3"
version = "0.0.4"

[dependencies.rayon]
workspace = true
Expand Down Expand Up @@ -67,16 +67,14 @@ workspace = true
[dev-dependencies.avenger-vega]
path = "../avenger-vega"
features = [ "image-request", "svg",]
version = "0.0.3"
version = "0.0.4"

[dev-dependencies.serde_json]
version = "1.0.111"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wgpu = { version = "0.19.3"}
web-sys = { version = "0.3.67", features = [
"Document",
"Window",
"Element",
"HtmlCanvasElement",
]}
[target."cfg(target_arch = \"wasm32\")".dependencies.wgpu]
version = "0.19.3"

[target."cfg(target_arch = \"wasm32\")".dependencies.web-sys]
version = "0.3.67"
features = [ "Document", "Window", "Element", "HtmlCanvasElement",]
2 changes: 1 addition & 1 deletion avenger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "avenger"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
description = "A visualization engine and renderer"
license = "BSD-3-Clause"
Expand Down
Loading

0 comments on commit 56a842b

Please sign in to comment.