From 314b2358dbf3b03957941ef7533d33dfe4b442cd Mon Sep 17 00:00:00 2001 From: Maksym Bykovskyy Date: Fri, 6 Mar 2020 17:35:14 +0000 Subject: [PATCH] Revised README --- .gitlab-ci.yml | 23 +++++++++++-------- tools/webide/README.md | 19 +++++++++++---- tools/webide/packages/client/README.md | 13 ++++++++++- .../packages/client/package-examples.js | 12 +++++----- tools/webide/packages/server/README.md | 2 +- tools/webide/packages/server/package.json | 2 +- 6 files changed, 49 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d9c9a6ad5..cbb91c5d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ stages: - build_and_package_binaries - build_docker - build_and_deploy + - ide-unit-test - ide-build - ide-e2e-test - ide-deploy @@ -23,9 +24,8 @@ dont-merge-to-master: only: - master -.build_binary: - &build_binary # To run in sequence and save CPU usage, use stage: build_and_package_binaries - stage: test +.build_binary: &build_binary + stage: test # To run in sequence and save CPU usage, use stage: build_and_package_binaries script: - $build_binary_script "$target_os_family" "$target_os" "$target_os_version" - $package_binary_script "$target_os_family" "$target_os" "$target_os_version" @@ -213,15 +213,20 @@ pages-attempt: # WEBIDE jobs run-webide-unit-tests: - stage: test - image: node:12-alpine + stage: ide-unit-test + dependencies: + - build-and-package-debian-10 + image: node:12-buster script: + - mv $(realpath dist/package/debian-10/*.deb) ligo_deb10.deb + - apt-get update && apt-get -y install libev-dev perl pkg-config libgmp-dev libhidapi-dev m4 libcap-dev bubblewrap rsync + - dpkg -i ligo_deb10.deb - cd tools/webide/packages/server - npm ci - - npm run test + - export LIGO_CMD=/bin/ligo && npm run test rules: - changes: - - tools/webide/** + - tools/webide/** when: always build-publish-ide-image: @@ -245,7 +250,7 @@ build-publish-ide-image: - docker push "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}" rules: - changes: - - tools/webide/** + - tools/webide/** when: always - if: '$CI_COMMIT_REF_NAME == "dev"' when: always @@ -260,7 +265,7 @@ run-webide-e2e-tests: - docker-compose run e2e rules: - changes: - - tools/webide/** + - tools/webide/** when: always - if: '$CI_COMMIT_REF_NAME == "dev"' when: always diff --git a/tools/webide/README.md b/tools/webide/README.md index bf9724e1a..e61ec8b7c 100644 --- a/tools/webide/README.md +++ b/tools/webide/README.md @@ -1,12 +1,23 @@ # Quick Start -Install `yarn`. -Run `yarn` to install dependencies. +1. Install `yarn` +1. Run `yarn` to install dependencies +1. Install Ligo compiler by following [Ligo installation instructions][install-ligo] +1. Go to `packages/server/` directory +1. Run `yarn start` to start the development server +1. Open http://localhost:8080 + +# Dependency on Examples + +Examples that are displayed in the Web IDE are curated from `/src/test/examples` folder and packaged during the build of the client. To add a new example to the Web IDE, first add the example file to `/src/test/examples` folder; it may live under any level of subdirectories. Then, add the path to the example to the `CURATED_EXAMPLES` array in the `packages/client/package-examples.js` script. The path has to be relative to `/src/test/examples`. ## Server -See the README under the `packages/server/` for information about how to get started on the server development. +The server source code is located under `packages/server/`. Please see README under `packages/server/` for information about how to get started on the server development. ## Client -See the README under the `packages/client/` for information about how to get started on the client development. +The client source code is located under `packages/client/`. See the README under the `packages/client/` for information about how to get started on the client development. + + +[install-ligo]: https://ligolang.org/docs/intro/installation/ diff --git a/tools/webide/packages/client/README.md b/tools/webide/packages/client/README.md index 2fa78e71b..6716f58f3 100644 --- a/tools/webide/packages/client/README.md +++ b/tools/webide/packages/client/README.md @@ -1,4 +1,15 @@ -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +# Quick Start + +```sh +yarn start +open http://localhost:3000 +``` + +Note: Some features such as compiler commands and examples will be unavailable. In order to have these features you have to start the server. See README under `../packages/server` for details. + +# Dependency on Examples + +Examples that are displayed in the Web IDE are curated from `/src/test/examples` folder and packaged during the build of the client. To add a new example to the Web IDE, first add the example file to `/src/test/examples` folder; it may live under any level of subdirectories. Then, add the path to the example to the `CURATED_EXAMPLES` array in the `packages/client/package-examples.js` script. The path has to be relative to `/src/test/examples`. ## Available Scripts diff --git a/tools/webide/packages/client/package-examples.js b/tools/webide/packages/client/package-examples.js index 04146b7f4..b6e2be960 100644 --- a/tools/webide/packages/client/package-examples.js +++ b/tools/webide/packages/client/package-examples.js @@ -4,6 +4,12 @@ const join = require('path').join; const fs = require('fs'); const YAML = require('yamljs'); +const CURATED_EXAMPLES = [ + 'cameligo/arithmetic-contract.ligo', + 'pascaligo/arithmetic-contract.ligo', + 'reasonligo/arithmetic-contract.ligo' +]; + function urlFriendlyHash(content) { const hash = createHash('md5'); hash.update(content); @@ -103,12 +109,6 @@ async function main() { // const EXAMPLES_GLOB = '**/*.ligo'; // const files = await findFiles(EXAMPLES_GLOB, EXAMPLES_DIR); - const CURATED_EXAMPLES = [ - 'cameligo/arithmetic-contract.ligo', - 'pascaligo/arithmetic-contract.ligo', - 'reasonligo/arithmetic-contract.ligo' - ]; - const EXAMPLES_DEST_DIR = join(process.cwd(), 'build', 'static', 'examples'); fs.mkdirSync(EXAMPLES_DEST_DIR, { recursive: true }); diff --git a/tools/webide/packages/server/README.md b/tools/webide/packages/server/README.md index 8eca36b66..561108456 100644 --- a/tools/webide/packages/server/README.md +++ b/tools/webide/packages/server/README.md @@ -11,7 +11,7 @@ In the project directory, you can run: ## `yarn start` -Runs the server in development mode. This will also start the client. +Runs the server in development mode. This will also build and server the client. ## `yarn test` diff --git a/tools/webide/packages/server/package.json b/tools/webide/packages/server/package.json index 9a757c7a9..d5ceac898 100644 --- a/tools/webide/packages/server/package.json +++ b/tools/webide/packages/server/package.json @@ -7,7 +7,7 @@ "prestart": "cd ../client && npm run build", "start": "nodemon -r @ts-tools/node/r -r tsconfig-paths/register ./src/index.ts", "build": "tsc", - "test": "jest" + "test": "export DATA_DIR=/tmp && jest" }, "devDependencies": { "@ts-tools/node": "^1.0.0",