From 76aa3d1256a86924925ecc3cf282a5f5f022a1ee Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Dec 2020 13:40:03 +0100 Subject: [PATCH 1/6] Run NPM and snap builds on every push To make sure these things still build. That means we need to make the actual deploy parts optional. --- .github/workflows/deploy.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 454ff8bd..781309bc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,8 @@ name: Publish on: + push: + pull_request: release: types: [published] @@ -17,11 +19,11 @@ jobs: - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: ${{ !github.event.release.prerelease }} + if: ${{ github.event_name == 'release' && !github.event.release.prerelease }} - run: npm publish --access public --tag beta env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: ${{ github.event.release.prerelease }} + if: ${{ github.event_name == 'release' && github.event.release.prerelease }} snap: runs-on: ubuntu-latest container: snapcore/snapcraft @@ -43,7 +45,8 @@ jobs: echo ${SNAPCRAFT_LOGIN} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg env: SNAPCRAFT_LOGIN: ${{secrets.SNAPCRAFT_LOGIN}} + if: ${{ github.event_name == 'release' }} - run: snapcraft push --release=stable *.snap - if: ${{ !github.event.release.prerelease }} + if: ${{ github.event_name == 'release' && !github.event.release.prerelease }} - run: snapcraft push --release=beta *.snap - if: ${{ github.event.release.prerelease }} + if: ${{ github.event_name == 'release' && github.event.release.prerelease }} From 23249c726311bb7822aea54bdddd2ef5ab69e32f Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Dec 2020 13:40:55 +0100 Subject: [PATCH 2/6] Store result from NPM and snap builds To ease debugging. --- .github/workflows/deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 781309bc..9d52eb35 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,6 +16,10 @@ jobs: # Needs to be explicitly specified for auth to work registry-url: 'https://registry.npmjs.org' - run: npm install + - uses: actions/upload-artifact@v2 + with: + name: npm + path: lib - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} @@ -40,6 +44,10 @@ jobs: echo $VERSION sed -i "s/@VERSION@/$VERSION/g" snap/snapcraft.yaml - run: snapcraft + - uses: actions/upload-artifact@v2 + with: + name: snap + path: novnc*.snap - run: | mkdir .snapcraft echo ${SNAPCRAFT_LOGIN} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg From cd9f535eb30d3aec2148cc214a63aa6269f861e6 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Dec 2020 13:56:47 +0100 Subject: [PATCH 3/6] Package files directly in snapcraft.yaml We don't need to convert things anymore, so reference files directly in the snap yaml file. --- .github/workflows/deploy.yml | 6 ------ snap/snapcraft.yaml | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9d52eb35..ab82e56c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,12 +33,6 @@ jobs: container: snapcore/snapcraft steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - - run: npm install - - run: ./utils/use_require.js --clean --as commonjs --with-app - - run: | - cp utils/launch.sh build/launch.sh - cp snap/local/svc_wrapper.sh build/svc_wrapper.sh - run: | VERSION=$(grep '"version"' package.json | cut -d '"' -f 4) echo $VERSION diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 94886d47..b5b26a03 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -13,8 +13,24 @@ confinement: strict parts: novnc: - source: build/ + source: . plugin: dump + organize: + utils/launch.sh: / + stage: + - vnc.html + - app + - core/**/*.js + - vendor/**/*.js + - launch.sh + stage-packages: + - bash + + svc-script: + source: snap/local + plugin: dump + stage: + - svc_wrapper.sh stage-packages: - bash - jq From 4a8efa6bc9769292a4041c51636466a5e6a95dca Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Dec 2020 14:18:29 +0100 Subject: [PATCH 4/6] Use snap actions instead of the broken container The container didn't work properly for our base snap anyway. --- .github/workflows/deploy.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ab82e56c..6b0ac968 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,25 +30,27 @@ jobs: if: ${{ github.event_name == 'release' && github.event.release.prerelease }} snap: runs-on: ubuntu-latest - container: snapcore/snapcraft steps: - uses: actions/checkout@v2 - run: | VERSION=$(grep '"version"' package.json | cut -d '"' -f 4) echo $VERSION sed -i "s/@VERSION@/$VERSION/g" snap/snapcraft.yaml - - run: snapcraft + - uses: snapcore/action-build@v1 + id: snapcraft - uses: actions/upload-artifact@v2 with: name: snap - path: novnc*.snap - - run: | - mkdir .snapcraft - echo ${SNAPCRAFT_LOGIN} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg - env: - SNAPCRAFT_LOGIN: ${{secrets.SNAPCRAFT_LOGIN}} - if: ${{ github.event_name == 'release' }} - - run: snapcraft push --release=stable *.snap + path: ${{ steps.snapcraft.outputs.snap }} + - uses: snapcore/action-publish@v1 + with: + store_login: ${{ secrets.SNAPCRAFT_LOGIN }} + snap: ${{ steps.build.outputs.snap }} + release: stable if: ${{ github.event_name == 'release' && !github.event.release.prerelease }} - - run: snapcraft push --release=beta *.snap + - uses: snapcore/action-publish@v1 + with: + store_login: ${{ secrets.SNAPCRAFT_LOGIN }} + snap: ${{ steps.build.outputs.snap }} + release: beta if: ${{ github.event_name == 'release' && github.event.release.prerelease }} From 32222304f4beba73e55ef5f53c26fa322cbbced1 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Dec 2020 15:56:42 +0100 Subject: [PATCH 5/6] Remove documentation about converting the app This is no longer possible as we now require browser support for modules. --- docs/EMBEDDING.md | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/docs/EMBEDDING.md b/docs/EMBEDDING.md index 6a5dcd80..10500141 100644 --- a/docs/EMBEDDING.md +++ b/docs/EMBEDDING.md @@ -71,24 +71,6 @@ query string. Currently the following options are available: * `logging` - The console log level. Can be one of `error`, `warn`, `info` or `debug`. -## Pre-conversion of Modules - -noVNC is written using ECMAScript 6 modules. Many of the major browsers support -these modules natively, but not all. By default the noVNC application includes -a script that can convert these modules to an older format as they are being -loaded. However this process can be slow and severely increases the load time -for the application. - -It is possible to perform this conversion ahead of time, avoiding the extra -load times. To do this please follow these steps: - - 1. Install Node.js - 2. Run `npm install` in the noVNC directory - 3. Run `./utils/use_require.js --with-app --as commonjs` - -This will produce a `build/` directory that includes everything needed to run -the noVNC application. - ## HTTP Serving Considerations ### Browser Cache Issue From adfb99e7ecd8e4ae77ae76a4e24c1e4c41520982 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Dec 2020 15:57:02 +0100 Subject: [PATCH 6/6] Update conversion documentation for Node.js We now only support conversion to CommonJS, in order to support Node.js older than version 15. --- docs/LIBRARY.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/LIBRARY.md b/docs/LIBRARY.md index 63f55e8f..3890bb20 100644 --- a/docs/LIBRARY.md +++ b/docs/LIBRARY.md @@ -18,18 +18,14 @@ do things. ## Conversion of Modules -noVNC is written using ECMAScript 6 modules. Many of the major browsers support -these modules natively, but not all. They are also not supported by Node.js. To -use noVNC in these places the library must first be converted. +noVNC is written using ECMAScript 6 modules. This is not supported by older +versions of Node.js. To use noVNC with those older versions of Node.js the +library must first be converted. Fortunately noVNC includes a script to handle this conversion. Please follow the following steps: 1. Install Node.js 2. Run `npm install` in the noVNC directory - 3. Run `./utils/use_require.js --as ` - -Several module formats are available. Please run -`./utils/use_require.js --help` to see them all. The result of the conversion is available in the `lib/` directory.