Skip to content

Commit

Permalink
Merge pull request #1 from willend/mcstas-mcxtrace-3.5
Browse files Browse the repository at this point in the history
Update for McStas McXtrace 3.5.16
  • Loading branch information
willend authored Dec 16, 2024
2 parents 315d0be + 3c327c3 commit 9be7d29
Show file tree
Hide file tree
Showing 282 changed files with 1,461 additions and 165,502 deletions.
30 changes: 30 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["eslint:recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: [],
rules: {
"no-unused-vars": ["error", { args: "after-used" }],
},
ignorePatterns: [
"jupyter_remote_desktop_proxy/static/dist/**",
"webpack.config.js",
],
};
7 changes: 7 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ updates:
interval: monthly
time: "05:00"
timezone: Etc/UTC

# Bump dockerfile FROM
- package-ecosystem: docker
directory: /
labels: [dependencies]
schedule:
interval: monthly
2 changes: 1 addition & 1 deletion .github/workflows/binder-badge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
pull-requests: write

steps:
- uses: manics/action-binderbadge@v2.0.0
- uses: manics/action-binderbadge@v3.0.0
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
77 changes: 77 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,83 @@ jobs:
python -m build --sdist --wheel .
ls -l dist
- name: test to see if built js file is in the package
run: |
tar -tvf dist/*.tar.gz | grep dist/viewer.js
unzip -l dist/*.whl | grep dist/viewer.js
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/')

publish-images:
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
include:
- vncserver: tigervnc
- vncserver: turbovnc

steps:
- uses: actions/checkout@v4

- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx (for multi-arch builds)
uses: docker/setup-buildx-action@v3

- name: Make decisions on pushing and suffix (based on vnc server chosen)
id: decisions
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then
echo "push=true" >> $GITHUB_OUTPUT
else
echo "push=false" >> $GITHUB_OUTPUT
fi
# We provide image tags with -tigervnc and -turbovnc suffixes to allow
# for an explicit choice, but also ship with a default choice of
# TigerVNC.
if [ "${{ matrix.vncserver == 'tigervnc' }}" == "true" ]; then
echo 'suffix="",-${{ matrix.vncserver }}' >> $GITHUB_OUTPUT
else
echo "suffix=-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT
fi
# For builds triggered by a git tag 1.2.3, we calculate image tags like:
# [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest]
#
# More details at
# https://github.com/jupyterhub/action-major-minor-tag-calculator.
#
- name: Get image tags
id: tags
uses: jupyterhub/action-major-minor-tag-calculator@v3
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
prefix: "quay.io/jupyterhub/jupyter-remote-desktop-proxy:"
suffix: ${{ steps.decisions.outputs.suffix }}
branchRegex: ^\w[\w-.]*$
defaultTag: quay.io/jupyterhub/jupyter-remote-desktop-proxy:noref

- name: Login to container registry
# Credentials to Quay.io was setup by...
# 1. Creating a [Robot Account](https://quay.io/organization/jupyterhub?tab=robots)
# 2. Giving it push permissions to the image repository
# 3. Adding Robot Account credentials as workflow environment secrets
if: steps.decisions.outputs.push == 'true'
run: |
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Build and push image
uses: docker/build-push-action@v6
with:
build-args: |
vncserver=${{ matrix.vncserver }}
context: .
platforms: linux/amd64,linux/arm64
push: ${{ steps.decisions.outputs.push }}
tags: ${{ join(fromJson(steps.tags.outputs.tags)) }}
105 changes: 97 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,112 @@ on:
tags: ["**"]
workflow_dispatch:

defaults:
run:
# Both TigerVNC and TurboVNC reports "the input device is not a TTY" if
# started without a TTY. GitHub Actions environments doesn't come with one,
# so this provides one.
#
# ref: https://github.com/actions/runner/issues/241#issuecomment-842566950
#
shell: script --quiet --return --log-out /dev/null --command "bash -e {0}"

jobs:
container:
image-test:
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- vncserver: tigervnc
- vncserver: turbovnc

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Cache playwright binaries
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright

- name: Build image
run: |
docker build -t jupyter-remote-desktop-proxy .
docker build --progress=plain --build-arg vncserver=${{ matrix.vncserver }} -t test .
- name: (inside container) vncserver -help
run: |
# -help flag is not available for TurboVNC, but it emits the -help
# equivalent information anyhow if passed -help, but also errors. Due
# to this, we fallback to use the errorcode of vncsrever -list.
docker run test bash -c "vncserver -help || vncserver -list > /dev/null"
- name: Test vncserver
run: |
container_id=$(docker run -d -it -p 5901:5901 test vncserver -xstartup /opt/install/jupyter_remote_desktop_proxy/share/xstartup -verbose -fg -geometry 1680x1050 -SecurityTypes None -rfbport 5901)
sleep 1
echo "::group::Install netcat, a test dependency"
docker exec --user root $container_id bash -c '
apt update
apt install -y netcat-openbsd
'
echo "::endgroup::"
docker exec -it $container_id timeout --preserve-status 1 nc -v localhost 5901 2>&1 | tee -a /dev/stderr | \
grep --quiet RFB && echo "Passed test" || { echo "Failed test" && TEST_OK=false; }
echo "::group::vncserver logs"
docker exec $container_id bash -c 'cat ~/.vnc/*.log'
echo "::endgroup::"
docker stop $container_id > /dev/null
if [ "$TEST_OK" == "false" ]; then
echo "Test failed!"
exit 1
fi
- name: Install playwright
run: |
python -mpip install -r dev-requirements.txt
python -mplaywright install --with-deps
- name: Smoke test image
- name: Playwright browser test
run: |
docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy
sleep 10
curl 'http://localhost:8888/desktop/?token=secret' | grep 'Modified from novnc_lite.html example in noVNC'
container_id=$(docker run -d -it -p 8888:8888 -e JUPYTER_TOKEN=secret test)
sleep 3
export CONTAINER_ID=$container_id
export JUPYTER_HOST=http://localhost:8888
export JUPYTER_TOKEN=secret
export VNCSERVER=${{ matrix.vncserver }}
python -mpytest -vs
echo "::group::jupyter_server logs"
docker logs $container_id
echo "::endgroup::"
echo "::group::vncserver logs"
docker exec $container_id bash -c 'cat ~/.vnc/*.log'
echo "::endgroup::"
timeout 5 docker stop $container_id > /dev/null && echo "Passed SIGTERM test" || { echo "Failed SIGTERM test" && TEST_OK=false; }
if [ "$TEST_OK" == "false" ]; then
echo "One or more tests failed!"
exit 1
fi
# TODO: Check VNC desktop works, e.g. by comparing Playwright screenshots
# https://playwright.dev/docs/test-snapshots
- name: Upload screenshot
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots-${{ matrix.vncserver }}
path: screenshots/*
if-no-files-found: error
139 changes: 139 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Extra ignore patterns specific to this project
# Installed JS libraries
node_modules/
# Built JS files
jupyter_remote_desktop_proxy/static/dist

# Standard python gitignore patterns
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Additional ignores
screenshots/
Loading

0 comments on commit 9be7d29

Please sign in to comment.