Skip to content

Commit

Permalink
merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Kanzer authored and Aaron Kanzer committed Nov 14, 2024
2 parents 5a5e399 + 10279b3 commit 8a85d9f
Show file tree
Hide file tree
Showing 50 changed files with 2,051 additions and 1,072 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Install Python packaging/test tools
run: pip install --upgrade pip tox nox wheel numpy -r python/requirements-test.txt
run: pip install 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 @@ -296,5 +296,6 @@ jobs:
- run: ./src/mesh/draco/build.sh
- run: ./src/sliceview/compresso/build.sh
- run: ./src/sliceview/png/build.sh
- run: ./src/sliceview/jxl/build.sh
# Check that there are no differences.
- run: git diff --exit-code
98 changes: 41 additions & 57 deletions .github/workflows/deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,51 @@
name: Deploy preview
name: Build and Deploy Staging

on:
workflow_run:
workflows: ["Build preview"]
types: [completed]
push:
branches:
- staging
- "**"
pull_request:
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
target: app
- 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
25 changes: 25 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# to run locally:
# docker build -f Dockerfile.dev -t <some-awesome-app-name> .
# docker run -v $(pwd):/app -p 8080:8080 --rm <some-awesome-app-name>

FROM node:20.11.1

WORKDIR /app

# Copy package.json and package-lock.json for installing dependencies
COPY package*.json ./

# Install project dependencies
RUN npm install

# Copy the rest of your app's source code from your host to your image filesystem.
COPY . .

# Install project dependencies
RUN npm i

# Vue CLI serves on port 8080 by default, expose that port
EXPOSE 8080

# Command to run the app using npm
CMD ["npm", "run", "dev-server"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,16 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

# Local Docker development

To control versioning and development on your local machine, please reference the `Dockerfile.dev` as a convenience.

To run the Dockerfile:

```shell
docker build -f Dockerfile.dev -t <some-awesome-app-name> .
docker run -v $(pwd):/app -p 8080:8080 --rm <some-awesome-app-name>
```

Hot-reloading should be present.
Loading

0 comments on commit 8a85d9f

Please sign in to comment.