From 469c16025a08c0c5bc5965ee5151dc7c0210152c Mon Sep 17 00:00:00 2001 From: vdovhanych Date: Tue, 31 May 2022 16:39:55 +0200 Subject: [PATCH] chore(all): update to nodejs version 16 --- .github/workflows/connect-test-params.yml | 5 ++-- .nvmrc | 2 +- docker/ci-base/Dockerfile | 34 ++++++++--------------- docker/docker-compose.suite-ci.yml | 2 ++ package.json | 2 +- shell.nix | 10 ++++--- 6 files changed, 24 insertions(+), 31 deletions(-) diff --git a/.github/workflows/connect-test-params.yml b/.github/workflows/connect-test-params.yml index 7a88e8ff1b..ae2a747930 100644 --- a/.github/workflows/connect-test-params.yml +++ b/.github/workflows/connect-test-params.yml @@ -35,9 +35,9 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn cache-dependency-path: "**/yarn.lock" - - run: sed -i "/\"node\"/d" package.json # todo: ideally do not install everything. possibly only devDependencies could be enough for testing (if there was not for building libs)? - - run: yarn install + - run: sed -i "/\"node\"/d" package.json + - run: yarn install --ignore-engines # todo: ideally reuse libs from build step - run: yarn build:libs - run: './docker/docker-connect-test.sh node -p "${{ inputs.test-pattern }}" -i ${{ inputs.methods }}' @@ -57,6 +57,7 @@ jobs: cache: yarn cache-dependency-path: "**/yarn.lock" # todo: ideally do not install everything. possibly only devDependencies could be enough for testing (if there was not for building libs)? + - run: sed -i "/\"node\"/d" package.json - run: yarn install # todo: ideally reuse libs from build step - run: yarn build:libs diff --git a/.nvmrc b/.nvmrc index 31102b28de..99cdd8009c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.18.1 +16.15.0 diff --git a/docker/ci-base/Dockerfile b/docker/ci-base/Dockerfile index 8b1e5585e2..727578bc2d 100644 --- a/docker/ci-base/Dockerfile +++ b/docker/ci-base/Dockerfile @@ -1,7 +1,7 @@ # Base ## Use a proxy or fallback to no proxy at all (direct access to Docker Hub). ARG CI_DOCKER_PROXY="" -FROM ${CI_DOCKER_PROXY}debian:buster-slim as base +FROM ${CI_DOCKER_PROXY}debian:bullseye-slim as base RUN apt-get update && \ apt-get install -y --no-install-recommends \ @@ -14,7 +14,7 @@ RUN apt-get update && \ # Docker FROM base as docker -ENV DOCKER_VERSION=19.03.12 +ENV DOCKER_VERSION=20.10.16 RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \ && mv docker-${DOCKER_VERSION}.tgz docker.tgz \ && tar xzvf docker.tgz \ @@ -23,12 +23,12 @@ RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${ # Docker Compose FROM base as docker_compose -ENV DOCKER_COMPOSE_VERSION=1.26.2 -RUN curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose +ENV DOCKER_COMPOSE_VERSION=1.29.2 +RUN curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose # Final image -# buster is for debian 10. the same version as firmware team has in its Dockerfile. -FROM ${CI_DOCKER_PROXY}node:14-buster +# bullseye is for debian 11. the same version as firmware team has in its Dockerfile. +FROM ${CI_DOCKER_PROXY}node:lts-bullseye RUN apt-get update && apt-get install -y \ build-essential \ @@ -52,7 +52,8 @@ RUN apt-get update && apt-get install -y \ # why not zip \ jq \ - rsync + rsync \ + curl RUN apt-get install -y \ python3-dev \ @@ -60,6 +61,8 @@ RUN apt-get install -y \ RUN pip3 install attrs RUN pip3 install --upgrade setuptools +# trezor ctl is not working with newer version of click +RUN pip3 install "click<8.1" RUN pip3 install trezor RUN pip3 install termcolor @@ -93,22 +96,8 @@ ENV XDG_RUNTIME_DIR "/var/tmp" ENV LC_ALL C.UTF-8 ENV LANG C.UTF-8 - -# Install NVM to manage Node versions -ENV NVM_DIR /usr/local/nvm -RUN mkdir ${NVM_DIR} -RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash - # Install and use correct version of node - should match witch Nix and .nvmrc -ENV NODE_VERSION 14.18.1 -RUN . $NVM_DIR/nvm.sh \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION \ - && nvm use default - -# add node and npm to path so the commands are available -ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules -ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH +ENV NODE_VERSION 16.15.0 # Out of the blue, we started to run into CI failures. All of them had one thing in common. # Some of our dependencies postinstall scripts tried to execute a binary in ./node_modules/.bin/ @@ -120,7 +109,6 @@ RUN yarn global add opencollective node-pre-gyp lerna # versions of local tools RUN node -v -RUN . $NVM_DIR/nvm.sh && nvm --version RUN npm -v RUN yarn -v RUN google-chrome --version diff --git a/docker/docker-compose.suite-ci.yml b/docker/docker-compose.suite-ci.yml index e7574a5498..a25fbf010d 100644 --- a/docker/docker-compose.suite-ci.yml +++ b/docker/docker-compose.suite-ci.yml @@ -31,4 +31,6 @@ services: - ../:/trezor-suite bitcoin-regtest: image: ghcr.io/trezor/trezor-user-env-regtest # this is a special image that runs regtest and blockbook + depends_on: + - trezor-user-env-unix network_mode: service:trezor-user-env-unix diff --git a/package.json b/package.json index 92c13c45ed..b98e8110cf 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "repository": "https://github.com/trezor/trezor-suite.git", "license": "SEE LICENSE IN LICENSE.md", "engines": { - "node": "14", + "node": "16", "yarn": ">=1.22.0 <2" }, "workspaces": { diff --git a/shell.nix b/shell.nix index f87445283f..2745e1e698 100644 --- a/shell.nix +++ b/shell.nix @@ -1,13 +1,15 @@ -# the last successful build of nixpkgs-unstable as of 2021-11-16 +# the last successful build of nixpkgs-unstable as of 2022-05-31 with import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/5cb226a06c49f7a2d02863d0b5786a310599df6b.tar.gz"; - sha256 = "0dzz207swwm5m0dyibhxg5psccrcqfh1lzkmzzfns27wc4ria6z3"; + url = "https://github.com/NixOS/nixpkgs/archive/b62ada430501de88dfbb08cea4eb98ead3a5e3e7.tar.gz"; + sha256 = "1ppaixbncqyvy2ixskwvzggjsw20j77iy3aqyk4749dvkx0ml27f"; }) { }; let - electron = electron_15; # use the same version as defined in packages/suite-desktop/package.json + # unstable packages + electron = electron_18; # use the same version as defined in packages/suite-desktop/package.json + nodejs = nodejs-16_x; in stdenv.mkDerivation { name = "trezor-suite-dev";