Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream, include GitHub Actions to deploy PRs to staging environment #6

Merged
merged 45 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3b2a8a3
fix(volume_rendering): Volume rendering fixes for max projection - pi…
seankmartin May 18, 2024
f805b54
feat: Add a transfer function shader widget (#582)
seankmartin May 18, 2024
e7a19f5
fix: update transfer function points in JSON in all cases (#594)
seankmartin May 29, 2024
453cc01
fix(sliceview): fix picking when determinant of transform is negative
jbms May 29, 2024
22b49f9
feat: add version.json to add another way to identify deployed versio…
chrisj Jun 11, 2024
5b304a1
fix(ui): increase z-index for layer data source dropdowns, which were…
chrisj Jun 11, 2024
f1fd3b6
chore: output declaration files for neuroglancer packages (#576)
chrisj Jun 11, 2024
6a39a63
fix: with a float window the control point sorting does not error (#596)
seankmartin Jun 11, 2024
8619950
fix(datasource/graphene) merge and multicut tool fixes (#565)
chrisj Jun 11, 2024
aef3d8b
Feature - CDF in invlerp if only 3D view shown of image layer (#592)
seankmartin Jun 11, 2024
dabc3ca
fix: fix intermittent stalling/failing of chunk priority updates
jbms Jun 13, 2024
b0d3291
2.40.0
jbms Jun 20, 2024
c9081c0
Feature - adaptive downsampling of volume rendering based on framerat…
seankmartin Jul 3, 2024
90cf144
style: fix formatting
jbms Jul 22, 2024
2b56500
chore: build with NumPy 2.0
jbms Jul 23, 2024
1c2ef88
fix(python/ext): fix building with NumPy 2.0
jbms Jul 23, 2024
33f5eb5
chore(github): skip WebGL tests on macos in github actions
jbms Jul 23, 2024
d33395b
chore(examples): update example deps and disable parcel testing
jbms Jul 23, 2024
d05ed8f
chore: update dependencies
jbms Jul 23, 2024
23218f9
2.40.1
jbms Jul 23, 2024
997afee
fix(datasource/zarr) `HEAD` to get content length (#611)
d-v-b Jul 23, 2024
a8e6b49
fix(python/ext): fix building with NumPy<2
jbms Jul 23, 2024
c6d836e
docs: clean up Python API and add some docstrings
jbms Jul 22, 2024
61d9fa1
docs: Add initial sphinx documentation
jbms Jun 28, 2024
2e2811b
chore(firebase): fix firebase.json
jbms Jul 24, 2024
5c8744d
docs(github): fix build status badge in README.md
jbms Jul 24, 2024
4e378b4
feat(volume-rendering): picking, depth testing, and blending improvem…
seankmartin Jul 24, 2024
aa9efda
feat(transfer-function): show data CDF in transfer function (#607)
seankmartin Jul 24, 2024
c94650f
feat(transfer-function): add zoom via wheel as in the invlerp widget …
seankmartin Jul 24, 2024
95ff6b9
chore(deps): bump golang.org/x/net in /ngauth_server (#581)
dependabot[bot] Jul 24, 2024
6b24f98
feat(status): add modal status message option that can be closed back…
chrisj Jul 24, 2024
fce2ac8
chore(github): fix client preview deployment
jbms Jul 24, 2024
ac9be08
chore(deps-dev): bump vite (#622)
dependabot[bot] Jul 24, 2024
3efc904
chore(deps-dev): bump vite (#623)
dependabot[bot] Jul 24, 2024
7501e01
Merge upstream, include GitHub Actions to deploy PRs to staging envir…
Sep 20, 2024
4b60c02
Invoke push
Sep 20, 2024
c6e657e
Revise http error
Sep 20, 2024
aba5cb5
debug github actions pipeleine
Sep 20, 2024
c0b28c3
debug a bit more
Sep 20, 2024
065e5e0
simplify further
Sep 20, 2024
cc9dfe7
include buuidd
Sep 20, 2024
9c99efb
Simplify
Sep 20, 2024
9320b27
use short sha instead
Sep 20, 2024
d49a6df
add echo
Sep 20, 2024
c6a5ba3
resolve failing CI
Sep 20, 2024
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
5 changes: 4 additions & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
"hosting": {
"app": [
"neuroglancer"
],
"docs": [
"neuroglancer-docs"
]
}
}
},
"etags": {}
}
}
47 changes: 45 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
run: |
build_info="{'tag':'$(git describe --always --tags)', 'url':'https://github.com/google/neuroglancer/commit/$(git rev-parse HEAD)', 'timestamp':'$(date)'}"
npm run build -- --no-typecheck --no-lint --define NEUROGLANCER_BUILD_INFO="${build_info}"
echo $build_info > ./dist/client/version.json
shell: bash
- name: Build Python client bundles
run: npm run build-python -- --no-typecheck --no-lint
Expand All @@ -49,6 +50,10 @@ jobs:
- uses: ./.github/actions/setup-firefox
- name: Run JavaScript tests (including WebGL)
run: npm test
if: ${{ runner.os != 'macOS' }}
- name: Run JavaScript tests (excluding WebGL)
run: npm test -- --project node
if: ${{ runner.os == 'macOS' }}
- name: Run JavaScript benchmarks
run: npm run benchmark
- name: Upload NPM package as artifact
Expand Down Expand Up @@ -96,7 +101,7 @@ jobs:
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Install Python packaging/test tools
run: python -m pip install --upgrade pip tox nox wheel numpy -r python/requirements-test.txt
run: pip install --upgrade pip tox nox wheel numpy -r python/requirements-test.txt
- uses: ./.github/actions/setup-firefox
- run: nox -s lint format mypy
- name: Check for dirty working directory
Expand Down Expand Up @@ -173,13 +178,37 @@ jobs:
dist/*.whl
dist/*.tar.gz

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2
with:
macos-skip-brew-update: "true"
- name: Install nox
run: pip install nox
- name: Build docs
run: nox -s docs
- name: Upload docs as artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: |
dist/docs

publish-package:
# Only publish package on push to tag or default branch.
if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') }}
runs-on: ubuntu-latest
needs:
- "client"
- "python-build-package"
- "docs"
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand Down Expand Up @@ -219,12 +248,26 @@ jobs:
with:
name: client
path: dist/client
- name: Publish to Firebase hosting
- name: Publish client to Firebase hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
firebaseServiceAccount: "${{ secrets.FIREBASE_HOSTING_SERVICE_ACCOUNT_KEY }}"
projectId: neuroglancer-demo
channelId: live
target: app
# Download dist/docs after publishing to PyPI, because PyPI publish
# action fails if dist/docs directory is present.
- uses: actions/download-artifact@v4
with:
name: docs
path: dist/docs
- name: Publish docs to Firebase hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
firebaseServiceAccount: "${{ secrets.FIREBASE_HOSTING_SERVICE_ACCOUNT_KEY }}"
projectId: neuroglancer-demo
channelId: live
target: docs

ngauth:
strategy:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/build_docs_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build docs preview

on:
pull_request:

jobs:
upload:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2
with:
macos-skip-brew-update: "true"
- name: Install nox
run: pip install nox
- name: Build documentation
run: nox -s docs
- name: Upload client as artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: |
dist/docs/
67 changes: 67 additions & 0 deletions .github/workflows/deploy_docs_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy docs preview

on:
workflow_run:
workflows: ["Build docs preview"]
types: [completed]

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: "Create commit status"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commitId = "${{ github.event.workflow_run.head_commit.id }}";
await github.rest.repos.createCommitStatus({
context: "docs-preview",
owner: context.repo.owner,
repo: context.repo.repo,
sha: commitId,
state: "pending",
description: `Creating preview`,
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
});
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: docs
path: dist/docs
github-token: "${{ secrets.GITHUB_TOKEN }}"
run-id: "${{ github.event.workflow_run.id }}"
- name: Get PR ID
# https://github.com/orgs/community/discussions/25220#discussioncomment-7532132
id: pr-id
run: |
PR_ID=$(gh run view -R ${{ github.repository }} ${{ github.event.workflow_run.id }} | grep -oP '#[0-9]+ . ${{ github.event.workflow_run.id }}' | grep -oP '#[0-9]+' | cut -c 2-)
echo "pr-id=${PR_ID}" >> $GITHUB_OUTPUT
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: FirebaseExtended/action-hosting-deploy@v0
id: deploy
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_HOSTING_SERVICE_ACCOUNT_KEY }}"
expires: 30d
channelId: "pr${{ steps.pr-id.outputs.pr-id }}"
projectId: neuroglancer-demo
target: docs
- name: "Update commit status"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const expires = new Date("${{ steps.deploy.outputs.expire_time }}");
const commitId = "${{ github.event.workflow_run.head_commit.id }}";
await github.rest.repos.createCommitStatus({
context: "docs-preview",
owner: context.repo.owner,
repo: context.repo.repo,
sha: commitId,
state: "success",
target_url: "${{ steps.deploy.outputs.details_url }}",
description: `Preview created, expires at: ${expires.toISOString()}`,
});
93 changes: 37 additions & 56 deletions .github/workflows/deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,47 @@
name: Deploy preview
name: Build and Deploy Staging

on:
workflow_run:
workflows: ["Build preview"]
types: [completed]
push:
branches:
- staging
- "**"

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: "Create commit status"
uses: actions/github-script@v7
- name: Checkout Repository
uses: actions/checkout@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commitId = "${{ github.event.workflow_run.head_commit.id }}";
await github.rest.repos.createCommitStatus({
context: "client-preview",
owner: context.repo.owner,
repo: context.repo.repo,
sha: commitId,
state: "pending",
description: `Creating preview`,
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
});
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: client
path: dist/client
github-token: "${{ secrets.GITHUB_TOKEN }}"
run-id: "${{ github.event.workflow_run.id }}"
- name: Get PR ID
# https://github.com/orgs/community/discussions/25220#discussioncomment-7532132
id: pr-id
run: |
PR_ID=$(gh run view -R ${{ github.repository }} ${{ github.event.workflow_run.id }} | grep -oP '#[0-9]+ . ${{ github.event.workflow_run.id }}' | grep -oP '#[0-9]+' | cut -c 2-)
echo "pr-id=${PR_ID}" >> $GITHUB_OUTPUT
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: FirebaseExtended/action-hosting-deploy@v0
id: deploy
ref: ${{ github.event.inputs.commit_sha || github.sha }}

- name: Set short sha name for sub-directory
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Check outputs
run: echo ${{ steps.vars.outputs.sha_short }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_HOSTING_SERVICE_ACCOUNT_KEY }}"
expires: 30d
channelId: "pr${{ steps.pr-id.outputs.pr-id }}"
projectId: neuroglancer-demo
- name: "Update commit status"
uses: actions/github-script@v7
node-version: 20.x

- name: Install Dependencies
run: npm install

- name: Build Project
run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const expires = new Date("${{ steps.deploy.outputs.expire_time }}");
const commitId = "${{ github.event.workflow_run.head_commit.id }}";
await github.rest.repos.createCommitStatus({
context: "client-preview",
owner: context.repo.owner,
repo: context.repo.repo,
sha: commitId,
state: "success",
target_url: "${{ steps.deploy.outputs.details_url }}",
description: `Preview created, expires at: ${expires.toISOString()}`,
});
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Upload to S3
run: |
aws s3 sync dist/client/ ${{ secrets.CLOUDFRONT_DEPLOYMENT_LOCATION }}/staging/${{ steps.vars.outputs.sha_short }}/ --delete

- name: Display URL for Neuroglancer
run: echo "https://neuroglancer.lincbrain.org/cloudfront/frontend/staging/${{ steps.vars.outputs.sha_short }}/index.html"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ tsconfig.tsbuildinfo
.eslintcache
/lib
/.firebase
.idea/
yarn.lock
.DS_Store
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
.parcel-cache
dist
/lib
/docs/_build/
/.ruff_cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![PyPI](https://img.shields.io/pypi/v/neuroglancer)](https://pypi.org/project/neuroglancer)
![Build](https://github.com/google/neuroglancer/workflows/Build/badge.svg)
![Build](https://github.com/google/neuroglancer/actions/workflows/build.yml/badge.svg)
[![DOI](https://zenodo.org/badge/59798355.svg)](https://zenodo.org/badge/latestdoi/59798355)

Neuroglancer is a WebGL-based viewer for volumetric data. It is capable of displaying arbitrary (non axis-aligned) cross-sectional views of volumetric data, as well as 3-D meshes and line-segment based models (skeletons).
Expand Down
35 changes: 34 additions & 1 deletion build_tools/build-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,24 @@ import fs from "node:fs/promises";
import path from "node:path";
import esbuild from "esbuild";
import { glob } from "glob";
import ts from "typescript";
import yargs from "yargs";

const rootDir = path.resolve(import.meta.dirname, "..");

function buildDeclarationFiles(
fileNames: string[],
options: ts.CompilerOptions,
): void {
options = {
...options,
declaration: true,
emitDeclarationOnly: true,
};
const program = ts.createProgram(fileNames, options);
program.emit();
}

async function buildPackage(options: { inplace?: boolean }) {
const { inplace = false } = options;

Expand Down Expand Up @@ -45,13 +59,32 @@ async function buildPackage(options: { inplace?: boolean }) {
nodir: true,
});

const entryPoints = typescriptSources.map((name) =>
path.resolve(srcDir, name),
);

await esbuild.build({
entryPoints: typescriptSources.map((name) => path.resolve(srcDir, name)),
entryPoints,
outbase: srcDir,
bundle: false,
outdir: libDir,
});

let compilerOptionsFromConfigFile: ts.CompilerOptions = {};
const configFileName = ts.findConfigFile("../", ts.sys.fileExists);
if (configFileName) {
const configFile = ts.readConfigFile(configFileName, ts.sys.readFile);
compilerOptionsFromConfigFile = ts.parseJsonConfigFileContent(
configFile.config,
ts.sys,
"./",
).options;
}
buildDeclarationFiles(entryPoints, {
...compilerOptionsFromConfigFile,
outDir: libDir,
});

const otherSources = await glob(["**/*.{css,js,html,wasm}"], {
cwd: srcDir,
nodir: true,
Expand Down
Loading
Loading