Skip to content

Commit

Permalink
WIP fix
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Jul 16, 2023
1 parent e1b90be commit 389a61b
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 68 deletions.
166 changes: 155 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1595,18 +1595,162 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install yarn
run: npm install -g yarn
# TODO: `actions/upload-artifact` succedds with a warning when the
# path is empty, but `actions/downlaod-artifact` fails, and 3 JS
# packages have no `dist`.

- name: Install js dependencies
run: yarn --frozen-lockfile
env:
PSP_SKIP_EMSDK_INSTALL: 1
# - uses: actions/download-artifact@v3
# with:
# name: perspective-cli-dist
# path: packages/perspective-cli/dist

- uses: actions/download-artifact@v3
with:
name: perspective-dist
path: packages/perspective/dist/

- uses: actions/download-artifact@v3
with:
name: perspective-jupyterlab-dist
path: packages/perspective-jupyterlab/dist/

- uses: actions/download-artifact@v3
with:
name: perspective-viewer-d3fc-dist
path: packages/perspective-viewer-d3fc/dist

- uses: actions/download-artifact@v3
with:
name: perspective-viewer-datagrid-dist
path: packages/perspective-viewer-datagrid/dist

- uses: actions/download-artifact@v3
with:
name: perspective-viewer-openlayers-dist
path: packages/perspective-viewer-openlayers/dist

- uses: actions/download-artifact@v3
with:
name: perspective-workspace-dist
path: packages/perspective-workspace/dist

- uses: actions/download-artifact@v3
with:
name: perspective-viewer-dist
path: rust/perspective-viewer/dist

- name: Run publish script
run: node tools/perspective-scripts/publish.mjs
# - uses: actions/download-artifact@v3
# with:
# name: perspective-esbuild-plugin-dist
# path: packages/perspective-esbuild-plugin/dist

# - uses: actions/download-artifact@v3
# with:
# name: perspective-webpack-plugin-dist
# path: packages/perspective-webpack-plugin/dist

- uses: actions/download-artifact@v3
with:
name: nbextension-dist
path: python/perspective/perspective/nbextension

- uses: actions/download-artifact@v3
with:
name: labextension-dist
path: python/perspective/perspective/labextension

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.7

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.8

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.9

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.10

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.7

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.8

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.9

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.10

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2019-3.7

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2019-3.8

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2019-3.9

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2019-3.10

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-windows-2019-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-pyodide

- uses: actions/download-artifact@v3
with:
name: perspective-python-sdist

- name: NPM pack
run: |
npm pack \
--workspace=@finos/perspective \
--workspace=@finos/perspective-viewer \
--workspace=@finos/perspective-viewer-datagrid \
--workspace=@finos/perspective-viewer-d3fc \
--workspace=@finos/perspective-viewer-openlayers \
--workspace=@finos/perspective-workspace \
--workspace=@finos/perspective-cli \
--workspace=@finos/perspective-webpack-plugin \
--workspace=@finos/perspective-esbuild-plugin \
--workspace=@finos/perspective-jupyterlab
- name: Debug
run: ls -lah

- name: Release wheels
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
*.whl
*.tar.gz
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKFLOW_ID: ${{ github.run_id }}
COMMIT: ${{ github.sha }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ python/perspective/perspective/labextension
rust/perspective-viewer/target.vscode
target.vscode
.vscode/c_cpp_properties.json
.vscode/settings.json

# docs
website/translated_docs
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@
"webpack-dev-server": "^4.11.1"
},
"scripts": {
"postinstall": "npm-run-all postinstall:emsdk postinstall:playwright",
"postinstall": "npm-run-all postinstall:*",
"postinstall:emsdk": "node tools/perspective-scripts/install_emsdk.mjs",
"postinstall:playwright": "npx playwright install --with-deps",
"postinstall:vscode": "cp -n ./.vscode/settings.default.json ./.vscode/settings.json || true",
"build,test": "npm run --silent build && npm run --silent test",
"build_js": "node tools/perspective-scripts/build_js.mjs",
"build": "node tools/perspective-scripts/build.mjs",
Expand Down
122 changes: 66 additions & 56 deletions tools/perspective-scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import decompressUnzip from "decompress-unzip";
import { promises as fs } from "fs";
import { Octokit } from "octokit";
import readline from "readline";
import sh from "./sh.mjs";

const CURRENT_TAG = execSync("git describe --exact-match --tags")
.toString()
.trim();
const CURRENT_TAG = sh`git describe --exact-match --tags`.execSync();

// Artifacts Docs:
// https://docs.github.com/en/rest/actions/artifacts
Expand Down Expand Up @@ -216,22 +215,25 @@ if (proceed.toLowerCase() === "y") {
recursive: true,
});

const release = await octokit.request(
"POST /repos/{owner}/{repo}/releases",
{
owner: "finos",
repo: "perspective",
tag_name: CURRENT_TAG,
name: CURRENT_TAG,
body: "Release of perspective",
draft: false,
prerelease: false,
generate_release_notes: false,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
}
);
if (process.env.CI) {
console.log(`Creating GitHub Release ${CURRENT_TAG}`);
const release = await octokit.request(
"POST /repos/{owner}/{repo}/releases",
{
owner: "finos",
repo: "perspective",
tag_name: CURRENT_TAG,
name: CURRENT_TAG,
// body: "Release of perspective",
draft: true,
prerelease: false,
generate_release_notes: true,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
}
);
}

// Download the artifact folders
await Promise.all(
Expand All @@ -247,17 +249,19 @@ if (proceed.toLowerCase() === "y") {
}
);

await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
if (process.env.CI) {
await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
}

if (!artifact.name.includes("pyodide")) {
// Write out the zip file
Expand All @@ -272,27 +276,31 @@ if (proceed.toLowerCase() === "y") {
// Unzip the folders
await Promise.all(
python_dist_folders.map(async (artifact) => {
await decompress(
`${dist_folder}/${artifact.name}.zip`,
`${dist_folder}/${artifact.name}`,
{
plugins: [decompressUnzip()],
}
);
if (!artifact.name.includes("pyodide")) {
await decompress(
`${dist_folder}/${artifact.name}.zip`,
`${dist_folder}/${artifact.name}`,
{
plugins: [decompressUnzip()],
}
);
}
})
);

// Move the wheels
await Promise.all(
python_dist_folders.map(async (artifact) => {
await cp(
[`${dist_folder}/${artifact.name}/*.whl`],
`${wheel_folder}`
);
await cp(
[`${dist_folder}/${artifact.name}/*.tar.gz`],
`${wheel_folder}`
);
if (!artifact.name.includes("pyodide")) {
await cp(
[`${dist_folder}/${artifact.name}/*.whl`],
`${wheel_folder}`
);
await cp(
[`${dist_folder}/${artifact.name}/*.tar.gz`],
`${wheel_folder}`
);
}
})
);

Expand Down Expand Up @@ -326,17 +334,19 @@ if (proceed.toLowerCase() === "y") {
}
);

await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
if (process.env.CI) {
await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
}

// Write out the zip file
await fs.appendFile(
Expand Down

0 comments on commit 389a61b

Please sign in to comment.