diff --git a/.circleci/config.yml b/.circleci/config.yml index e2e90d64d5..d01ba41737 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,13 +48,6 @@ jobs: command: | yarn run lint:clj:library - - run: - name: "lint scss on frontend" - working_directory: "./frontend" - command: | - yarn install - yarn run lint:scss - test-common: docker: - image: penpotapp/devenv:latest @@ -72,7 +65,7 @@ jobs: # Download and cache dependencies - restore_cache: keys: - - v1-dependencies-{{ checksum "common/deps.edn"}} + - v1-dependencies-{{ checksum "common/deps.edn"}}-{{ checksum "common/yarn.lock" }} - run: name: "JVM tests" @@ -90,7 +83,10 @@ jobs: - save_cache: paths: - ~/.m2 - key: v1-dependencies-{{ checksum "common/deps.edn"}} + - ~/.yarn + - ~/.gitlibs + - ~/.cache/ms-playwright + key: v1-dependencies-{{ checksum "common/deps.edn"}}-{{ checksum "common/yarn.lock" }} test-frontend: docker: @@ -109,19 +105,27 @@ jobs: # Download and cache dependencies - restore_cache: keys: - - v1-dependencies-{{ checksum "frontend/deps.edn"}} + - v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }} + + - run: + name: "lint scss on frontend" + working_directory: "./frontend" + command: | + yarn install + yarn run lint:scss - run: name: "unit tests" working_directory: "./frontend" command: | - yarn install yarn run test - save_cache: paths: - ~/.m2 - key: v1-dependencies-{{ checksum "frontend/deps.edn"}} + - ~/.yarn + - ~/.gitlibs + key: v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }} test-components: docker: @@ -140,14 +144,14 @@ jobs: # Download and cache dependencies - restore_cache: keys: - - v1-dependencies-{{ checksum "frontend/deps.edn"}} + - v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }} - run: name: Install dependencies working_directory: "./frontend" command: | yarn install - yarn run playwright install --with-deps chromium + yarn run playwright install chromium - run: name: Build Storybook @@ -179,7 +183,7 @@ jobs: # Download and cache dependencies - restore_cache: keys: - - v1-dependencies-{{ checksum "frontend/deps.edn"}} + - v1-dependencies-{{ checksum "frontend/deps.edn"}}-{{ checksum "frontend/yarn.lock" }} - run: name: "integration tests" @@ -189,7 +193,7 @@ jobs: yarn run build:app:assets yarn run build:app yarn run build:app:libs - yarn run playwright install --with-deps chromium + yarn run playwright install chromium yarn run test:e2e -x --workers=4 test-backend: @@ -231,6 +235,7 @@ jobs: - save_cache: paths: - ~/.m2 + - ~/.gitlibs key: v1-dependencies-{{ checksum "backend/deps.edn" }} test-render-wasm: @@ -272,10 +277,12 @@ workflows: - test-components: requires: + - test-frontend: success - lint: success - test-integration: requires: + - test-frontend: success - lint: success - test-backend: diff --git a/docker/devenv/Dockerfile b/docker/devenv/Dockerfile index d9105fbe49..e6cb2a61bb 100644 --- a/docker/devenv/Dockerfile +++ b/docker/devenv/Dockerfile @@ -19,11 +19,7 @@ RUN set -ex; \ echo "nameserver 8.8.8.8" > /etc/resolvconf/resolv.conf.d/tail; \ apt-get -qq update; \ apt-get -qqy install --no-install-recommends \ - build-essential \ - openssh-client \ - redis-tools \ locales \ - gnupg2 \ ca-certificates \ wget \ sudo \ @@ -32,19 +28,13 @@ RUN set -ex; \ curl \ bash \ git \ - rlwrap \ - unzip \ - rsync \ - fakeroot \ - file \ - less \ - jq \ - nginx \ ; \ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \ locale-gen; \ rm -rf /var/lib/apt/lists/*; +COPY files/apt.sources /etc/apt/sources.list.d/ubuntu.sources + RUN set -ex; \ usermod -l penpot -d /home/penpot -G users -s /bin/bash ubuntu; \ passwd penpot -d; \ @@ -53,6 +43,19 @@ RUN set -ex; \ RUN set -ex; \ apt-get -qq update; \ apt-get -qqy install --no-install-recommends \ + build-essential \ + openssh-client \ + redis-tools \ + gnupg2 \ + rlwrap \ + unzip \ + rsync \ + fakeroot \ + file \ + less \ + jq \ + nginx \ + \ python3 \ python3-tabulate \ imagemagick \ @@ -97,6 +100,23 @@ RUN set -ex; \ libgbm1 \ xvfb \ libfontconfig-dev \ + \ + fonts-noto-color-emoji \ + fonts-unifont \ + libfreetype6 \ + xfonts-cyrillic \ + xfonts-scalable \ + fonts-ipafont-gothic \ + fonts-wqy-zenhei \ + fonts-tlwg-loma-otf \ + fonts-freefont-ttf \ + libasound2t64 \ + libatk-bridge2.0-0t64 \ + libatk1.0-0t64 \ + libatspi2.0-0t64 \ + libcups2t64 \ + libdrm2 \ + libxkbcommon0 \ ; \ rm -rf /var/lib/apt/lists/*; @@ -159,7 +179,6 @@ RUN set -eux; \ tar -xf /tmp/nodejs.tar.gz --strip-components=1; \ chown -R root /usr/local/nodejs; \ corepack enable; \ - npx playwright install --with-deps chromium; \ rm -rf /tmp/nodejs.tar.gz; RUN set -ex; \ @@ -241,10 +260,10 @@ RUN set -ex; \ mv /tmp/mc /usr/local/bin/; \ chmod +x /usr/local/bin/mc; +WORKDIR /home + # Install Rust toolchain -ENV RUSTUP_HOME=/usr/local/rustup \ - CARGO_HOME=/usr/local/cargo \ - PATH=/usr/local/cargo/bin:$PATH; +ENV PATH=/home/cargo/bin:$PATH RUSTUP_HOME=/home/rustp CARGO_HOME=/home/cargo RUN set -eux; \ # Same steps as in Rust official Docker image https://github.com/rust-lang/docker-rust/blob/9f287282d513a84cb7c7f38f197838f15d37b6a9/1.81.0/bookworm/Dockerfile @@ -254,27 +273,19 @@ RUN set -eux; \ arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac; \ - url="https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${rustArch}/rustup-init"; \ - wget "$url"; \ + wget "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${rustArch}/rustup-init"; \ echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ chmod +x rustup-init; \ ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ rm rustup-init; \ - chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ rustup component add rustfmt; \ - rustup component add clippy; - -WORKDIR /usr/local - -# Install emscripten SDK and activate it -RUN set -eux; \ - git clone https://github.com/emscripten-core/emsdk.git; \ - cd emsdk; \ - ./emsdk install $EMSCRIPTEN_VERSION; \ - ./emsdk activate $EMSCRIPTEN_VERSION; \ - rustup target add wasm32-unknown-emscripten; - -WORKDIR /home + rustup component add clippy; \ + git clone https://github.com/emscripten-core/emsdk.git; \ + cd emsdk; \ + ./emsdk install $EMSCRIPTEN_VERSION; \ + ./emsdk activate $EMSCRIPTEN_VERSION; \ + rustup target add wasm32-unknown-emscripten; \ + cargo install cargo-watch; COPY files/nginx.conf /etc/nginx/nginx.conf COPY files/nginx-mime.types /etc/nginx/mime.types diff --git a/docker/devenv/files/apt.sources b/docker/devenv/files/apt.sources new file mode 100644 index 0000000000..c60cdbafbb --- /dev/null +++ b/docker/devenv/files/apt.sources @@ -0,0 +1,20 @@ +Types: deb +URIs: http://mirror.kumi.systems/ubuntu/ +Suites: noble noble-updates noble-backports +Components: main universe restricted multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg +Architectures: amd64 + +Types: deb +URIs: http://mirror.kumi.systems/ubuntu-ports/ +Suites: noble noble-updates noble-backports +Components: main universe restricted multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg +Architectures: arm64 + +Types: deb +URIs: http://security.ubuntu.com/ubuntu/ +Suites: noble-security +Components: main universe restricted multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg +Architectures: amd64 diff --git a/docker/devenv/files/bashrc b/docker/devenv/files/bashrc index f7540b67b7..c55b214c78 100644 --- a/docker/devenv/files/bashrc +++ b/docker/devenv/files/bashrc @@ -1,9 +1,7 @@ #!/usr/bin/env bash export JAVA_OPTS=${JAVA_OPTS:-"-Xmx1000m -Xms200m"}; -export PATH=/usr/lib/jvm/openjdk/bin:/usr/local/nodejs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin -EMSDK_QUIET=1 . /usr/local/emsdk/emsdk_env.sh; -source /usr/local/cargo/env +EMSDK_QUIET=1 . /home/emsdk/emsdk_env.sh; alias l='ls --color -GFlh' alias rm='rm -r' diff --git a/docker/devenv/files/entrypoint.sh b/docker/devenv/files/entrypoint.sh index 9754942190..77486ebd6b 100755 --- a/docker/devenv/files/entrypoint.sh +++ b/docker/devenv/files/entrypoint.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e -usermod -u ${EXTERNAL_UID:-1000} penpot + +usermod -u ${EXTERNAL_UID:-1000} penpot; exec "$@" diff --git a/docker/devenv/files/init.sh b/docker/devenv/files/init.sh index c3ac05eb19..55dbfeeff8 100755 --- a/docker/devenv/files/init.sh +++ b/docker/devenv/files/init.sh @@ -4,6 +4,7 @@ cp /root/.bashrc /home/penpot/.bashrc cp /root/.vimrc /home/penpot/.vimrc cp /root/.tmux.conf /home/penpot/.tmux.conf chown -R penpot:users /home/penpot +chown -R penpot:users /home/cargo; set -e nginx diff --git a/docker/devenv/files/nginx.conf b/docker/devenv/files/nginx.conf index c24c2c7685..7b217193d8 100644 --- a/docker/devenv/files/nginx.conf +++ b/docker/devenv/files/nginx.conf @@ -138,6 +138,10 @@ http { proxy_pass http://127.0.0.1:6070/inbox; } + location /payments { + proxy_pass http://127.0.0.1:5000; + } + location /playground { alias /home/penpot/penpot/experiments/; add_header Cache-Control "no-cache, max-age=0"; diff --git a/docker/devenv/files/start-tmux.sh b/docker/devenv/files/start-tmux.sh index f3c7180ad6..16dbbdb9e2 100755 --- a/docker/devenv/files/start-tmux.sh +++ b/docker/devenv/files/start-tmux.sh @@ -10,12 +10,10 @@ echo "[start-tmux.sh] Installing node dependencies" pushd ~/penpot/frontend/ corepack install; yarn install; -yarn run playwright install --with-deps chromium popd pushd ~/penpot/exporter/ corepack install; yarn install -yarn run playwright install --with-deps chromium popd tmux -2 new-session -d -s penpot