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
7 changes: 7 additions & 0 deletions .github/actions/install-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ runs:
if: ${{ inputs.javascript == 'false' || inputs.playwright == 'false'}}
run: pnpm install --ignore-scripts

- name: Template version
shell: bash
if: ${{ !startsWith(github.ref_name, 'v') }}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
node tools/perspective-scripts/version.mjs --nightly

- name: Install Python dependencies
shell: bash
if: ${{ inputs.python == 'true' && inputs.manylinux == 'false' }}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
PACKAGE: "perspective-metadata"

- name: Lint
run: pnpm run lint
run: pnpm run lint --nightly

# - name: Docs Build
# run: pnpm run docs
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- name: WebAssembly Build
run: pnpm run build --ci
env:
PACKAGE: "perspective-cpp,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli"
PACKAGE: "perspective-cpp,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli,perspective-react"
# PSP_USE_CCACHE: 1

- uses: actions/upload-artifact@v4
Expand All @@ -170,6 +170,7 @@ jobs:
packages/perspective-viewer-openlayers/dist
packages/perspective-cli/dist
packages/perspective-workspace/dist
packages/perspective-react/dist

# ,-,---. . . .-,--. . .
# '|___/ . . . | ,-| '|__/ . . |- |-. ,-. ,-.
Expand Down Expand Up @@ -627,7 +628,7 @@ jobs:
- name: Run Tests
run: pnpm run test
env:
PACKAGE: "perspective-cpp,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli"
PACKAGE: "perspective-cpp,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli,perspective-react"
# PSP_USE_CCACHE: 1

# ,--,--' . .-,--. . .
Expand Down Expand Up @@ -991,6 +992,9 @@ jobs:
- run: pnpm pack --pack-destination=../..
working-directory: ./packages/perspective-workspace

- run: pnpm pack --pack-destination=../..
working-directory: ./packages/perspective-react

- run: pnpm pack --pack-destination=../..
working-directory: ./packages/perspective-cli

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ applications.
- [`@finos/perspective`, JavaScript Client API](https://docs.rs/perspective-js/latest/perspective_js/)
- [`@finos/perspective-viewer`, JavaScript UI API](https://docs.rs/perspective-viewer/latest/perspective_viewer/)
- [`perspective-python`, Python API](https://docs.rs/perspective-python/latest/perspective_python/)
- [`perspective`, Rust API](https://docs.rs/perspective-rs/latest/perspective_rs/)
- [`perspective`, Rust API](https://docs.rs/perspective/latest/perspective/)

### Examples

Expand All @@ -64,7 +64,6 @@ applications.
<td><a href="https://www.youtube.com/watch?v=v5Y5ftlGNhU"><img width="240" src="https://img.youtube.com/vi/v5Y5ftlGNhU/0.jpg" /></a></td>
<td><a href="https://www.youtube.com/watch?v=lDpIu4dnp78"><img width="240" src="https://img.youtube.com/vi/lDpIu4dnp78/0.jpg" /></a></td>
<td><a href="https://www.youtube.com/watch?v=IO-HJsGdleE"><img width="240" src="https://img.youtube.com/vi/IO-HJsGdleE/0.jpg" /></a></td>

</tr>
<tr>
<td><a href="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/texodus"><code>@texodus</code></a></td>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@finos/perspective-viewer-openlayers": "workspace:^",
"@finos/perspective-workspace": "workspace:^",
"@fontsource/roboto-mono": "4.5.10",
"@iarna/toml": "toml-1.0.0-rc.1",
"@playwright/test": "^1.52.0",
"@playwright/experimental-ct-react": "1.52.0",
"@types/ws": "^8.18.1",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

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

9 changes: 8 additions & 1 deletion tools/perspective-scripts/lint_headers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ async function check(is_write, pattern, comment) {

const expected_header = header_text(default_comment);
let seen_whitespace = false;
if (!contents.startsWith(expected_header)) {
// Nightly builds modify the version of metadata scripts in place to
// tag the nightly, so lint will fail if we don't make an exception
// for these files.
const is_nightly =
process.argv.indexOf("--nightly") > -1 &&
match.indexOf("Cargo.toml") > -1;

if (!contents.startsWith(expected_header) && !is_nightly) {
console.error(`Missing header in file ${match}`);
while (
contents.length > 0 &&
Expand Down
16 changes: 12 additions & 4 deletions tools/perspective-scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { Octokit } from "octokit";
import sh from "./sh.mjs";
import fs from "node:fs/promises";

import "zx/globals";

// GitHub API Wrapper
const OCTOKIT = new Octokit({
auth: process.env.GITHUB_TOKEN,
Expand Down Expand Up @@ -72,13 +74,19 @@ async function publish_release_assets(releases) {
sh`twine upload ${release.name}`.runSync();
} else if (release.name.endsWith(".tgz")) {
sh`npm publish ${release.name}`.runSync();
} else {
console.log(`Skipping "${release.name}"`);
}
}

// `node_modules` is considered dirty and we've already checked git status below.
sh`cargo publish --allow-dirty`
.cwd("rust/perspective-viewer")
.runSync();
await $`mkdir -p rust/target/package && mv *.crate rust/target/package`;

await $`cargo publish -p perspective-server --allow-dirty --no-verify`;
await $`cargo publish -p perspective-client --allow-dirty --no-verify`;
await $`cargo publish -p perspective-python --allow-dirty --no-verify`;
await $`cargo publish -p perspective-js --allow-dirty --no-verify`;
await $`cargo publish -p perspective-viewer --allow-dirty --no-verify`;
await $`cargo publish -p perspective- --allow-dirty --no-verify`;
} else {
console.warn(`COMMIT not specified, aborting`);
}
Expand Down
79 changes: 54 additions & 25 deletions tools/perspective-scripts/version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,27 @@ import { parseReleases } from "auto-changelog/src/releases.js";
import { fetchTags } from "auto-changelog/src/tags.js";
import { fetchRemote } from "auto-changelog/src/remote.js";
import sh from "./sh.mjs";
import * as toml from "@iarna/toml";

if (!process.env.GITHUB_TOKEN) {
throw new Error("Missing GITHUB_TOKEN");
}
import "zx/globals";

// if (!process.env.GITHUB_TOKEN) {
// throw new Error("Missing GITHUB_TOKEN");
// }

const IS_NIGHTLY = process.argv.indexOf("--nightly") > -1;

const PKG_VERSION = JSON.parse(fs.readFileSync("./package.json")).version.match(
/[0-9]+\.[0-9]+\.[0-9]+/
)[0];

const GIT_REV = await $`git show --no-patch --format=%ct HEAD`;

const NEW_VERSION = JSON.parse(fs.readFileSync("./package.json")).version;
console.log();

const NEW_VERSION = IS_NIGHTLY
? `${PKG_VERSION}-dev${+new Date(parseInt(GIT_REV.toString()))}`
: PKG_VERSION;

/**
* A Github data fetching cache designed to run in parallel with changelog formatting.
Expand Down Expand Up @@ -174,7 +189,7 @@ async function update_package_jsons() {
const pkg = JSON.parse(fs.readFileSync("./package.json"));
pkg.version = NEW_VERSION;
const pkg_json = `${JSON.stringify(pkg, undefined, 4)}\n`;
fs.writeFileSync("../package.json", pkg_json);
fs.writeFileSync("./package.json", pkg_json);
const packages = {};
for (const ws of pkg.workspaces) {
for (const path of glob.sync(`${ws}/package.json`, {
Expand All @@ -190,26 +205,40 @@ async function update_package_jsons() {
}
}

// for (const pkg_name of Object.keys(packages)) {
// const { pkg, path } = packages[pkg_name];
// for (const deptype of [
// "dependencies",
// "devDependencies",
// "peerDependencies",
// ]) {
// if (pkg[deptype]) {
// for (const dep of Object.keys(pkg[deptype])) {
// if (packages[dep] !== undefined) {
// pkg[deptype][dep] = `^${NEW_VERSION}`;
// }
// }
// }
// }
// const pkg_json = `${JSON.stringify(pkg, undefined, 4)}\n`;
// fs.writeFileSync(path, pkg_json);
// sh`git add ${path}`.runSync();
// }
const cargo = toml.parse(fs.readFileSync("./Cargo.toml"));
for (const pkg of cargo.workspace.members) {
const crate = toml.parse(fs.readFileSync(`./${pkg}/Cargo.toml`));
if (crate?.package.version) {
crate.package.version = NEW_VERSION;
}

for (const key of Object.keys(crate?.dependencies)) {
if (key.startsWith("perspective")) {
crate.dependencies[key].version = NEW_VERSION;
}
}
fs.writeFileSync(`./${pkg}/Cargo.toml`, toml.stringify(crate));
}

if (!IS_NIGHTLY) {
const pyproject = toml.parse(
fs.readFileSync(`./rust/perspective-python/pyproject.toml`)
);

pyproject.tool.maturin.data = `perspective_python-${NEW_VERSION}.data`;
fs.writeFileSync(
`./rust/perspective-python/pyproject.toml`,
toml.stringify(pyproject)
);
}
}

if (!IS_NIGHTLY) {
if (!process.env.GITHUB_TOKEN) {
throw new Error("Missing GITHUB_TOKEN");
}

await update_changelog();
}

await update_changelog();
await update_package_jsons();
2 changes: 1 addition & 1 deletion tools/perspective-scripts/workspace.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getRustWheelsDir() {
return rustWheelsDir;
}
export function getEmscriptenWheelPath() {
const pspVersion = getWorkspacePackageJson().version;
const pspVersion = getWorkspacePackageJson().version.replace("-", ".");
const wheeljunk = "cp39-abi3-emscripten_3_1_58_wasm32";
return path.join(
rustWheelsDir,
Expand Down
Loading