From f12e71e7df4056c7b9b0455f3714cba23d218da9 Mon Sep 17 00:00:00 2001 From: ukorvl Date: Thu, 12 Oct 2023 16:02:26 +0400 Subject: [PATCH 1/4] add concurrency block to deploy test stand workflow #132 --- .github/workflows/deploy_test.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/deploy_test.yaml b/.github/workflows/deploy_test.yaml index 058c3337..ecfd254d 100644 --- a/.github/workflows/deploy_test.yaml +++ b/.github/workflows/deploy_test.yaml @@ -14,6 +14,14 @@ on: default: '' type: string +concurrency: + group: ${{ + ( github.ref == 'refs/heads/master' && + format('{0}/{1}', github.run_id, github.run_attempt) ) + || + format('{0}/{1}', github.workflow, github.ref) }} + cancel-in-progress: true + jobs: build: uses: ./.github/workflows/build.yaml From dc68519a5dc626986b991c8325edf20e79d14a3f Mon Sep 17 00:00:00 2001 From: Uriy Korotovskikh Date: Thu, 12 Oct 2023 20:32:03 +0400 Subject: [PATCH 2/4] add build in docker environment script #161 --- README.md | 28 ++++++++++++++++++++ package.json | 2 +- public/CNAME | 2 +- scripts/build.sh | 55 +++++++++++++++++++++++++++++++++++++++ scripts/docker/Dockerfile | 9 +++++++ 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100755 scripts/build.sh create mode 100644 scripts/docker/Dockerfile diff --git a/README.md b/README.md new file mode 100644 index 00000000..41f28e33 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +

=nil; Foundation Proof market interface

+ +
+ +This is web interface for proof-market built on Reactjs. + +## Table of contents + - [Dev](#dev) + - [Build](#build) + +## Dev +To run the project in development mode: +```bash +npm ci +npm start +``` + +## Build +To build the project: +```bash +./scripts/build.sh +``` +This command will install required dependencies and build static project version into the `build` directory. + +To build the project in docker environment with Node.js, add `--docker` argument: +```bash +./scripts/build.sh --docker +``` diff --git a/package.json b/package.json index 0955f2fa..c0f20bb3 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "preview": "vite preview", "prettier": "prettier --write", "lint:ts": "eslint --ext=ts,tsx src", - "lint:editorconfig": "npx editorconfig-checker", + "lint:editorconfig": "npx --yes editorconfig-checker", "prepare": "husky install", "analyze": "source-map-explorer 'build/static/js/*.js'" }, diff --git a/public/CNAME b/public/CNAME index 48430502..efcfb217 100644 --- a/public/CNAME +++ b/public/CNAME @@ -1 +1 @@ -proof.market.nil.foundation +proof.market.nil.foundation diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 00000000..5ee1e960 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +REPO_ROOT="$SCRIPT_DIR/.." + +DOCKER="docker" +DOCKER_OPTS="" + +USE_DOCKER=false +NPM_LOCAL_CACHE_DIR="$REPO_ROOT/.npm" + +build() { + cd "$REPO_ROOT" + + export npm_config_cache="$NPM_LOCAL_CACHE_DIR" + + npm ci --ignore-scripts + + npm run lint:ts + npm run build + + rm -rf "$NPM_LOCAL_CACHE_DIR" + + cd - +} + +run_build() { + if [ "$USE_DOCKER" = true ]; then + cd "$REPO_ROOT" + + $DOCKER build -t frontend-env scripts/docker + $DOCKER run $DOCKER_OPTS --rm \ + --volume ${PWD}:/home:Z \ + -u $(id -u ${USER}):$(id -g ${USER}) \ + frontend-env ./scripts/build.sh + cd - + else + build + fi +} + +while [[ "$#" -gt 0 ]]; do + case $1 in + --docker) USE_DOCKER=true ;; + *) + echo "Unknown parameter passed: $1" + exit 1 + ;; + esac + shift +done + +run_build diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile new file mode 100644 index 00000000..e7a41f6a --- /dev/null +++ b/scripts/docker/Dockerfile @@ -0,0 +1,9 @@ +# Test environment for frontend nodejs apps +FROM node:18 + +WORKDIR /home + +RUN useradd --system ${uid+--uid "$uid"} --user-group --shell /sbin/nologin --create-home --home-dir /home builder \ + && chown -R builder:builder /home + +USER builder From 58fc843448385928d7c6a725b9d3ea4b0823bb57 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Oct 2023 16:34:32 +0000 Subject: [PATCH 3/4] 0.1.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1336a4e2..f0b39847 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "proof-market.frontend", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "proof-market.frontend", - "version": "0.1.3", + "version": "0.1.4", "dependencies": { "@loadable/component": "^5.15.3", "@nilfoundation/react-components": "^0.8.3", diff --git a/package.json b/package.json index c0f20bb3..b54a2100 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "proof-market.frontend", - "version": "0.1.3", + "version": "0.1.4", "private": true, "dependencies": { "@loadable/component": "^5.15.3", From d8e97b6552db33a9e5c967a5b268ee8c247e03a3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Oct 2023 16:36:52 +0000 Subject: [PATCH 4/4] 0.1.5 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0b39847..f1d58619 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "proof-market.frontend", - "version": "0.1.4", + "version": "0.1.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "proof-market.frontend", - "version": "0.1.4", + "version": "0.1.5", "dependencies": { "@loadable/component": "^5.15.3", "@nilfoundation/react-components": "^0.8.3", diff --git a/package.json b/package.json index b54a2100..1be14a0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "proof-market.frontend", - "version": "0.1.4", + "version": "0.1.5", "private": true, "dependencies": { "@loadable/component": "^5.15.3",