Skip to content

Commit

Permalink
[FIX] Fix demo packaging (#459)
Browse files Browse the repository at this point in the history
* update tj-actions/changed-files version

* update .dockerignore to allow certain files in demo/**/data and demo/**/public dirs

* fix spatial demo runtime import error

* update yarn.lock

* fix hybrid CJS/ESM module loading edge cases, enable skipped tests

* properly clean up glfw window callbacks to fix the segfault on shutdown
  • Loading branch information
trxcllnt authored May 22, 2023
1 parent 72bb9d5 commit 5b10bc2
Show file tree
Hide file tree
Showing 25 changed files with 751 additions and 682 deletions.
43 changes: 26 additions & 17 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
**/*.tar.gz
**/*.tar.xz
**/*.zip

!**/modules/demo/**/*.png
!**/modules/demo/**/*.jpg
!**/modules/demo/**/*.gif
!**/modules/demo/**/*.las
!**/modules/demo/**/*.laz
**/*.pyc

**/lerna-debug.log
**/docker-compose*.yml
Expand All @@ -28,19 +23,20 @@

**/z-*
**/out/
**/.logs/
**/.next/
**/_next/
**/build
**/.cache
**/.ccache
**/.clangd
**/.github
**/.vscode
**/.cmake-js
**/node_modules
**/modules/**/doc
**/modules/**/lib
**/modules/**/data
**/build/
**/.cache/
**/.ccache/
**/.clangd/
**/.github/
**/.vscode/
**/.cmake-js/
**/node_modules/
**/modules/**/doc/*
**/modules/**/lib/*
**/modules/**/data/*

**/modules/*/include/napi.h
**/modules/*/include/napi-inl.h
Expand All @@ -59,3 +55,16 @@ dev/dockerfiles
.gitignore
.clang-format
.dockerignore

!**/modules/demo/**/data/*.png
!**/modules/demo/**/data/*.jpg
!**/modules/demo/**/data/*.gif
!**/modules/demo/**/data/*.las
!**/modules/demo/**/data/*.laz
!**/modules/demo/**/data/*.arrow
!**/modules/demo/**/public/*.png
!**/modules/demo/**/public/*.jpg
!**/modules/demo/**/public/*.gif
!**/modules/demo/**/public/*.las
!**/modules/demo/**/public/*.laz
!**/modules/demo/**/public/*.arrow
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-image-ssh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Check if files changed
id: files_changed
if: ${{ ! inputs.manual-build }}
uses: tj-actions/changed-files@v23.1
uses: tj-actions/changed-files@v35.4.4
with:
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }}
files: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Check if files changed
id: files_changed
if: ${{ ! inputs.manual-build }}
uses: tj-actions/changed-files@v23.1
uses: tj-actions/changed-files@v35.4.4
with:
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }}
files: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Check if source files changed
id: src_changed
uses: tj-actions/changed-files@v23.1
uses: tj-actions/changed-files@v35.4.4
with:
path: node
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }}
Expand All @@ -84,7 +84,7 @@ jobs:
- name: Check if GitHub Actions or devel main Dockerfile changed
id: dev_changed
uses: tj-actions/changed-files@v23.1
uses: tj-actions/changed-files@v35.4.4
with:
path: node
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }}
Expand Down
4 changes: 2 additions & 2 deletions modules/demo/deck/arc/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

// Copyright (c) 2020-2022, NVIDIA CORPORATION.
// Copyright (c) 2020-2023, NVIDIA CORPORATION.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@ module.exports = (glfwOptions = {
module: {path: __dirname},
});
return Object.assign(jsdom, {
loaded: jsdom.window.evalFn(async () => await import('./app.js')),
loaded: jsdom.loaded.then(() => jsdom.window.evalFn(async () => await import('./app.js'))),
});
};

Expand Down
4 changes: 2 additions & 2 deletions modules/demo/spatial/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const https = require('https');
const {writeFile} = require('fs/promises');
const {finished} = require('stream/promises');

module.exports = loadSpatialDataset;
module.exports.loadSpatialDataset = loadSpatialDataset;

if (require.main === module) { //
module.exports().catch((e) => console.error(e) || process.exit(1));
loadSpatialDataset().catch((e) => console.error(e) || process.exit(1));
}

async function loadSpatialDataset() {
Expand Down
5 changes: 2 additions & 3 deletions modules/demo/spatial/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {existsSync} from 'fs';
import {readFile as fsReadFile} from 'fs/promises';
import * as Path from 'path';

import * as loadSpatialDataset from './data';
import {loadSpatialDataset} from './data';

/**
* @param {Map<number, [number, number, number, number]>} colorMap
Expand Down Expand Up @@ -148,8 +148,7 @@ export async function loadPoints() {
return table;
} catch (e) {
if (loadDatasetIfNotFound) {
console.error(e);
console.log('dataset not found, now downloading...');
console.log('Point data not found, downloading now...');
return await loadSpatialDataset().then(() => loadPointsTable(false))
}
console.error(`
Expand Down
4 changes: 2 additions & 2 deletions modules/glfw/src/callbacks.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2021, NVIDIA CORPORATION.
// Copyright (c) 2020-2023, NVIDIA CORPORATION.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -277,7 +277,7 @@ void GLFWdrop_cb(GLFWwindow* window, int count, const char** paths) {

}; // namespace

GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
// GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
void glfwSetErrorCallback(Napi::CallbackInfo const& info) {
auto env = info.Env();
if (info[0].IsFunction()) {
Expand Down
5 changes: 4 additions & 1 deletion modules/glfw/src/glfw.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022, NVIDIA CORPORATION.
// Copyright (c) 2020-2023, NVIDIA CORPORATION.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,9 @@ export const GLFW: any =
require('bindings')(isHeadless ? 'rapidsai_glfw_eglheadless.node' : 'rapidsai_glfw_x11.node')
.init(CORE);

process?.on && process?.on('exit', () => GLFW.terminate());
process?.on && process?.on('beforeExit', () => GLFW.terminate());

export default GLFW;

export type GLFWmonitor = number;
Expand Down
2 changes: 2 additions & 0 deletions modules/jsdom/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"program": "${workspaceFolder}/node_modules/.bin/jest",
"skipFiles": [
// "<node_internals>/**",
"<node_internals>/**/fs/utils",
// "${workspaceFolder}/node_modules/**"
],
"env": {
Expand All @@ -38,6 +39,7 @@
"program": "test/test-import.js",
"skipFiles": [
// "<node_internals>/**",
"<node_internals>/**/fs/utils",
// "${workspaceFolder}/node_modules/**"
],
"env": {
Expand Down
Loading

0 comments on commit 5b10bc2

Please sign in to comment.