From 293d078650b3bb86cc0c75cca045906af437ff69 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 3 May 2023 16:58:03 +0200 Subject: [PATCH 001/154] Debug CircleCi --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4c4e21f453b..1fa2b0d8086 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -183,6 +183,11 @@ jobs: root: . paths: - . + + - run: + name: Debug + command: | + tail -f /dev/null lint-checks: <<: *defaults From 92fece73b3846dea678809fe2ca0bd13d11f4ca7 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 3 May 2023 17:03:55 +0200 Subject: [PATCH 002/154] Force worflow failure --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1fa2b0d8086..ee0ea856572 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -187,7 +187,7 @@ jobs: - run: name: Debug command: | - tail -f /dev/null + exit 1 lint-checks: <<: *defaults From 1ba698b59d8162a790857867654e4edf9263763c Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:34:12 +0200 Subject: [PATCH 003/154] GitHub actions migration wip --- .github/workflows/circleci.yml | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/circleci.yml diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml new file mode 100644 index 00000000000..58507fdc793 --- /dev/null +++ b/.github/workflows/circleci.yml @@ -0,0 +1,70 @@ +name: celo-monorepo +run-name: celo-monorepo tests + +on: + push: + branches: + - jcortejoso/circleci-github-actions + pull_request: + branches: + - master + +defaults: + run: + working-directory: ~/app + shell: /bin/bash --login -eo pipefail + +env: + # Increment these to force cache rebuilding + NODE_MODULE_CACHE_VERSION: 1 + NODE_OPTIONS: '--max-old-space-size=4096' + TERM: dumb + GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"' + +jobs: + install_dependencies: + name: Install dependencies + # TODO(jcortejoso): Move to a self-hosted runner + runs-on: ubuntu-latest + steps: + - name: Restore .git cache + uses: actions/cache@v3 + id: cache + with: + path: .git + key: git-${{ github.ref }} + restore-keys: | + git- + - uses: actions/checkout@v3 + - name: Verify setup for incremental testing + run: | + set -euo pipefail + cd ~/app + set -v + # To get the "master" branch mapping + git checkout master + git checkout ${GITHUB_REF} + # Verify that following commands work, they are later called in the incremental testing script + # There output does not matter here, the fact that they finish successfully does. + git rev-parse --abbrev-ref HEAD + git fetch --all --tags + - name: Install yarn dependencies + run: yarn install + - name: Build packages + run: yarn build --ignore docs --include-dependencies + - name: Check licenses + run: | + if [ ! -e ~/.tmp/yarn_deps_have_changed ]; then + # Internally `yarn check-licenses` downloads dependencies into its cache again even if node_modules are up-to-date + # which happens when we've restored our cached node_modules. + # Making `yarn check-licenses` take ~45secs instead of ~3secs (depending on network conditions and build machine) + # So here we skip checking when it's unnecessary + echo "Skipping checking licenses, dependencies haven't changed" + exit 0 + fi + yarn check-licenses + - name: Store building artifacts + uses: actions/upload-artifact@v3 + with: + name: workspace + path: ~/app From f0d041d8fbfb1b6d45f48d616516fc2bcd2d45ca Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:39:41 +0200 Subject: [PATCH 004/154] Changed default shell --- .github/workflows/circleci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 58507fdc793..9194b666a1b 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -12,7 +12,9 @@ on: defaults: run: working-directory: ~/app - shell: /bin/bash --login -eo pipefail + # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest + # shell: /bin/bash --login -eo pipefail + shell: /bin/sh -e env: # Increment these to force cache rebuilding From 6da8441c8be4f3a68612410248a35d2c7ad982a8 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:42:10 +0200 Subject: [PATCH 005/154] debug --- .github/workflows/circleci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9194b666a1b..9a77a97b7ea 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -13,8 +13,8 @@ defaults: run: working-directory: ~/app # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest - # shell: /bin/bash --login -eo pipefail - shell: /bin/sh -e + shell: /bin/bash --login -eo pipefail + # shell: /bin/sh -e env: # Increment these to force cache rebuilding @@ -38,6 +38,11 @@ jobs: restore-keys: | git- - uses: actions/checkout@v3 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + with: + limit-access-to-actor: true - name: Verify setup for incremental testing run: | set -euo pipefail From 4cc6e1a348029f793d3fb737cc69aee40e1f2e56 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:46:42 +0200 Subject: [PATCH 006/154] debug --- .github/workflows/circleci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9a77a97b7ea..693c80fafd3 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -5,9 +5,9 @@ on: push: branches: - jcortejoso/circleci-github-actions - pull_request: - branches: - - master + # pull_request: + # branches: + # - master defaults: run: @@ -41,10 +41,12 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 + if: false with: limit-access-to-actor: true - name: Verify setup for incremental testing run: | + echo $0 set -euo pipefail cd ~/app set -v From 1bf5c978ebe87217abe3235f2a71cc794b1697aa Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:48:17 +0200 Subject: [PATCH 007/154] debug --- .github/workflows/circleci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 693c80fafd3..1bee75486ec 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -46,8 +46,8 @@ jobs: limit-access-to-actor: true - name: Verify setup for incremental testing run: | - echo $0 - set -euo pipefail + # echo $0 + # set -euo pipefail cd ~/app set -v # To get the "master" branch mapping From 865244516c279e17990cb20bd07f6f2c80aff09a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:51:02 +0200 Subject: [PATCH 008/154] debug --- .github/workflows/circleci.yml | 4 ++-- .github/workflows/protocol_tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 1bee75486ec..1c683aa03a5 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -13,8 +13,8 @@ defaults: run: working-directory: ~/app # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest - shell: /bin/bash --login -eo pipefail - # shell: /bin/sh -e + # shell: /bin/bash --login -eo pipefail + shell: /bin/sh -e -u env: # Increment these to force cache rebuilding diff --git a/.github/workflows/protocol_tests.yml b/.github/workflows/protocol_tests.yml index b28f036eb56..419a031ab14 100644 --- a/.github/workflows/protocol_tests.yml +++ b/.github/workflows/protocol_tests.yml @@ -1,5 +1,5 @@ name: Protocol Foundry tests -on: [push, pull_request] +# on: [push, pull_request] jobs: check: From 92e8dacf2c8121a10f6d6f6908addbc1a061c4b8 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:52:46 +0200 Subject: [PATCH 009/154] debug --- .github/workflows/circleci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 1c683aa03a5..c9ab483f55c 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -13,8 +13,8 @@ defaults: run: working-directory: ~/app # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest - # shell: /bin/bash --login -eo pipefail - shell: /bin/sh -e -u + # shell: bash --login -eo pipefail + shell: sh -e -u env: # Increment these to force cache rebuilding From 932e38a3257347dcb698f89c059d0daad4c51c07 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 11:54:59 +0200 Subject: [PATCH 010/154] debug --- .github/workflows/circleci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index c9ab483f55c..a843d3cb522 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -13,8 +13,8 @@ defaults: run: working-directory: ~/app # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest - # shell: bash --login -eo pipefail - shell: sh -e -u + shell: bash --login -eo pipefail {0} + # shell: sh -e -u {0} env: # Increment these to force cache rebuilding From a898ecb2a2ae6c14273456cb85a488067a0f6810 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 12:44:32 +0200 Subject: [PATCH 011/154] debug --- .github/workflows/circleci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index a843d3cb522..00dc6aaeb12 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -11,7 +11,7 @@ on: defaults: run: - working-directory: ~/app + # working-directory: ~/app # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest shell: bash --login -eo pipefail {0} # shell: sh -e -u {0} @@ -46,9 +46,7 @@ jobs: limit-access-to-actor: true - name: Verify setup for incremental testing run: | - # echo $0 - # set -euo pipefail - cd ~/app + set -euo pipefail set -v # To get the "master" branch mapping git checkout master From b865f59f5b7ff6f59f315c314a3ab2a3f9439046 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 12:45:23 +0200 Subject: [PATCH 012/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 00dc6aaeb12..4603532cd27 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -41,7 +41,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: false + if: true with: limit-access-to-actor: true - name: Verify setup for incremental testing From d16e121de2bc86805c960c4faad797359a58e5d5 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 12:49:45 +0200 Subject: [PATCH 013/154] debug --- .github/workflows/circleci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4603532cd27..ce4a32f3972 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -38,10 +38,12 @@ jobs: restore-keys: | git- - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: true + if: false with: limit-access-to-actor: true - name: Verify setup for incremental testing From 056ce977bec76b56507743c422de648e2bb7de20 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 15:13:56 +0200 Subject: [PATCH 014/154] debug --- .github/workflows/circleci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index ce4a32f3972..6484bf48abf 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -26,8 +26,8 @@ env: jobs: install_dependencies: name: Install dependencies - # TODO(jcortejoso): Move to a self-hosted runner runs-on: ubuntu-latest + # runs-on: ["self-hosted", "monorepo"] steps: - name: Restore .git cache uses: actions/cache@v3 @@ -57,6 +57,10 @@ jobs: # There output does not matter here, the fact that they finish successfully does. git rev-parse --abbrev-ref HEAD git fetch --all --tags + - name: Install dependencies (temporal) + run: | + apt-get update + apt-get install -y python2 - name: Install yarn dependencies run: yarn install - name: Build packages @@ -76,4 +80,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: workspace - path: ~/app + path: ./ From a2529eefda9fde7ac541209fcb977a908750a0cd Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 15:28:56 +0200 Subject: [PATCH 015/154] debug --- .github/workflows/circleci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 6484bf48abf..74f8624464f 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -59,8 +59,8 @@ jobs: git fetch --all --tags - name: Install dependencies (temporal) run: | - apt-get update - apt-get install -y python2 + sudo apt-get update + sudo apt-get install -y python2 - name: Install yarn dependencies run: yarn install - name: Build packages From e2020ff49971a54a279510f27b42da9cc57133af Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 15:33:41 +0200 Subject: [PATCH 016/154] debug --- .github/workflows/circleci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 74f8624464f..332727fc0df 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -61,6 +61,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y python2 + sudo apt-get install lsb-release libudev-dev libusb-dev libusb-1.0-0 -y - name: Install yarn dependencies run: yarn install - name: Build packages From 9c1b342f293b7a6b2fefd1307150a9592caff8a0 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 15:44:07 +0200 Subject: [PATCH 017/154] debug --- .github/workflows/circleci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 332727fc0df..308f0eacd9f 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -62,6 +62,10 @@ jobs: sudo apt-get update sudo apt-get install -y python2 sudo apt-get install lsb-release libudev-dev libusb-dev libusb-1.0-0 -y + curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - + sudo apt-get install -y nodejs + sudo npm install -g yarn + - name: Install yarn dependencies run: yarn install - name: Build packages From 4f251fb75682b11b1afea4127a8dbd08b7a68c02 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 15:53:39 +0200 Subject: [PATCH 018/154] debug --- .github/workflows/circleci.yml | 2 +- .github/workflows/protocol_tests.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 308f0eacd9f..f5bd8797508 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -26,7 +26,7 @@ env: jobs: install_dependencies: name: Install dependencies - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # runs-on: ["self-hosted", "monorepo"] steps: - name: Restore .git cache diff --git a/.github/workflows/protocol_tests.yml b/.github/workflows/protocol_tests.yml index 419a031ab14..9bcc4fb94cf 100644 --- a/.github/workflows/protocol_tests.yml +++ b/.github/workflows/protocol_tests.yml @@ -1,5 +1,7 @@ name: Protocol Foundry tests # on: [push, pull_request] +# TODO(jcortejoso): Delete +on: [workflow_call] jobs: check: @@ -7,7 +9,7 @@ jobs: run: working-directory: packages/protocol name: Run tests - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: From 5e9e52ecc5ee275093fd080273904df8fb98a8ee Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 15:58:26 +0200 Subject: [PATCH 019/154] debug --- .github/workflows/circleci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f5bd8797508..ed2ebe5aef4 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -40,12 +40,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 10 - if: false - with: - limit-access-to-actor: true - name: Verify setup for incremental testing run: | set -euo pipefail @@ -65,7 +59,12 @@ jobs: curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - sudo apt-get install -y nodejs sudo npm install -g yarn - + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: true + with: + limit-access-to-actor: true - name: Install yarn dependencies run: yarn install - name: Build packages From 8d4da7e3e2d8d2a0d727e679923ed8c204c8774d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 16:12:10 +0200 Subject: [PATCH 020/154] debug --- .github/workflows/circleci.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index ed2ebe5aef4..c216e26dec7 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -26,7 +26,9 @@ env: jobs: install_dependencies: name: Install dependencies - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + container: + image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:latest # runs-on: ["self-hosted", "monorepo"] steps: - name: Restore .git cache @@ -51,14 +53,14 @@ jobs: # There output does not matter here, the fact that they finish successfully does. git rev-parse --abbrev-ref HEAD git fetch --all --tags - - name: Install dependencies (temporal) - run: | - sudo apt-get update - sudo apt-get install -y python2 - sudo apt-get install lsb-release libudev-dev libusb-dev libusb-1.0-0 -y - curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - - sudo apt-get install -y nodejs - sudo npm install -g yarn + # - name: Install dependencies (temporal) + # run: | + # sudo apt-get update + # sudo apt-get install -y python2 + # sudo apt-get install lsb-release libudev-dev libusb-dev libusb-1.0-0 -y + # curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - + # sudo apt-get install -y nodejs + # sudo npm install -g yarn - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 From dfdd8186f79f55fe903b3d21c30ad825cc55316b Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 16:14:57 +0200 Subject: [PATCH 021/154] debug --- .github/workflows/circleci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index c216e26dec7..d0e9fb735f2 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -26,10 +26,10 @@ env: jobs: install_dependencies: name: Install dependencies - runs-on: ubuntu-latest - container: - image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:latest - # runs-on: ["self-hosted", "monorepo"] + # runs-on: ubuntu-latest + # container: + # image: us-west1-docker.pkg.dev/devopsre/clabs-public-images/celo-monorepo:latest + runs-on: ["self-hosted", "monorepo"] steps: - name: Restore .git cache uses: actions/cache@v3 From 9e69e5900ca6df51b56de0b0f4dc8043d62f986f Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 16:18:18 +0200 Subject: [PATCH 022/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index d0e9fb735f2..0b454a1e8cd 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -64,7 +64,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: true + if: false with: limit-access-to-actor: true - name: Install yarn dependencies From 635dc24bd16dfd001ae620da9f2e028e10b0535d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 16:34:28 +0200 Subject: [PATCH 023/154] debug --- .github/workflows/circleci.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 0b454a1e8cd..45bbff9eb4c 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -9,6 +9,10 @@ on: # branches: # - master +concurrency: + group: circle-ci-${{ github.ref }} + cancel-in-progress: true + defaults: run: # working-directory: ~/app @@ -33,12 +37,20 @@ jobs: steps: - name: Restore .git cache uses: actions/cache@v3 - id: cache + id: cache_git with: path: .git key: git-${{ github.ref }} restore-keys: | git- + - name: Restore node cache + uses: actions/cache@v3 + id: cache_node + with: + path: node_modules + key: node-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + node-${{ env.NODE_MODULE_CACHE_VERSION }}- - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -82,8 +94,8 @@ jobs: exit 0 fi yarn check-licenses - - name: Store building artifacts - uses: actions/upload-artifact@v3 - with: - name: workspace - path: ./ + # - name: Store building artifacts + # uses: actions/upload-artifact@v3 + # with: + # name: workspace + # path: ./ From 8386759f70e2f5ae4ddaebeab24869cf10b24ad6 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 16:40:37 +0200 Subject: [PATCH 024/154] debug --- .github/workflows/circleci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 45bbff9eb4c..8e3ab31d37f 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -94,8 +94,3 @@ jobs: exit 0 fi yarn check-licenses - # - name: Store building artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: workspace - # path: ./ From b39a96028bdffef60c52647d856833783d1f1999 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 16:58:00 +0200 Subject: [PATCH 025/154] refactored node cache --- .github/workflows/circleci.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 8e3ab31d37f..4bd083ff81f 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -30,6 +30,9 @@ env: jobs: install_dependencies: name: Install dependencies + outputs: + package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} + patches-checksum: ${{ steps.node-checksums.outputs.PATCHES_CHECKSUM }} # runs-on: ubuntu-latest # container: # image: us-west1-docker.pkg.dev/devopsre/clabs-public-images/celo-monorepo:latest @@ -43,14 +46,6 @@ jobs: key: git-${{ github.ref }} restore-keys: | git- - - name: Restore node cache - uses: actions/cache@v3 - id: cache_node - with: - path: node_modules - key: node-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - node-${{ env.NODE_MODULE_CACHE_VERSION }}- - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -65,6 +60,22 @@ jobs: # There output does not matter here, the fact that they finish successfully does. git rev-parse --abbrev-ref HEAD git fetch --all --tags + - name: Calculate node cache keys + id: node-checksums + run: | + find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > /tmp/package.json + echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('/tmp/package.json') }}" >> "$GITHUB_OUTPUT" + find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > /tmp/patches + echo "PATCHES_CHECKSUM=${{ hashFiles('/tmp/patches') }}" >> "$GITHUB_OUTPUT" + - name: Restore node cache + uses: actions/cache@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ env.PACKAGE_JSON_CHECKSUM }}-${{ env.PATCHES_CHECKSUM }} + restore-keys: | + # TODO(jcortejoso): Think if remove this, to start clean with any change in deps + node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- # - name: Install dependencies (temporal) # run: | # sudo apt-get update From 7ebe0f3d40868179451f57966f69f5818ea798dc Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 17:03:13 +0200 Subject: [PATCH 026/154] refactored node cache --- .github/workflows/circleci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4bd083ff81f..68d96bbbb1d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -73,8 +73,8 @@ jobs: with: path: node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ env.PACKAGE_JSON_CHECKSUM }}-${{ env.PATCHES_CHECKSUM }} + # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | - # TODO(jcortejoso): Think if remove this, to start clean with any change in deps node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- # - name: Install dependencies (temporal) # run: | @@ -92,6 +92,12 @@ jobs: limit-access-to-actor: true - name: Install yarn dependencies run: yarn install + if: setps.cache_node.outputs.cache-hit != 'true' + - name: Run yarn postinstall if cache hitted + run: yarn install + if: setps.cache_node.outputs.cache-hit == 'true' + - name: Fail if generated dependency graph doesn't match committed + run: ./scripts/ci_check_dependency_graph_changed.sh - name: Build packages run: yarn build --ignore docs --include-dependencies - name: Check licenses From 42a1d68bd3b711d756b464117aac4d54c93bf73b Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 17:05:01 +0200 Subject: [PATCH 027/154] refactored node cache --- .github/workflows/circleci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 68d96bbbb1d..5d7feb80872 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -73,7 +73,6 @@ jobs: with: path: node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ env.PACKAGE_JSON_CHECKSUM }}-${{ env.PATCHES_CHECKSUM }} - # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- # - name: Install dependencies (temporal) @@ -92,10 +91,10 @@ jobs: limit-access-to-actor: true - name: Install yarn dependencies run: yarn install - if: setps.cache_node.outputs.cache-hit != 'true' + if: steps.cache_node.outputs.cache-hit != 'true' - name: Run yarn postinstall if cache hitted run: yarn install - if: setps.cache_node.outputs.cache-hit == 'true' + if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh - name: Build packages From abd5f84ffa0fb9d3d0dd3c2d84a61d173283edaa Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 17:36:13 +0200 Subject: [PATCH 028/154] refactored node cache --- .github/workflows/circleci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5d7feb80872..7731372f0f4 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -72,7 +72,8 @@ jobs: id: cache_node with: path: node_modules - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ env.PACKAGE_JSON_CHECKSUM }}-${{ env.PATCHES_CHECKSUM }} + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }}-${{ steps.node-checksums.outputs.PATCHES_CHECKSUM }} + # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- # - name: Install dependencies (temporal) From 39537d845cdfe534540f78e3ec9277d835f3fe49 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 17:46:37 +0200 Subject: [PATCH 029/154] refactored node cache --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 7731372f0f4..fd9359abcf5 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -87,7 +87,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: false + if: true with: limit-access-to-actor: true - name: Install yarn dependencies From 9aa9b95040c37d6efc9851fbc739a7f8535b0c2a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 17:50:28 +0200 Subject: [PATCH 030/154] refactored node cache --- .github/workflows/circleci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index fd9359abcf5..0239f8261cc 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -67,6 +67,9 @@ jobs: echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('/tmp/package.json') }}" >> "$GITHUB_OUTPUT" find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > /tmp/patches echo "PATCHES_CHECKSUM=${{ hashFiles('/tmp/patches') }}" >> "$GITHUB_OUTPUT" + - run: | + echo "PACKAGE_JSON_CHECKSUM: ${{ hashFiles('/tmp/package.json') }}" + echo "PATCHES_CHECKSUM: ${{ hashFiles('/tmp/patches') }}" - name: Restore node cache uses: actions/cache@v3 id: cache_node From 4ef70b05611cb19099632620286e88d396488011 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 17:56:39 +0200 Subject: [PATCH 031/154] refactored node cache --- .github/workflows/circleci.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 0239f8261cc..665e3b02115 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -32,7 +32,6 @@ jobs: name: Install dependencies outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} - patches-checksum: ${{ steps.node-checksums.outputs.PATCHES_CHECKSUM }} # runs-on: ubuntu-latest # container: # image: us-west1-docker.pkg.dev/devopsre/clabs-public-images/celo-monorepo:latest @@ -63,19 +62,17 @@ jobs: - name: Calculate node cache keys id: node-checksums run: | - find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > /tmp/package.json - echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('/tmp/package.json') }}" >> "$GITHUB_OUTPUT" - find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > /tmp/patches - echo "PATCHES_CHECKSUM=${{ hashFiles('/tmp/patches') }}" >> "$GITHUB_OUTPUT" + find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > package.checksum + find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > patches.checksum + echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('*.checksum') }}" >> "$GITHUB_OUTPUT" - run: | - echo "PACKAGE_JSON_CHECKSUM: ${{ hashFiles('/tmp/package.json') }}" - echo "PATCHES_CHECKSUM: ${{ hashFiles('/tmp/patches') }}" + echo "PACKAGE_JSON_CHECKSUM: ${{ hashFiles('*.checksum') }}" - name: Restore node cache uses: actions/cache@v3 id: cache_node with: path: node_modules - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }}-${{ steps.node-checksums.outputs.PATCHES_CHECKSUM }} + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- From daf9491a76d991b7b328ab84c225cf559c0a4a69 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 18:01:39 +0200 Subject: [PATCH 032/154] refactored node cache --- .github/workflows/circleci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 665e3b02115..fe164c6c884 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -65,8 +65,6 @@ jobs: find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > package.checksum find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > patches.checksum echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('*.checksum') }}" >> "$GITHUB_OUTPUT" - - run: | - echo "PACKAGE_JSON_CHECKSUM: ${{ hashFiles('*.checksum') }}" - name: Restore node cache uses: actions/cache@v3 id: cache_node @@ -87,7 +85,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: true + if: false with: limit-access-to-actor: true - name: Install yarn dependencies From b56e42e449ebe10c089aed83e8eb01f1b12deee7 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 18:13:22 +0200 Subject: [PATCH 033/154] refactored node cache --- .github/workflows/circleci.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index fe164c6c884..c19d39d8617 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -33,8 +33,6 @@ jobs: outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # runs-on: ubuntu-latest - # container: - # image: us-west1-docker.pkg.dev/devopsre/clabs-public-images/celo-monorepo:latest runs-on: ["self-hosted", "monorepo"] steps: - name: Restore .git cache @@ -74,14 +72,6 @@ jobs: # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- - # - name: Install dependencies (temporal) - # run: | - # sudo apt-get update - # sudo apt-get install -y python2 - # sudo apt-get install lsb-release libudev-dev libusb-dev libusb-1.0-0 -y - # curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - - # sudo apt-get install -y nodejs - # sudo npm install -g yarn - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 @@ -109,3 +99,21 @@ jobs: exit 0 fi yarn check-licenses + lint_checks: + name: Lint code + runs-on: ["self-hosted", "monorepo"] + needs: install_dependencies + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - run: yarn run prettify:diff + - run: yarn run lint From adac02e14557abfaccff34a88234e2bbe659ee58 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 5 May 2023 18:37:42 +0200 Subject: [PATCH 034/154] refactored node cache --- .github/workflows/circleci.yml | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index c19d39d8617..5f701f58a4d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -117,3 +117,38 @@ jobs: key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff - run: yarn run lint + general_test: + name: General jest test + runs-on: ["self-hosted", "monorepo"] + needs: install_dependencies + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - run: yarn run prettify:diff + - name: Run Jest Tests + run: | + mkdir -p test-results/jest + yarn run lerna \ + --ignore @celo/contractkit \ + --ignore @celo/protocol \ + --ignore @celo/celotool \ + --ignore @celo/celocli \ + --ignore @celo/env-tests \ + --ignore @celo/identity \ + --ignore @celo/transactions-uri \ + --ignore '@celo/wallet-*' \ + run test + - name: Upload Jest Test Results + uses: actions/upload-artifact@v3 + with: + name: Jest Test Results + path: test-results/jest From 25996cec9f95b26198c949c0e26b78d9b9cc3792 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Mon, 8 May 2023 11:39:44 +0000 Subject: [PATCH 035/154] Added wallet test --- .github/workflows/circleci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5f701f58a4d..bb49bce8c4c 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -152,3 +152,22 @@ jobs: with: name: Jest Test Results path: test-results/jest + wallet_test: + name: Wallet test + runs-on: ["self-hosted", "monorepo"] + needs: install_dependencies + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - name: Run Wallet tests + run: | + yarn run lerna --scope '@celo/wallet-*' run test From 97909c3acb63b64ea9d58ba8da4989aacce8ad02 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Mon, 8 May 2023 12:15:59 +0000 Subject: [PATCH 036/154] Debug --- .github/actions/sync-workspace/action.yml | 17 +++++ .github/workflows/circleci.yml | 86 +++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/actions/sync-workspace/action.yml diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml new file mode 100644 index 00000000000..e95f1654be4 --- /dev/null +++ b/.github/actions/sync-workspace/action.yml @@ -0,0 +1,17 @@ +name: "Sync workspace" +description: "Sync GitHub Action workspace using GitHub cache" +inputs: {} +runs: + using: "composite" + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index bb49bce8c4c..37a61f4eadc 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -26,6 +26,8 @@ env: NODE_OPTIONS: '--max-old-space-size=4096' TERM: dumb GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"' + # Git Tag for contract release to use + RELEASE_TAG: core-contracts.v9 jobs: install_dependencies: @@ -134,6 +136,12 @@ jobs: path: node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: true + with: + limit-access-to-actor: true - name: Run Jest Tests run: | mkdir -p test-results/jest @@ -155,6 +163,7 @@ jobs: wallet_test: name: Wallet test runs-on: ["self-hosted", "monorepo"] + if: false needs: install_dependencies steps: - uses: actions/cache/restore@v3 @@ -171,3 +180,80 @@ jobs: - name: Run Wallet tests run: | yarn run lerna --scope '@celo/wallet-*' run test + pre_protocol_test_release: + name: Protocol Tests Prepare + runs-on: ["self-hosted", "monorepo"] + needs: install_dependencies + if: false + outputs: + protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - name: Check if the test should run + id: protocol-test-must-run + run: | + # TODO(jcortejoso): This script slightly depends on CircleCI + # Ideally refactor this to depend just on GitHub Actions + # ./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol + echo "Protocol tests runs always" + echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" + - name: Cache protocol devchain + uses: actions/cache@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} + restore-keys: | + protocol-${{ github.sha }} + - name: Opcode tests + run: | + yarn --cwd packages/protocol check-opcodes + - name: Generate devchain of previous release + run: | + echo "Comparing against $RELEASE_TAG" + # Github has phased out the git protocol so we ensure that we use + # https for all git operations that yarn may perform. + git config --global url."https://github.com".insteadOf git://github.com + yarn --cwd packages/protocol test:generate-old-devchain-and-build -b $RELEASE_TAG -d .tmp/released_chain -l /dev/stdout -g scripts/truffle/releaseGoldExampleConfigs.json + protocol-test-release: + name: Protocol Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install_dependencies, pre_protocol_test_release] + if: false && jobs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} + - name: Copy DevChain and Build generated from released tag + run: | + BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) + (cp -r packages/protocol/.tmp/released_chain packages/protocol/$BUILD_AND_DEVCHAIN_DIR) + - name: Test against current release + run: | + echo "Comparing against $RELEASE_TAG" + BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) + yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout + From d2dca581ff5968d5da4468bc836c54c2502126bf Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Mon, 8 May 2023 12:16:49 +0000 Subject: [PATCH 037/154] debug --- .github/workflows/circleci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 37a61f4eadc..5b1882f203d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -229,7 +229,8 @@ jobs: name: Protocol Tests runs-on: ["self-hosted", "monorepo"] needs: [install_dependencies, pre_protocol_test_release] - if: false && jobs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + if: | + false && jobs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' steps: - uses: actions/cache/restore@v3 id: cache_git From 96a35cc30c18a5e7a85bac8ab47d725ed65b4d0a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Mon, 8 May 2023 12:19:09 +0000 Subject: [PATCH 038/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5b1882f203d..775d7e0faa4 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -230,7 +230,7 @@ jobs: runs-on: ["self-hosted", "monorepo"] needs: [install_dependencies, pre_protocol_test_release] if: | - false && jobs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' steps: - uses: actions/cache/restore@v3 id: cache_git From d5792a0198873c072f843b661add7b55237ec452 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 08:04:22 +0000 Subject: [PATCH 039/154] Disable tmate --- .github/workflows/circleci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 775d7e0faa4..25bdceed54d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -80,12 +80,12 @@ jobs: if: false with: limit-access-to-actor: true - - name: Install yarn dependencies - run: yarn install - if: steps.cache_node.outputs.cache-hit != 'true' + # - name: Install yarn dependencies + # run: yarn install + # if: steps.cache_node.outputs.cache-hit != 'true' - name: Run yarn postinstall if cache hitted run: yarn install - if: steps.cache_node.outputs.cache-hit == 'true' + # if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh - name: Build packages @@ -139,7 +139,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: true + if: false with: limit-access-to-actor: true - name: Run Jest Tests From 71d6114e775e53c6b3fc6dac066599bba7701005 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 08:24:28 +0000 Subject: [PATCH 040/154] debug --- .github/workflows/circleci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 25bdceed54d..eb4683e82c7 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -138,8 +138,8 @@ jobs: - run: yarn run prettify:diff - name: Setup tmate session uses: mxschmitt/action-tmate@v3 - timeout-minutes: 10 - if: false + timeout-minutes: 30 + if: true with: limit-access-to-actor: true - name: Run Jest Tests From 2e0ec01a52ca1fb5e853585789d715254e1b2abc Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 09:02:09 +0000 Subject: [PATCH 041/154] Caching subpackage node_modules --- .github/workflows/circleci.yml | 39 ++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index eb4683e82c7..31025daacb8 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -69,7 +69,33 @@ jobs: uses: actions/cache@v3 id: cache_node with: - path: node_modules + path: | + node_modules + packages/celotool/node_modules + packages/cli/node_modules + packages/dev-utils/node_modules + packages/env-tests/node_modules + packages/flake-tracker/node_modules + packages/metadata-crawler/node_modules + packages/phone-number-privacy/combiner/node_modules + packages/phone-number-privacy/common/node_modules + packages/phone-number-privacy/monitor/node_modules + packages/phone-number-privacy/signer/node_modules + packages/protocol/node_modules + packages/sdk/base/node_modules + packages/sdk/connect/node_modules + packages/sdk/contractkit/node_modules + packages/sdk/cryptographic-utils/node_modules + packages/sdk/encrypted-backup/node_modules + packages/sdk/explorer/node_modules + packages/sdk/governance/node_modules + packages/sdk/identity/node_modules + packages/sdk/keystores/node_modules + packages/sdk/network-utils/node_modules + packages/sdk/phone-utils/node_modules + packages/sdk/transactions-uri/node_modules + packages/sdk/utils/node_modules + packages/typescript/node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | @@ -80,12 +106,12 @@ jobs: if: false with: limit-access-to-actor: true - # - name: Install yarn dependencies - # run: yarn install - # if: steps.cache_node.outputs.cache-hit != 'true' + - name: Install yarn dependencies + run: yarn install + if: steps.cache_node.outputs.cache-hit != 'true' - name: Run yarn postinstall if cache hitted run: yarn install - # if: steps.cache_node.outputs.cache-hit == 'true' + if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh - name: Build packages @@ -135,11 +161,10 @@ jobs: with: path: node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - - run: yarn run prettify:diff - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 30 - if: true + if: false with: limit-access-to-actor: true - name: Run Jest Tests From 89778f979d0aec2aaab2f2e4946cedd2aa342dd3 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 09:11:10 +0000 Subject: [PATCH 042/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 31025daacb8..4a5e20c1ae5 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -164,7 +164,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 30 - if: false + if: true with: limit-access-to-actor: true - name: Run Jest Tests From 1e41bafb56ead7eb041f2443476a694489b817a9 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 09:18:02 +0000 Subject: [PATCH 043/154] testing cache --- .github/workflows/circleci.yml | 42 ++++++++++++---------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4a5e20c1ae5..0508c41f22d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -71,31 +71,8 @@ jobs: with: path: | node_modules - packages/celotool/node_modules - packages/cli/node_modules - packages/dev-utils/node_modules - packages/env-tests/node_modules - packages/flake-tracker/node_modules - packages/metadata-crawler/node_modules - packages/phone-number-privacy/combiner/node_modules - packages/phone-number-privacy/common/node_modules - packages/phone-number-privacy/monitor/node_modules - packages/phone-number-privacy/signer/node_modules - packages/protocol/node_modules - packages/sdk/base/node_modules - packages/sdk/connect/node_modules - packages/sdk/contractkit/node_modules - packages/sdk/cryptographic-utils/node_modules - packages/sdk/encrypted-backup/node_modules - packages/sdk/explorer/node_modules - packages/sdk/governance/node_modules - packages/sdk/identity/node_modules - packages/sdk/keystores/node_modules - packages/sdk/network-utils/node_modules - packages/sdk/phone-utils/node_modules - packages/sdk/transactions-uri/node_modules - packages/sdk/utils/node_modules - packages/typescript/node_modules + */node_modules + **/node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | @@ -141,7 +118,10 @@ jobs: - uses: actions/cache/restore@v3 id: cache_node with: - path: node_modules + path: | + node_modules + */node_modules + **/node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff - run: yarn run lint @@ -159,7 +139,10 @@ jobs: - uses: actions/cache/restore@v3 id: cache_node with: - path: node_modules + path: | + node_modules + */node_modules + **/node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - name: Setup tmate session uses: mxschmitt/action-tmate@v3 @@ -200,7 +183,10 @@ jobs: - uses: actions/cache/restore@v3 id: cache_node with: - path: node_modules + path: | + node_modules + */node_modules + **/node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - name: Run Wallet tests run: | From d1b9139a133c7fc7093e2f16dd0898f6d55cb90d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 09:35:44 +0000 Subject: [PATCH 044/154] Testing caching the whole packages folder --- .github/workflows/circleci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 0508c41f22d..c7c0c4f81df 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -71,8 +71,7 @@ jobs: with: path: | node_modules - */node_modules - **/node_modules + packages key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | @@ -120,8 +119,7 @@ jobs: with: path: | node_modules - */node_modules - **/node_modules + packages key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff - run: yarn run lint @@ -141,8 +139,7 @@ jobs: with: path: | node_modules - */node_modules - **/node_modules + packages key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - name: Setup tmate session uses: mxschmitt/action-tmate@v3 @@ -185,8 +182,7 @@ jobs: with: path: | node_modules - */node_modules - **/node_modules + packages/ key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - name: Run Wallet tests run: | From 62db5ff3224110978dabd92a44d89c8a10b83612 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 09:45:51 +0000 Subject: [PATCH 045/154] Disable debug --- .github/workflows/circleci.yml | 38 +++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index c7c0c4f81df..24ad52b49d9 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -144,7 +144,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 30 - if: true + if: false with: limit-access-to-actor: true - name: Run Jest Tests @@ -204,7 +204,9 @@ jobs: - uses: actions/cache/restore@v3 id: cache_node with: - path: node_modules + path: | + node_modules + packages key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - name: Check if the test should run id: protocol-test-must-run @@ -233,7 +235,7 @@ jobs: git config --global url."https://github.com".insteadOf git://github.com yarn --cwd packages/protocol test:generate-old-devchain-and-build -b $RELEASE_TAG -d .tmp/released_chain -l /dev/stdout -g scripts/truffle/releaseGoldExampleConfigs.json protocol-test-release: - name: Protocol Tests + name: Protocol Test Release runs-on: ["self-hosted", "monorepo"] needs: [install_dependencies, pre_protocol_test_release] if: | @@ -248,7 +250,9 @@ jobs: - uses: actions/cache/restore@v3 id: cache_node with: - path: node_modules + path: | + node_modules + packages key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - uses: actions/cache/restore@v3 id: cache_protocol @@ -264,4 +268,28 @@ jobs: echo "Comparing against $RELEASE_TAG" BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout - + protocol-test-release-snapshots: + name: Protocol Test Reslease Snapshots + runs-on: ["self-hosted", "monorepo"] + needs: [install_dependencies, pre_protocol_test_release] + if: | + false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: | + node_modules + packages + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} From 715945726ac2986cd4dffea292325dd16425c1df Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 10:00:05 +0000 Subject: [PATCH 046/154] Testing composite action --- .github/actions/sync-workspace/action.yml | 9 +-- .github/workflows/circleci.yml | 83 +++++++++++++++++++---- 2 files changed, 74 insertions(+), 18 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index e95f1654be4..7e479014fb1 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -4,14 +4,11 @@ inputs: {} runs: using: "composite" steps: - - uses: actions/cache/restore@v3 - id: cache_git - with: - path: .git - key: git-${{ github.ref }} - uses: actions/checkout@v3 - uses: actions/cache/restore@v3 id: cache_node with: - path: node_modules + path: | + node_modules + packages key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 24ad52b49d9..820b23f86f4 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -108,19 +108,14 @@ jobs: runs-on: ["self-hosted", "monorepo"] needs: install_dependencies steps: + # Restore .git cache as we need to checkout the local composite action to run it: + # https://github.com/orgs/community/discussions/11771 - uses: actions/cache/restore@v3 id: cache_git with: path: .git key: git-${{ github.ref }} - - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node - with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: ./.github/actions/my-action - run: yarn run prettify:diff - run: yarn run lint general_test: @@ -190,8 +185,7 @@ jobs: pre_protocol_test_release: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] - needs: install_dependencies - if: false + needs: [lint_checks] outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -237,7 +231,7 @@ jobs: protocol-test-release: name: Protocol Test Release runs-on: ["self-hosted", "monorepo"] - needs: [install_dependencies, pre_protocol_test_release] + needs: [lint_checks] if: | false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' steps: @@ -271,7 +265,41 @@ jobs: protocol-test-release-snapshots: name: Protocol Test Reslease Snapshots runs-on: ["self-hosted", "monorepo"] - needs: [install_dependencies, pre_protocol_test_release] + needs: [lint_checks] + if: | + false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: | + node_modules + packages + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} + - name: Run check-versions on exhaustive history of releases and compare to snapshots + run: | + yarn --cwd packages/protocol test:release-snapshots + if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then + git --no-pager diff packages/protocol/releaseData/versionReports + echo "There are git differences after generating release version report snapshots" + echo "If these changes are intended, update the 'releaseData/versionReports' accordingly" + exit 1 + fi + protocol-test-common: + name: Protocol Test Unit tests + runs-on: ["self-hosted", "monorepo"] + needs: [lint_checks] if: | false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' steps: @@ -293,3 +321,34 @@ jobs: with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} + - name: Unit tests + run: | + yarn --cwd packages/protocol test common/ + protocol-test-compatibility: + name: Protocol Test Compatibility + runs-on: ["self-hosted", "monorepo"] + needs: [lint_checks] + if: | + false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: | + node_modules + packages + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} + - name: Run protocol compatibility tests + run: | + yarn --cwd packages/protocol test compatibility/ From e6fcf13d3f328d24503776b4cc6503b272e674a7 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 10:10:15 +0000 Subject: [PATCH 047/154] Fix composite action --- .github/workflows/circleci.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 820b23f86f4..858c93cd06f 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -115,7 +115,7 @@ jobs: with: path: .git key: git-${{ github.ref }} - - uses: ./.github/actions/my-action + - uses: ./.github/actions/sync-workspace - run: yarn run prettify:diff - run: yarn run lint general_test: @@ -352,3 +352,31 @@ jobs: - name: Run protocol compatibility tests run: | yarn --cwd packages/protocol test compatibility/ + protocol-test-governance-network: + name: Protocol Test Compatibility + runs-on: ["self-hosted", "monorepo"] + needs: [lint_checks] + if: | + false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: | + node_modules + packages + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} + - name: Run protocol compatibility tests + run: | + yarn --cwd packages/protocol test governance/network/ From 23ccf98f0bc0caf6e61b218c0cd5949abb7b07b1 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 10:24:33 +0000 Subject: [PATCH 048/154] debug --- .github/workflows/circleci.yml | 255 ++++++++++++++++++++------------- 1 file changed, 152 insertions(+), 103 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 858c93cd06f..9d28b8d327a 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -115,6 +115,12 @@ jobs: with: path: .git key: git-${{ github.ref }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 10 + if: true + with: + limit-access-to-actor: true - uses: ./.github/actions/sync-workspace - run: yarn run prettify:diff - run: yarn run lint @@ -186,6 +192,7 @@ jobs: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] needs: [lint_checks] + if: false outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -262,121 +269,163 @@ jobs: echo "Comparing against $RELEASE_TAG" BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout - protocol-test-release-snapshots: - name: Protocol Test Reslease Snapshots + protocol-test-matrix: + name: Protocol Test Matrix runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks] + needs: [lint_checks, pre_protocol_test_release] if: | false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + strategy: + matrix: + include: + - name: Protocol Test Reslease Snapshots + command: | + yarn --cwd packages/protocol test:release-snapshots + if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then + git --no-pager diff packages/protocol/releaseData/versionReports + echo "There are git differences after generating release version report snapshots" + echo "If these changes are intended, update the 'releaseData/versionReports' accordingly" + exit 1 + fi + - name: Protocol Test Unit tests + commnd: | + yarn --cwd packages/protocol test common/ + - name: Protocol Test Compatibility + commnd: | + yarn --cwd packages/protocol test compatibility/ + - name: Protocol Test Governance Network + commnd: | + yarn --cwd packages/protocol test governance/network/ steps: - uses: actions/cache/restore@v3 id: cache_git with: path: .git key: git-${{ github.ref }} - - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node - with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - - uses: actions/cache/restore@v3 - id: cache_protocol - with: - path: packages/protocol/.tmp/released_chain - key: protocol-${{ github.sha }} - - name: Run check-versions on exhaustive history of releases and compare to snapshots - run: | - yarn --cwd packages/protocol test:release-snapshots - if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then - git --no-pager diff packages/protocol/releaseData/versionReports - echo "There are git differences after generating release version report snapshots" - echo "If these changes are intended, update the 'releaseData/versionReports' accordingly" - exit 1 - fi - protocol-test-common: - name: Protocol Test Unit tests - runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks] - if: | - false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' - steps: - - uses: actions/cache/restore@v3 - id: cache_git - with: - path: .git - key: git-${{ github.ref }} - - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node - with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - - uses: actions/cache/restore@v3 - id: cache_protocol - with: - path: packages/protocol/.tmp/released_chain - key: protocol-${{ github.sha }} - - name: Unit tests - run: | - yarn --cwd packages/protocol test common/ - protocol-test-compatibility: - name: Protocol Test Compatibility - runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks] - if: | - false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' - steps: - - uses: actions/cache/restore@v3 - id: cache_git - with: - path: .git - key: git-${{ github.ref }} - - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node - with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - - uses: actions/cache/restore@v3 - id: cache_protocol - with: - path: packages/protocol/.tmp/released_chain - key: protocol-${{ github.sha }} - - name: Run protocol compatibility tests - run: | - yarn --cwd packages/protocol test compatibility/ - protocol-test-governance-network: - name: Protocol Test Compatibility - runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks] - if: | - false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' - steps: - - uses: actions/cache/restore@v3 - id: cache_git - with: - path: .git - key: git-${{ github.ref }} - - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node - with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: ./.github/actions/sync-workspace - uses: actions/cache/restore@v3 id: cache_protocol with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} - - name: Run protocol compatibility tests + - name: Execute matrix command for test run: | - yarn --cwd packages/protocol test governance/network/ + ${{ matrix.command }} + # protocol-test-release-snapshots: + # name: Protocol Test Reslease Snapshots + # runs-on: ["self-hosted", "monorepo"] + # needs: [lint_checks, pre_protocol_test_release] + # if: | + # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # steps: + # - uses: actions/cache/restore@v3 + # id: cache_git + # with: + # path: .git + # key: git-${{ github.ref }} + # - uses: actions/checkout@v3 + # - uses: actions/cache/restore@v3 + # id: cache_node + # with: + # path: | + # node_modules + # packages + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # - uses: actions/cache/restore@v3 + # id: cache_protocol + # with: + # path: packages/protocol/.tmp/released_chain + # key: protocol-${{ github.sha }} + # - name: Run check-versions on exhaustive history of releases and compare to snapshots + # run: | + # yarn --cwd packages/protocol test:release-snapshots + # if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then + # git --no-pager diff packages/protocol/releaseData/versionReports + # echo "There are git differences after generating release version report snapshots" + # echo "If these changes are intended, update the 'releaseData/versionReports' accordingly" + # exit 1 + # fi + # protocol-test-common: + # name: Protocol Test Unit tests + # runs-on: ["self-hosted", "monorepo"] + # needs: [lint_checks, pre_protocol_test_release] + # if: | + # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # steps: + # - uses: actions/cache/restore@v3 + # id: cache_git + # with: + # path: .git + # key: git-${{ github.ref }} + # - uses: actions/checkout@v3 + # - uses: actions/cache/restore@v3 + # id: cache_node + # with: + # path: | + # node_modules + # packages + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # - uses: actions/cache/restore@v3 + # id: cache_protocol + # with: + # path: packages/protocol/.tmp/released_chain + # key: protocol-${{ github.sha }} + # - name: Unit tests + # run: | + # yarn --cwd packages/protocol test common/ + # protocol-test-compatibility: + # name: Protocol Test Compatibility + # runs-on: ["self-hosted", "monorepo"] + # needs: [lint_checks, pre_protocol_test_release] + # if: | + # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # steps: + # - uses: actions/cache/restore@v3 + # id: cache_git + # with: + # path: .git + # key: git-${{ github.ref }} + # - uses: actions/checkout@v3 + # - uses: actions/cache/restore@v3 + # id: cache_node + # with: + # path: | + # node_modules + # packages + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # - uses: actions/cache/restore@v3 + # id: cache_protocol + # with: + # path: packages/protocol/.tmp/released_chain + # key: protocol-${{ github.sha }} + # - name: Run protocol compatibility tests + # run: | + # yarn --cwd packages/protocol test compatibility/ + # protocol-test-governance-network: + # name: Protocol Test Governance Network + # runs-on: ["self-hosted", "monorepo"] + # needs: [lint_checks, pre_protocol_test_release] + # if: | + # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # steps: + # - uses: actions/cache/restore@v3 + # id: cache_git + # with: + # path: .git + # key: git-${{ github.ref }} + # - uses: actions/checkout@v3 + # - uses: actions/cache/restore@v3 + # id: cache_node + # with: + # path: | + # node_modules + # packages + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # - uses: actions/cache/restore@v3 + # id: cache_protocol + # with: + # path: packages/protocol/.tmp/released_chain + # key: protocol-${{ github.sha }} + # - name: Run protocol compatibility tests + # run: | + # yarn --cwd packages/protocol test governance/network/ From c85be1830b39407936002be40db7f57b44b6c3f0 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 10:25:31 +0000 Subject: [PATCH 049/154] Test composite action --- .github/workflows/circleci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9d28b8d327a..fbb4cc3e656 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -115,12 +115,7 @@ jobs: with: path: .git key: git-${{ github.ref }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 10 - if: true - with: - limit-access-to-actor: true + - uses: actions/checkout@v3 - uses: ./.github/actions/sync-workspace - run: yarn run prettify:diff - run: yarn run lint From 8f461f44251c4600a60ed91f61bdb6a378ae5e9d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 10:34:53 +0000 Subject: [PATCH 050/154] Composite action fixes --- .github/actions/sync-workspace/action.yml | 7 +- .github/workflows/circleci.yml | 86 ++++++++++++++--------- 2 files changed, 56 insertions(+), 37 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index 7e479014fb1..e1543b7ee07 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -1,6 +1,9 @@ name: "Sync workspace" description: "Sync GitHub Action workspace using GitHub cache" -inputs: {} +inputs: + package-json-checksum: + description: "Checksum of package.json" + required: true runs: using: "composite" steps: @@ -11,4 +14,4 @@ runs: path: | node_modules packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index fbb4cc3e656..914a7108dcf 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -116,7 +116,10 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 - - uses: ./.github/actions/sync-workspace + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install_dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff - run: yarn run lint general_test: @@ -291,6 +294,19 @@ jobs: - name: Protocol Test Governance Network commnd: | yarn --cwd packages/protocol test governance/network/ + + - name: Protocol Test Governance Validators + commnd: | + yarn --cwd packages/protocol test governance/validators/ + - name: Protocol Test Governance Voting + commnd: | + yarn --cwd packages/protocol test governance/voting/ + - name: Protocol Test Governance Identity + commnd: | + yarn --cwd packages/protocol test identity/ + - name: Protocol Test Stability + commnd: | + yarn --cwd packages/protocol test stability/ steps: - uses: actions/cache/restore@v3 id: cache_git @@ -306,40 +322,6 @@ jobs: - name: Execute matrix command for test run: | ${{ matrix.command }} - # protocol-test-release-snapshots: - # name: Protocol Test Reslease Snapshots - # runs-on: ["self-hosted", "monorepo"] - # needs: [lint_checks, pre_protocol_test_release] - # if: | - # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' - # steps: - # - uses: actions/cache/restore@v3 - # id: cache_git - # with: - # path: .git - # key: git-${{ github.ref }} - # - uses: actions/checkout@v3 - # - uses: actions/cache/restore@v3 - # id: cache_node - # with: - # path: | - # node_modules - # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} - # - uses: actions/cache/restore@v3 - # id: cache_protocol - # with: - # path: packages/protocol/.tmp/released_chain - # key: protocol-${{ github.sha }} - # - name: Run check-versions on exhaustive history of releases and compare to snapshots - # run: | - # yarn --cwd packages/protocol test:release-snapshots - # if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then - # git --no-pager diff packages/protocol/releaseData/versionReports - # echo "There are git differences after generating release version report snapshots" - # echo "If these changes are intended, update the 'releaseData/versionReports' accordingly" - # exit 1 - # fi # protocol-test-common: # name: Protocol Test Unit tests # runs-on: ["self-hosted", "monorepo"] @@ -424,3 +406,37 @@ jobs: # - name: Run protocol compatibility tests # run: | # yarn --cwd packages/protocol test governance/network/ + + protocol-test-with-code-coverage: + name: Protocol Test with code coverage + runs-on: ["self-hosted", "monorepo"] + needs: [lint_checks, pre_protocol_test_release] + if: | + false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - uses: actions/cache/restore@v3 + id: cache_node + with: + path: | + node_modules + packages + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} + - name: Run unit tests with code coverage + run: | + yarn --cwd packages/protocol test:coverage + - name: Upload Coverage Test Results + uses: actions/upload-artifact@v3 + with: + name: Protocol Test Coverage + path: packages/protocol/coverage From 2cdd7b6065b839e06c4253a408c9435f339b1906 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 10:46:08 +0000 Subject: [PATCH 051/154] Running new tests --- .../actions/protocol-sync-workspace/action.yml | 18 ++++++++++++++++++ .github/actions/sync-workspace/action.yml | 1 - .github/workflows/circleci.yml | 16 ++++------------ 3 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 .github/actions/protocol-sync-workspace/action.yml diff --git a/.github/actions/protocol-sync-workspace/action.yml b/.github/actions/protocol-sync-workspace/action.yml new file mode 100644 index 00000000000..cb49b5e3df3 --- /dev/null +++ b/.github/actions/protocol-sync-workspace/action.yml @@ -0,0 +1,18 @@ +name: "Sync workspace for protocol tests" +description: "Sync workspace for protocol tests" +inputs: + package-json-checksum: + description: "Checksum of package.json" + required: true +runs: + using: "composite" + steps: + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install_dependencies.outputs.package-json-checksum }} + - uses: actions/cache/restore@v3 + id: cache_protocol + with: + path: packages/protocol/.tmp/released_chain + key: protocol-${{ github.sha }} diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index e1543b7ee07..bf24a121716 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -7,7 +7,6 @@ inputs: runs: using: "composite" steps: - - uses: actions/checkout@v3 - uses: actions/cache/restore@v3 id: cache_node with: diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 914a7108dcf..4ff53bb6f6e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -16,9 +16,7 @@ concurrency: defaults: run: # working-directory: ~/app - # TODO(jcortejoso): When using a self-hosted runner, we can use this if `/bin/bash` is installed. Not available in gh's ubuntu-latest shell: bash --login -eo pipefail {0} - # shell: sh -e -u {0} env: # Increment these to force cache rebuilding @@ -133,13 +131,10 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node + - name: Sync workspace + uses: ./.github/actions/sync-workspace with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ needs.install_dependencies.outputs.package-json-checksum }} - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 30 @@ -167,7 +162,6 @@ jobs: wallet_test: name: Wallet test runs-on: ["self-hosted", "monorepo"] - if: false needs: install_dependencies steps: - uses: actions/cache/restore@v3 @@ -190,7 +184,6 @@ jobs: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] needs: [lint_checks] - if: false outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -236,7 +229,7 @@ jobs: protocol-test-release: name: Protocol Test Release runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks] + needs: [lint_checks, pre_protocol_test_release] if: | false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' steps: @@ -294,7 +287,6 @@ jobs: - name: Protocol Test Governance Network commnd: | yarn --cwd packages/protocol test governance/network/ - - name: Protocol Test Governance Validators commnd: | yarn --cwd packages/protocol test governance/validators/ From c40cc3ed58ad5ce8d769532247a4e4ae70ecebbf Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 11:00:34 +0000 Subject: [PATCH 052/154] debug wallet tests --- .github/workflows/circleci.yml | 121 +++++++++++++++++---------------- 1 file changed, 64 insertions(+), 57 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4ff53bb6f6e..d9902cd2fb8 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -28,7 +28,7 @@ env: RELEASE_TAG: core-contracts.v9 jobs: - install_dependencies: + install-dependencies: name: Install dependencies outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} @@ -84,7 +84,7 @@ jobs: run: yarn install if: steps.cache_node.outputs.cache-hit != 'true' - name: Run yarn postinstall if cache hitted - run: yarn install + run: yarn install postinstall if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh @@ -101,10 +101,10 @@ jobs: exit 0 fi yarn check-licenses - lint_checks: + lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] - needs: install_dependencies + needs: install-dependencies steps: # Restore .git cache as we need to checkout the local composite action to run it: # https://github.com/orgs/community/discussions/11771 @@ -117,13 +117,13 @@ jobs: - name: Sync workspace uses: ./.github/actions/sync-workspace with: - package-json-checksum: ${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff - run: yarn run lint general_test: name: General jest test runs-on: ["self-hosted", "monorepo"] - needs: install_dependencies + needs: install-dependencies steps: - uses: actions/cache/restore@v3 id: cache_git @@ -134,13 +134,7 @@ jobs: - name: Sync workspace uses: ./.github/actions/sync-workspace with: - package-json-checksum: ${{ needs.install_dependencies.outputs.package-json-checksum }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 30 - if: false - with: - limit-access-to-actor: true + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Run Jest Tests run: | mkdir -p test-results/jest @@ -159,10 +153,10 @@ jobs: with: name: Jest Test Results path: test-results/jest - wallet_test: + wallet-test: name: Wallet test runs-on: ["self-hosted", "monorepo"] - needs: install_dependencies + needs: install-dependencies steps: - uses: actions/cache/restore@v3 id: cache_git @@ -170,20 +164,23 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node + - name: Sync workspace + uses: ./.github/actions/sync-workspace with: - path: | - node_modules - packages/ - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 30 + if: true + with: + limit-access-to-actor: true - name: Run Wallet tests run: | yarn run lerna --scope '@celo/wallet-*' run test - pre_protocol_test_release: + pre-protocol-test-release: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks] + needs: [lint-checks] outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -193,13 +190,10 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node + - name: Sync workspace + uses: ./.github/actions/sync-workspace with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Check if the test should run id: protocol-test-must-run run: | @@ -229,9 +223,9 @@ jobs: protocol-test-release: name: Protocol Test Release runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks, pre_protocol_test_release] + needs: [lint-checks, pre-protocol-test-release] if: | - false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' steps: - uses: actions/cache/restore@v3 id: cache_git @@ -239,13 +233,10 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node + - name: Sync workspace + uses: ./.github/actions/sync-workspace with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - uses: actions/cache/restore@v3 id: cache_protocol with: @@ -263,9 +254,9 @@ jobs: protocol-test-matrix: name: Protocol Test Matrix runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks, pre_protocol_test_release] + needs: [lint-checks, pre-protocol-test-release] if: | - false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' strategy: matrix: include: @@ -305,7 +296,11 @@ jobs: with: path: .git key: git-${{ github.ref }} - - uses: ./.github/actions/sync-workspace + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - uses: actions/cache/restore@v3 id: cache_protocol with: @@ -317,9 +312,9 @@ jobs: # protocol-test-common: # name: Protocol Test Unit tests # runs-on: ["self-hosted", "monorepo"] - # needs: [lint_checks, pre_protocol_test_release] + # needs: [lint-checks, pre-protocol-test-release] # if: | - # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' # steps: # - uses: actions/cache/restore@v3 # id: cache_git @@ -333,7 +328,7 @@ jobs: # path: | # node_modules # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install-dependencies.outputs.package-json-checksum }} # - uses: actions/cache/restore@v3 # id: cache_protocol # with: @@ -345,9 +340,9 @@ jobs: # protocol-test-compatibility: # name: Protocol Test Compatibility # runs-on: ["self-hosted", "monorepo"] - # needs: [lint_checks, pre_protocol_test_release] + # needs: [lint-checks, pre-protocol-test-release] # if: | - # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' # steps: # - uses: actions/cache/restore@v3 # id: cache_git @@ -361,7 +356,7 @@ jobs: # path: | # node_modules # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install-dependencies.outputs.package-json-checksum }} # - uses: actions/cache/restore@v3 # id: cache_protocol # with: @@ -373,9 +368,9 @@ jobs: # protocol-test-governance-network: # name: Protocol Test Governance Network # runs-on: ["self-hosted", "monorepo"] - # needs: [lint_checks, pre_protocol_test_release] + # needs: [lint-checks, pre-protocol-test-release] # if: | - # false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + # false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' # steps: # - uses: actions/cache/restore@v3 # id: cache_git @@ -389,7 +384,7 @@ jobs: # path: | # node_modules # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install-dependencies.outputs.package-json-checksum }} # - uses: actions/cache/restore@v3 # id: cache_protocol # with: @@ -402,9 +397,9 @@ jobs: protocol-test-with-code-coverage: name: Protocol Test with code coverage runs-on: ["self-hosted", "monorepo"] - needs: [lint_checks, pre_protocol_test_release] + needs: [lint-checks, pre-protocol-test-release] if: | - false && needs.pre_protocol_test_release.outputs.protocol-test-must-run == 'true' + false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' steps: - uses: actions/cache/restore@v3 id: cache_git @@ -412,13 +407,10 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 - - uses: actions/cache/restore@v3 - id: cache_node + - name: Sync workspace + uses: ./.github/actions/sync-workspace with: - path: | - node_modules - packages - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - uses: actions/cache/restore@v3 id: cache_protocol with: @@ -432,3 +424,18 @@ jobs: with: name: Protocol Test Coverage path: packages/protocol/coverage + contractkit-tests: + name: Protocol Test with code coverage + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} \ No newline at end of file From 5ccbe0188c072ac54374fd39a8c907d6dd6225f3 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 11:02:30 +0000 Subject: [PATCH 053/154] debug wallet --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index d9902cd2fb8..4b36da783b9 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -84,7 +84,7 @@ jobs: run: yarn install if: steps.cache_node.outputs.cache-hit != 'true' - name: Run yarn postinstall if cache hitted - run: yarn install postinstall + run: yarn run postinstall if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh From 6a57fb8fc28d15569054f462ff747998a2358168 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 14:20:03 +0000 Subject: [PATCH 054/154] Test matrix --- .github/workflows/circleci.yml | 66 ++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4b36da783b9..5ea05098daa 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -171,7 +171,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 30 - if: true + if: false with: limit-access-to-actor: true - name: Run Wallet tests @@ -225,7 +225,7 @@ jobs: runs-on: ["self-hosted", "monorepo"] needs: [lint-checks, pre-protocol-test-release] if: | - false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' steps: - uses: actions/cache/restore@v3 id: cache_git @@ -252,11 +252,11 @@ jobs: BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout protocol-test-matrix: - name: Protocol Test Matrix + name: Protocol Test Matrix - ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] needs: [lint-checks, pre-protocol-test-release] if: | - false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' strategy: matrix: include: @@ -425,9 +425,33 @@ jobs: name: Protocol Test Coverage path: packages/protocol/coverage contractkit-tests: - name: Protocol Test with code coverage + name: ContractKit Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + if: false + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Generate DevChain + run: | + cd packages/sdk/contractkit + yarn test:reset + - name: Run tests + run: | + yarn --cwd=packages/sdk/contractkit test + identity-tests: + name: Identity Tests runs-on: ["self-hosted", "monorepo"] needs: [install-dependencies] + if: false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -438,4 +462,34 @@ jobs: - name: Sync workspace uses: ./.github/actions/sync-workspace with: - package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} \ No newline at end of file + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Generate DevChain + run: | + cd packages/sdk/identity + yarn test:reset + - name: Run tests + run: | + yarn --cwd=packages/sdk/identity test + transactions-uri-tests: + name: Transaction URI Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + if: false + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Generate DevChain + run: | + cd packages/sdk/identity + yarn test:reset + - name: Run tests + run: | + yarn --cwd=packages/sdk/identity test From 89ffa4269d547743da8f3e9c941283dc4735607e Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 15:37:43 +0000 Subject: [PATCH 055/154] Running more tests --- .github/workflows/circleci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5ea05098daa..bda76f423f0 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -399,7 +399,7 @@ jobs: runs-on: ["self-hosted", "monorepo"] needs: [lint-checks, pre-protocol-test-release] if: | - false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' steps: - uses: actions/cache/restore@v3 id: cache_git @@ -428,7 +428,6 @@ jobs: name: ContractKit Tests runs-on: ["self-hosted", "monorepo"] needs: [install-dependencies] - if: false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -451,7 +450,6 @@ jobs: name: Identity Tests runs-on: ["self-hosted", "monorepo"] needs: [install-dependencies] - if: false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -474,7 +472,6 @@ jobs: name: Transaction URI Tests runs-on: ["self-hosted", "monorepo"] needs: [install-dependencies] - if: false steps: - uses: actions/cache/restore@v3 id: cache_git From 2024197ddca8f3386b1b543bc89431d53046bac4 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 16:12:25 +0000 Subject: [PATCH 056/154] More tests --- .github/workflows/circleci.yml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index bda76f423f0..b37d329175e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -490,3 +490,42 @@ jobs: - name: Run tests run: | yarn --cwd=packages/sdk/identity test + cli-tests: + name: CeloCli Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Generate DevChain + run: | + cd packages/cli + yarn test:reset + - name: Run tests + run: | + yarn --cwd=packages/cli test + - name: Fail if someone forgot to commit CLI docs + run: | + yarn --cwd=packages/cli docs + if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then + git --no-pager diff packages/docs/command-line-interface + echo "There are git differences after generating CLI docs" + exit 1 + fi + - name: Verify that a new account can be created + run: | + yarn --cwd=packages/cli run celocli account:new + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: true + with: + limit-access-to-actor: true From 83f5b9fcb5ce84a711a1e3c922e01ecec68d9830 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 9 May 2023 16:32:30 +0000 Subject: [PATCH 057/154] Switch to protocol restore cache --- .github/workflows/circleci.yml | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index b37d329175e..cae06f5effc 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -234,14 +234,9 @@ jobs: key: git-${{ github.ref }} - uses: actions/checkout@v3 - name: Sync workspace - uses: ./.github/actions/sync-workspace + uses: ./.github/actions/protocol-sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - uses: actions/cache/restore@v3 - id: cache_protocol - with: - path: packages/protocol/.tmp/released_chain - key: protocol-${{ github.sha }} - name: Copy DevChain and Build generated from released tag run: | BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) @@ -298,14 +293,9 @@ jobs: key: git-${{ github.ref }} - uses: actions/checkout@v3 - name: Sync workspace - uses: ./.github/actions/sync-workspace - with: - package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - uses: actions/cache/restore@v3 - id: cache_protocol + uses: ./.github/actions/protocol-sync-workspace with: - path: packages/protocol/.tmp/released_chain - key: protocol-${{ github.sha }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Execute matrix command for test run: | ${{ matrix.command }} @@ -408,14 +398,9 @@ jobs: key: git-${{ github.ref }} - uses: actions/checkout@v3 - name: Sync workspace - uses: ./.github/actions/sync-workspace - with: - package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - uses: actions/cache/restore@v3 - id: cache_protocol + uses: ./.github/actions/protocol-sync-workspace with: - path: packages/protocol/.tmp/released_chain - key: protocol-${{ github.sha }} + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Run unit tests with code coverage run: | yarn --cwd packages/protocol test:coverage @@ -529,3 +514,10 @@ jobs: if: true with: limit-access-to-actor: true + # - name: Install and test the npm package + # run: | + # cd packages/cli + # yarn pack + # cd $RUNNER_TEMP + # npm install $RUNNER_WORKSPACE/packages/cli/celo-cli-*.tgz + # npx celocli account:new From e77a0a629c12a157e351e3c3cdb603dd80f12c3b Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 07:32:51 +0000 Subject: [PATCH 058/154] Debug prepare protocol test --- .github/workflows/circleci.yml | 64 +++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index cae06f5effc..e3190e2e412 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -180,7 +180,7 @@ jobs: pre-protocol-test-release: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] - needs: [lint-checks] + needs: [install-dependencies, lint-checks] outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -210,6 +210,12 @@ jobs: key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: true + with: + limit-access-to-actor: true - name: Opcode tests run: | yarn --cwd packages/protocol check-opcodes @@ -223,7 +229,7 @@ jobs: protocol-test-release: name: Protocol Test Release runs-on: ["self-hosted", "monorepo"] - needs: [lint-checks, pre-protocol-test-release] + needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' steps: @@ -249,7 +255,7 @@ jobs: protocol-test-matrix: name: Protocol Test Matrix - ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] - needs: [lint-checks, pre-protocol-test-release] + needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' strategy: @@ -387,7 +393,7 @@ jobs: protocol-test-with-code-coverage: name: Protocol Test with code coverage runs-on: ["self-hosted", "monorepo"] - needs: [lint-checks, pre-protocol-test-release] + needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' steps: @@ -511,9 +517,57 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false + with: + limit-access-to-actor: true + # TODO(jcortejoso): Review later + # - name: Install and test the npm package + # run: | + # cd packages/cli + # yarn pack + # cd $RUNNER_TEMP + # npm install $RUNNER_WORKSPACE/packages/cli/celo-cli-*.tgz + # npx celocli account:new + typescript-tests: + name: Typescript package Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Generate DevChain + run: | + cd packages/cli + yarn test:reset + - name: Run tests + run: | + yarn --cwd=packages/cli test + - name: Fail if someone forgot to commit CLI docs + run: | + yarn --cwd=packages/cli docs + if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then + git --no-pager diff packages/docs/command-line-interface + echo "There are git differences after generating CLI docs" + exit 1 + fi + - name: Verify that a new account can be created + run: | + yarn --cwd=packages/cli run celocli account:new + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: false with: limit-access-to-actor: true + # TODO(jcortejoso): Review later # - name: Install and test the npm package # run: | # cd packages/cli From 7e55f96c4945173ba653806fee6cc41cdb02300d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 07:44:32 +0000 Subject: [PATCH 059/154] Debug --- .github/workflows/circleci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index e3190e2e412..94e61dce468 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -77,7 +77,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: false + if: true with: limit-access-to-actor: true - name: Install yarn dependencies @@ -210,12 +210,6 @@ jobs: key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: true - with: - limit-access-to-actor: true - name: Opcode tests run: | yarn --cwd packages/protocol check-opcodes From 95ace9442981ac809ea0ca28a88e26d542afedba Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 07:46:53 +0000 Subject: [PATCH 060/154] Bump cache version --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 94e61dce468..5656b02eeb5 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -20,7 +20,7 @@ defaults: env: # Increment these to force cache rebuilding - NODE_MODULE_CACHE_VERSION: 1 + NODE_MODULE_CACHE_VERSION: 2 NODE_OPTIONS: '--max-old-space-size=4096' TERM: dumb GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"' From 18092fc8874510111064e9b287fa4ae5d7238527 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 07:51:04 +0000 Subject: [PATCH 061/154] Debug cache --- .github/workflows/circleci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5656b02eeb5..f99595b3ba4 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -74,10 +74,11 @@ jobs: # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- + # For debugging cache issues - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - if: true + if: false with: limit-access-to-actor: true - name: Install yarn dependencies From 4b53eff23280710207105a566d35c40b0ef71568 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 08:28:57 +0000 Subject: [PATCH 062/154] WIP --- .github/workflows/circleci.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f99595b3ba4..d060355c1b7 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -195,26 +195,40 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Check if the test should run + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + fetch_depth: "100" + - name: Export protocol test must run id: protocol-test-must-run + if: steps.changed-files.outputs.files-changed.contains('packages/protocol') run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions # ./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol echo "Protocol tests runs always" echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" + - name: Export protocol test must not run + id: protocol-test-must-run + if: !steps.changed-files.outputs.files-changed.contains('packages/protocol') + run: | + echo "PROTOCOL_TEST_MUST_RUN=false" >> "$GITHUB_OUTPUT" - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol + if: steps.changed-files.outputs.files-changed.contains('packages/protocol') with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - name: Opcode tests + if: steps.changed-files.outputs.files-changed.contains('packages/protocol') run: | yarn --cwd packages/protocol check-opcodes - name: Generate devchain of previous release + if: steps.changed-files.outputs.files-changed.contains('packages/protocol') run: | echo "Comparing against $RELEASE_TAG" # Github has phased out the git protocol so we ensure that we use From 4f4899fed2187b799a4588f75610a98c853594f6 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 08:30:56 +0000 Subject: [PATCH 063/154] fix --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index d060355c1b7..f1fc42c7e84 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -210,7 +210,7 @@ jobs: echo "Protocol tests runs always" echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" - name: Export protocol test must not run - id: protocol-test-must-run + id: protocol-test-must-not-run if: !steps.changed-files.outputs.files-changed.contains('packages/protocol') run: | echo "PROTOCOL_TEST_MUST_RUN=false" >> "$GITHUB_OUTPUT" From e80184f83bd582a8a1cd6abf5b914bd083fce270 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 08:32:27 +0000 Subject: [PATCH 064/154] wip --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f1fc42c7e84..c6a76f9cbba 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -211,7 +211,7 @@ jobs: echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" - name: Export protocol test must not run id: protocol-test-must-not-run - if: !steps.changed-files.outputs.files-changed.contains('packages/protocol') + if: ${{ !steps.changed-files.outputs.files-changed.contains('packages/protocol') }} run: | echo "PROTOCOL_TEST_MUST_RUN=false" >> "$GITHUB_OUTPUT" - name: Cache protocol devchain From 4ae55bccb7d30a6ed352ec94a2ce6da6104d3ee9 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 08:33:46 +0000 Subject: [PATCH 065/154] test --- .github/workflows/circleci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index c6a76f9cbba..9a7e699ec43 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -202,18 +202,12 @@ jobs: fetch_depth: "100" - name: Export protocol test must run id: protocol-test-must-run - if: steps.changed-files.outputs.files-changed.contains('packages/protocol') run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions # ./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol echo "Protocol tests runs always" - echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" - - name: Export protocol test must not run - id: protocol-test-must-not-run - if: ${{ !steps.changed-files.outputs.files-changed.contains('packages/protocol') }} - run: | - echo "PROTOCOL_TEST_MUST_RUN=false" >> "$GITHUB_OUTPUT" + echo "PROTOCOL_TEST_MUST_RUN=${{steps.changed-files.outputs.files-changed.contains('packages/protocol')}}" >> "$GITHUB_OUTPUT" - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol From b906deeb68cb10112040455f268eeb2882bce843 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 08:39:19 +0000 Subject: [PATCH 066/154] debug --- .github/workflows/circleci.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9a7e699ec43..8ad99044f49 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -200,29 +200,46 @@ jobs: uses: tj-actions/changed-files@v35 with: fetch_depth: "100" + - name: List all changed files + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: false + with: + limit-access-to-actor: true - name: Export protocol test must run id: protocol-test-must-run + if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions # ./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol echo "Protocol tests runs always" - echo "PROTOCOL_TEST_MUST_RUN=${{steps.changed-files.outputs.files-changed.contains('packages/protocol')}}" >> "$GITHUB_OUTPUT" + echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" + - name: Export protocol test must not run + id: protocol-test-must-not-run + if: !contains(steps.changed-files.outputs.files-changed, 'packages/protocol') + run: | + echo "PROTOCOL_TEST_MUST_RUN=false" >> "$GITHUB_OUTPUT" - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol - if: steps.changed-files.outputs.files-changed.contains('packages/protocol') + if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - name: Opcode tests - if: steps.changed-files.outputs.files-changed.contains('packages/protocol') + if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') run: | yarn --cwd packages/protocol check-opcodes - name: Generate devchain of previous release - if: steps.changed-files.outputs.files-changed.contains('packages/protocol') + if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') run: | echo "Comparing against $RELEASE_TAG" # Github has phased out the git protocol so we ensure that we use From 922e7cbb4fd6b763f97a8f8aa6d0268b8166e649 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 08:42:42 +0000 Subject: [PATCH 067/154] debug --- .github/workflows/circleci.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 8ad99044f49..791a3dab086 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -213,33 +213,28 @@ jobs: limit-access-to-actor: true - name: Export protocol test must run id: protocol-test-must-run - if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions # ./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol echo "Protocol tests runs always" echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" - - name: Export protocol test must not run - id: protocol-test-must-not-run - if: !contains(steps.changed-files.outputs.files-changed, 'packages/protocol') - run: | - echo "PROTOCOL_TEST_MUST_RUN=false" >> "$GITHUB_OUTPUT" - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol - if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - name: Opcode tests - if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') run: | yarn --cwd packages/protocol check-opcodes - name: Generate devchain of previous release - if: contains(steps.changed-files.outputs.files-changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') run: | echo "Comparing against $RELEASE_TAG" # Github has phased out the git protocol so we ensure that we use From 1e6a16f5f7373d4149407321a9586a02670e7c90 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 09:02:54 +0000 Subject: [PATCH 068/154] More tests --- .github/workflows/circleci.yml | 43 +++++++--------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 791a3dab086..597d57ed913 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -74,13 +74,6 @@ jobs: # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- - # For debugging cache issues - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 10 - if: false - with: - limit-access-to-actor: true - name: Install yarn dependencies run: yarn install if: steps.cache_node.outputs.cache-hit != 'true' @@ -89,6 +82,10 @@ jobs: if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh + - name: Fail if any file changed on git + run: | + # This fails if there is any change + git diff-index --quiet HEAD -- - name: Build packages run: yarn build --ignore docs --include-dependencies - name: Check licenses @@ -169,12 +166,6 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 30 - if: false - with: - limit-access-to-actor: true - name: Run Wallet tests run: | yarn run lerna --scope '@celo/wallet-*' run test @@ -200,20 +191,10 @@ jobs: uses: tj-actions/changed-files@v35 with: fetch_depth: "100" - - name: List all changed files - run: | - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - echo "$file was changed" - done - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: false - with: - limit-access-to-actor: true - name: Export protocol test must run id: protocol-test-must-run - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') + # TODO(jcortejoso): Remove true + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions @@ -223,18 +204,18 @@ jobs: - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - name: Opcode tests - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true run: | yarn --cwd packages/protocol check-opcodes - name: Generate devchain of previous release - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true run: | echo "Comparing against $RELEASE_TAG" # Github has phased out the git protocol so we ensure that we use @@ -529,12 +510,6 @@ jobs: - name: Verify that a new account can be created run: | yarn --cwd=packages/cli run celocli account:new - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: false - with: - limit-access-to-actor: true # TODO(jcortejoso): Review later # - name: Install and test the npm package # run: | From 684e680aeedc5650eec55fd8bf3e83a51484661c Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 09:10:06 +0000 Subject: [PATCH 069/154] debug --- .github/workflows/circleci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 597d57ed913..aae092ab644 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -82,6 +82,12 @@ jobs: if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: true + with: + limit-access-to-actor: true - name: Fail if any file changed on git run: | # This fails if there is any change From 21ac38c25874e28c1c4393c21cbf78e715536b0e Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 09:17:15 +0000 Subject: [PATCH 070/154] debug --- .github/workflows/circleci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index aae092ab644..6d2c8abe7bb 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -60,9 +60,9 @@ jobs: - name: Calculate node cache keys id: node-checksums run: | - find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > package.checksum - find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > patches.checksum - echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('*.checksum') }}" >> "$GITHUB_OUTPUT" + find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > $RUNNER_TEMP/package.checksum + find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > $RUNNER_TEMP/patches.checksum + echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('$RUNNER_TEMP/*.checksum') }}" >> "$GITHUB_OUTPUT" - name: Restore node cache uses: actions/cache@v3 id: cache_node @@ -85,7 +85,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Fail if any file changed on git From 4739f3352922d2dcf7e617a71b6d638e91d7bbc8 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 09:35:48 +0000 Subject: [PATCH 071/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 6d2c8abe7bb..85e0d3a4f65 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -85,7 +85,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: false + if: true with: limit-access-to-actor: true - name: Fail if any file changed on git From 567fcef42badb4e480049f2011ab67d797a43677 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 09:39:49 +0000 Subject: [PATCH 072/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 85e0d3a4f65..6d2c8abe7bb 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -85,7 +85,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Fail if any file changed on git From cfda63bababa137e2703f02c214295d4ee4b862a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 09:42:04 +0000 Subject: [PATCH 073/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 6d2c8abe7bb..0dda7657048 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -91,7 +91,7 @@ jobs: - name: Fail if any file changed on git run: | # This fails if there is any change - git diff-index --quiet HEAD -- + git diff-index HEAD -- - name: Build packages run: yarn build --ignore docs --include-dependencies - name: Check licenses From fea5a4443d9d84c5d765be3e8c1a157fa9c03383 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 10:05:44 +0000 Subject: [PATCH 074/154] wip --- .../protocol-sync-workspace/action.yml | 2 +- .github/workflows/circleci.yml | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/actions/protocol-sync-workspace/action.yml b/.github/actions/protocol-sync-workspace/action.yml index cb49b5e3df3..7516a3dda73 100644 --- a/.github/actions/protocol-sync-workspace/action.yml +++ b/.github/actions/protocol-sync-workspace/action.yml @@ -10,7 +10,7 @@ runs: - name: Sync workspace uses: ./.github/actions/sync-workspace with: - package-json-checksum: ${{ needs.install_dependencies.outputs.package-json-checksum }} + package-json-checksum: ${{ inputs.package-json-checksum }} - uses: actions/cache/restore@v3 id: cache_protocol with: diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 0dda7657048..860603bca3e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -571,3 +571,53 @@ jobs: # cd $RUNNER_TEMP # npm install $RUNNER_WORKSPACE/packages/cli/celo-cli-*.tgz # npx celocli account:new + + base-test: + name: SDK Base package Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Install and test the npm package + run: | + set -euo pipefail + cd packages/sdk/base + yarn pack + cd $RUNNER_TEMP + npm install $RUNNER_WORKSPACE/packages/base/*.tgz + + utils-test: + name: SDK Base package Tests + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Install and test the npm package + run: | + set -euo pipefail + cd packages/sdk/base + yarn pack + cd ../utils + yarn pack + cd $RUNNER_TEMP + npm install $RUNNER_WORKSPACE/packages/base/*.tgz + npm install $RUNNER_WORKSPACE/packages/utils/*.tgz + From fbebf7786a7e71fd6ddeb14a29e7b45fe6567a8e Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 12:47:40 +0000 Subject: [PATCH 075/154] Using relative path --- .github/workflows/circleci.yml | 113 +++++--------------- packages/protocol/scripts/check-backward.ts | 4 +- 2 files changed, 30 insertions(+), 87 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 860603bca3e..dfa0a2e77fc 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -26,6 +26,7 @@ env: GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"' # Git Tag for contract release to use RELEASE_TAG: core-contracts.v9 + CELO_BLOCKCHAIN_BRANCH_TO_TEST: master jobs: install-dependencies: @@ -307,90 +308,6 @@ jobs: - name: Execute matrix command for test run: | ${{ matrix.command }} - # protocol-test-common: - # name: Protocol Test Unit tests - # runs-on: ["self-hosted", "monorepo"] - # needs: [lint-checks, pre-protocol-test-release] - # if: | - # false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' - # steps: - # - uses: actions/cache/restore@v3 - # id: cache_git - # with: - # path: .git - # key: git-${{ github.ref }} - # - uses: actions/checkout@v3 - # - uses: actions/cache/restore@v3 - # id: cache_node - # with: - # path: | - # node_modules - # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install-dependencies.outputs.package-json-checksum }} - # - uses: actions/cache/restore@v3 - # id: cache_protocol - # with: - # path: packages/protocol/.tmp/released_chain - # key: protocol-${{ github.sha }} - # - name: Unit tests - # run: | - # yarn --cwd packages/protocol test common/ - # protocol-test-compatibility: - # name: Protocol Test Compatibility - # runs-on: ["self-hosted", "monorepo"] - # needs: [lint-checks, pre-protocol-test-release] - # if: | - # false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' - # steps: - # - uses: actions/cache/restore@v3 - # id: cache_git - # with: - # path: .git - # key: git-${{ github.ref }} - # - uses: actions/checkout@v3 - # - uses: actions/cache/restore@v3 - # id: cache_node - # with: - # path: | - # node_modules - # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install-dependencies.outputs.package-json-checksum }} - # - uses: actions/cache/restore@v3 - # id: cache_protocol - # with: - # path: packages/protocol/.tmp/released_chain - # key: protocol-${{ github.sha }} - # - name: Run protocol compatibility tests - # run: | - # yarn --cwd packages/protocol test compatibility/ - # protocol-test-governance-network: - # name: Protocol Test Governance Network - # runs-on: ["self-hosted", "monorepo"] - # needs: [lint-checks, pre-protocol-test-release] - # if: | - # false && needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' - # steps: - # - uses: actions/cache/restore@v3 - # id: cache_git - # with: - # path: .git - # key: git-${{ github.ref }} - # - uses: actions/checkout@v3 - # - uses: actions/cache/restore@v3 - # id: cache_node - # with: - # path: | - # node_modules - # packages - # key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ needs.install-dependencies.outputs.package-json-checksum }} - # - uses: actions/cache/restore@v3 - # id: cache_protocol - # with: - # path: packages/protocol/.tmp/released_chain - # key: protocol-${{ github.sha }} - # - name: Run protocol compatibility tests - # run: | - # yarn --cwd packages/protocol test governance/network/ protocol-test-with-code-coverage: name: Protocol Test with code coverage @@ -587,6 +504,12 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: false + with: + limit-access-to-actor: true - name: Install and test the npm package run: | set -euo pipefail @@ -596,7 +519,7 @@ jobs: npm install $RUNNER_WORKSPACE/packages/base/*.tgz utils-test: - name: SDK Base package Tests + name: SDK Utils package Tests runs-on: ["self-hosted", "monorepo"] needs: [install-dependencies] steps: @@ -621,3 +544,23 @@ jobs: npm install $RUNNER_WORKSPACE/packages/base/*.tgz npm install $RUNNER_WORKSPACE/packages/utils/*.tgz + end-to-end-geth-transfer-test: + name: Celo-Blockchain E2E Transfer test + runs-on: ["self-hosted", "monorepo"] + needs: [install-dependencies, lint-checks, contractkit-tests] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Run tests + run: | + set -e + cd packages/celotool + ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} diff --git a/packages/protocol/scripts/check-backward.ts b/packages/protocol/scripts/check-backward.ts index 9f61c95d20a..66ad158bc05 100644 --- a/packages/protocol/scripts/check-backward.ts +++ b/packages/protocol/scripts/check-backward.ts @@ -49,8 +49,8 @@ const argv = yargs .demandCommand() .strict().argv -const oldArtifactsFolder = path.resolve(argv.old_contracts) -const newArtifactsFolder = path.resolve(argv.new_contracts) +const oldArtifactsFolder = path.relative(process.cwd(), argv.old_contracts) +const newArtifactsFolder = path.relative(process.cwd(), argv.new_contracts) const out = (msg: string, force?: boolean): void => { if (force || !argv.quiet) { From 36414535607f2e8f732c464b0f907cdca5ee3229 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 13:11:28 +0000 Subject: [PATCH 076/154] debug --- .github/workflows/circleci.yml | 86 ++++++++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 10 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index dfa0a2e77fc..4bf1c9c071a 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -92,7 +92,10 @@ jobs: - name: Fail if any file changed on git run: | # This fails if there is any change - git diff-index HEAD -- + if ! git diff-index HEAD --; then + echo "Git changes detected while building. If this is unexpected, bump NODE_MODULE_CACHE_VERSION in .github/workflows/circleci.yml" + exit 1 + fi - name: Build packages run: yarn build --ignore docs --include-dependencies - name: Check licenses @@ -507,7 +510,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: false + if: true with: limit-access-to-actor: true - name: Install and test the npm package @@ -544,10 +547,75 @@ jobs: npm install $RUNNER_WORKSPACE/packages/base/*.tgz npm install $RUNNER_WORKSPACE/packages/utils/*.tgz - end-to-end-geth-transfer-test: - name: Celo-Blockchain E2E Transfer test + # end-to-end-geth-transfer-test: + # name: Celo-Blockchain E2E Transfer test + # runs-on: ["self-hosted", "monorepo"] + # needs: [install-dependencies, lint-checks, contractkit-tests] + # steps: + # - uses: actions/cache/restore@v3 + # id: cache_git + # with: + # path: .git + # key: git-${{ github.ref }} + # - uses: actions/checkout@v3 + # - name: Sync workspace + # uses: ./.github/actions/sync-workspace + # with: + # package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + # - name: Run tests + # run: | + # set -e + # cd packages/celotool + # ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + end-to-end-geth-matrix: + name: Celo Blockchain e2e Test Matrix - ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] - needs: [install-dependencies, lint-checks, contractkit-tests] + needs: [install-dependencies, lint-checks, pre-protocol-test-release] + if: | + needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + strategy: + matrix: + include: + - name: Transfer test + command: | + set -e + cd packages/celotool + ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: Blockchain Parameters test + commnd: | + set -e + cd packages/celotool + ./ci_test_blockchain_parameters.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: Slashing test + commnd: | + set -e + cd packages/celotool + ./ci_test_slashing.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: Governance test + commnd: | + set -e + cd packages/celotool + ./ci_test_governance.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: Replica test + commnd: | + set -e + cd packages/celotool + ./ci_test_replicas.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: Sync test + commnd: | + set -e + cd packages/celotool + ./ci_test_sync.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: Validator order test + commnd: | + set -e + cd packages/celotool + ./ci_test_validator_order.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + - name: CIP35 eth compatibility test + commnd: | + set -e + cd packages/celotool + ./ci_test_cip35.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} steps: - uses: actions/cache/restore@v3 id: cache_git @@ -556,11 +624,9 @@ jobs: key: git-${{ github.ref }} - uses: actions/checkout@v3 - name: Sync workspace - uses: ./.github/actions/sync-workspace + uses: ./.github/actions/protocol-sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Run tests + - name: Execute matrix command for test run: | - set -e - cd packages/celotool - ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} + ${{ matrix.command }} From 1075ffddcaec8a544ab92c20940ed1f17ed1bf22 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 13:24:53 +0000 Subject: [PATCH 077/154] Fixed sdk package installs --- .github/workflows/circleci.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4bf1c9c071a..d696cb8cf59 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -35,6 +35,7 @@ jobs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # runs-on: ubuntu-latest runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 steps: - name: Restore .git cache uses: actions/cache@v3 @@ -92,7 +93,7 @@ jobs: - name: Fail if any file changed on git run: | # This fails if there is any change - if ! git diff-index HEAD --; then + if ! git diff-index --quiet HEAD --; then echo "Git changes detected while building. If this is unexpected, bump NODE_MODULE_CACHE_VERSION in .github/workflows/circleci.yml" exit 1 fi @@ -112,6 +113,7 @@ jobs: lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: install-dependencies steps: # Restore .git cache as we need to checkout the local composite action to run it: @@ -164,6 +166,7 @@ jobs: wallet-test: name: Wallet test runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: install-dependencies steps: - uses: actions/cache/restore@v3 @@ -182,6 +185,7 @@ jobs: pre-protocol-test-release: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies, lint-checks] outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} @@ -235,6 +239,7 @@ jobs: protocol-test-release: name: Protocol Test Release runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' @@ -261,6 +266,7 @@ jobs: protocol-test-matrix: name: Protocol Test Matrix - ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' @@ -315,6 +321,7 @@ jobs: protocol-test-with-code-coverage: name: Protocol Test with code coverage runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' @@ -340,6 +347,7 @@ jobs: contractkit-tests: name: ContractKit Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -362,6 +370,7 @@ jobs: identity-tests: name: Identity Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -384,6 +393,7 @@ jobs: transactions-uri-tests: name: Transaction URI Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -406,6 +416,7 @@ jobs: cli-tests: name: CeloCli Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -447,6 +458,7 @@ jobs: typescript-tests: name: Typescript package Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -495,6 +507,7 @@ jobs: base-test: name: SDK Base package Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -510,7 +523,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Install and test the npm package @@ -519,11 +532,12 @@ jobs: cd packages/sdk/base yarn pack cd $RUNNER_TEMP - npm install $RUNNER_WORKSPACE/packages/base/*.tgz + npm install $RUNNER_WORKSPACE/packages/sdk/base/*.tgz utils-test: name: SDK Utils package Tests runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies] steps: - uses: actions/cache/restore@v3 @@ -544,8 +558,8 @@ jobs: cd ../utils yarn pack cd $RUNNER_TEMP - npm install $RUNNER_WORKSPACE/packages/base/*.tgz - npm install $RUNNER_WORKSPACE/packages/utils/*.tgz + npm install $RUNNER_WORKSPACE/packages/sdk/base/*.tgz + npm install $RUNNER_WORKSPACE/packages/sdk/utils/*.tgz # end-to-end-geth-transfer-test: # name: Celo-Blockchain E2E Transfer test @@ -570,6 +584,7 @@ jobs: end-to-end-geth-matrix: name: Celo Blockchain e2e Test Matrix - ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' From c37c0b7a13a799144262e4a9dae638423b7d92af Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 14:18:00 +0000 Subject: [PATCH 078/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index d696cb8cf59..835d40d1ae5 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -87,7 +87,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: false + if: true with: limit-access-to-actor: true - name: Fail if any file changed on git From a5ff83d7a5e55a01e28d68b5158a2ba92ead415c Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 14:36:54 +0000 Subject: [PATCH 079/154] Testing partial cache --- .github/actions/sync-workspace/action.yml | 3 ++- .github/workflows/circleci.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index bf24a121716..e72b89077e3 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -12,5 +12,6 @@ runs: with: path: | node_modules - packages + packages/**/node_modules + packages/**/lib key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 835d40d1ae5..f51032bfbfd 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -71,7 +71,8 @@ jobs: with: path: | node_modules - packages + packages/**/node_modules + packages/**/lib key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | From 5ad9b50f92850c5ac7406ee5b6379c5b81bf4488 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 14:37:57 +0000 Subject: [PATCH 080/154] wip --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f51032bfbfd..5ba04fe8ce1 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -88,7 +88,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Fail if any file changed on git From bfb3a543ec0f8058e9f680f611419f0f3740d97b Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 14:43:27 +0000 Subject: [PATCH 081/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5ba04fe8ce1..f51032bfbfd 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -88,7 +88,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: false + if: true with: limit-access-to-actor: true - name: Fail if any file changed on git From 797da7f76cc086a86865ce720a4470d61856590a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 14:47:59 +0000 Subject: [PATCH 082/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f51032bfbfd..5ba04fe8ce1 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -88,7 +88,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Fail if any file changed on git From 7ecfb4ec66a0c17a798a89a060f99ea61eec3bcd Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 14:52:08 +0000 Subject: [PATCH 083/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5ba04fe8ce1..a8997cf2bd9 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -94,7 +94,7 @@ jobs: - name: Fail if any file changed on git run: | # This fails if there is any change - if ! git diff-index --quiet HEAD --; then + if ! git diff-index HEAD --; then echo "Git changes detected while building. If this is unexpected, bump NODE_MODULE_CACHE_VERSION in .github/workflows/circleci.yml" exit 1 fi From a43f101e9798311900a038d5c5c16efe7021fa23 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 15:05:50 +0000 Subject: [PATCH 084/154] Including dist/ in node cache --- .github/actions/sync-workspace/action.yml | 1 + .github/workflows/circleci.yml | 77 +++++++++++++---------- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index e72b89077e3..f6cc1e9137c 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -14,4 +14,5 @@ runs: node_modules packages/**/node_modules packages/**/lib + packages/**/dist key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index a8997cf2bd9..db4d5d4f576 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -73,6 +73,8 @@ jobs: node_modules packages/**/node_modules packages/**/lib + packages/**/dist + packages/**/ key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | @@ -361,11 +363,18 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + fetch_depth: "100" - name: Generate DevChain + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/contractkit') || true run: | cd packages/sdk/contractkit yarn test:reset - name: Run tests + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/contractkit') || true run: | yarn --cwd=packages/sdk/contractkit test identity-tests: @@ -384,11 +393,18 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + fetch_depth: "100" - name: Generate DevChain + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/identity') || true run: | cd packages/sdk/identity yarn test:reset - name: Run tests + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/identity') || true run: | yarn --cwd=packages/sdk/identity test transactions-uri-tests: @@ -407,11 +423,18 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + fetch_depth: "100" - name: Generate DevChain + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/sdk/transactions-uri') || true run: | cd packages/sdk/identity yarn test:reset - name: Run tests + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/sdk/transactions-uri') || true run: | yarn --cwd=packages/sdk/identity test cli-tests: @@ -430,14 +453,22 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + fetch_depth: "100" - name: Generate DevChain + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true run: | cd packages/cli yarn test:reset - name: Run tests + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true run: | yarn --cwd=packages/cli test - name: Fail if someone forgot to commit CLI docs + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true run: | yarn --cwd=packages/cli docs if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then @@ -446,10 +477,12 @@ jobs: exit 1 fi - name: Verify that a new account can be created + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true run: | yarn --cwd=packages/cli run celocli account:new # TODO(jcortejoso): Review later # - name: Install and test the npm package + # if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true # run: | # cd packages/cli # yarn pack @@ -472,39 +505,19 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Generate DevChain - run: | - cd packages/cli - yarn test:reset - - name: Run tests - run: | - yarn --cwd=packages/cli test - - name: Fail if someone forgot to commit CLI docs - run: | - yarn --cwd=packages/cli docs - if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then - git --no-pager diff packages/docs/command-line-interface - echo "There are git differences after generating CLI docs" - exit 1 - fi - - name: Verify that a new account can be created - run: | - yarn --cwd=packages/cli run celocli account:new - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: false + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 with: - limit-access-to-actor: true - # TODO(jcortejoso): Review later - # - name: Install and test the npm package - # run: | - # cd packages/cli - # yarn pack - # cd $RUNNER_TEMP - # npm install $RUNNER_WORKSPACE/packages/cli/celo-cli-*.tgz - # npx celocli account:new - + fetch_depth: "100" + - name: Install and test the npm package + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/typescript') || true + run: | + set -euo pipefail + cd packages/typescript + yarn pack + cd $RUNNER_TEMP + npm install $RUNNER_WORKSPACE/packages/typescript/*.tgz base-test: name: SDK Base package Tests runs-on: ["self-hosted", "monorepo"] From ffab3dc5b92679cac2f6cf86f8b5771adc6fbf6c Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 15:20:37 +0000 Subject: [PATCH 085/154] debug --- .github/workflows/circleci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index db4d5d4f576..18b067960d2 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -87,12 +87,6 @@ jobs: if: steps.cache_node.outputs.cache-hit == 'true' - name: Fail if generated dependency graph doesn't match committed run: ./scripts/ci_check_dependency_graph_changed.sh - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: false - with: - limit-access-to-actor: true - name: Fail if any file changed on git run: | # This fails if there is any change @@ -131,6 +125,12 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: true + with: + limit-access-to-actor: true - run: yarn run prettify:diff - run: yarn run lint general_test: From 85b9c77e62fd42024e36dd4630169020219d2894 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 15:35:45 +0000 Subject: [PATCH 086/154] debug --- .circleci/config.yml | 7 +------ .github/actions/protocol-sync-workspace/action.yml | 2 ++ .github/actions/sync-workspace/action.yml | 2 ++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ee0ea856572..2f34a81c692 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -183,12 +183,7 @@ jobs: root: . paths: - . - - - run: - name: Debug - command: | - exit 1 - + lint-checks: <<: *defaults resource_class: large diff --git a/.github/actions/protocol-sync-workspace/action.yml b/.github/actions/protocol-sync-workspace/action.yml index 7516a3dda73..c2b094a472c 100644 --- a/.github/actions/protocol-sync-workspace/action.yml +++ b/.github/actions/protocol-sync-workspace/action.yml @@ -16,3 +16,5 @@ runs: with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} + enableCrossOsArchive: true + fail-on-cache-miss: true diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index f6cc1e9137c..bb2dfeeafd5 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -16,3 +16,5 @@ runs: packages/**/lib packages/**/dist key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} + enableCrossOsArchive: true + fail-on-cache-miss: true From 798dbc75ad097b74834d63260cbd59f124f9890a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 15:46:45 +0000 Subject: [PATCH 087/154] debug --- .github/workflows/circleci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 18b067960d2..848ab6643e3 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -74,7 +74,6 @@ jobs: packages/**/node_modules packages/**/lib packages/**/dist - packages/**/ key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | From cdb957a38bf9839ea6db46e94ad2568eaec6d4a2 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 15:58:00 +0000 Subject: [PATCH 088/154] debug --- .github/workflows/circleci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 848ab6643e3..c773d78646a 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -124,12 +124,6 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: true - with: - limit-access-to-actor: true - run: yarn run prettify:diff - run: yarn run lint general_test: @@ -536,7 +530,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: false + if: true with: limit-access-to-actor: true - name: Install and test the npm package From 0aa2ed50263003effa0f0d78ecf5630ee9d2cca4 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 16:01:52 +0000 Subject: [PATCH 089/154] more cache --- .github/actions/sync-workspace/action.yml | 1 + .github/workflows/circleci.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index bb2dfeeafd5..ed5b9b98ecd 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -15,6 +15,7 @@ runs: packages/**/node_modules packages/**/lib packages/**/dist + packages/**/build key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} enableCrossOsArchive: true fail-on-cache-miss: true diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index c773d78646a..9195e9732b2 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -74,6 +74,7 @@ jobs: packages/**/node_modules packages/**/lib packages/**/dist + packages/**/build key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | From d45b47836ba4fff2a4ee3412c5d23a1ffbaf2889 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 16:07:35 +0000 Subject: [PATCH 090/154] more debug --- .github/workflows/circleci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9195e9732b2..f78257488ce 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -69,6 +69,8 @@ jobs: uses: actions/cache@v3 id: cache_node with: + # We need to cache all the artifacts generated by yarn install+build + # Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list path: | node_modules packages/**/node_modules @@ -452,6 +454,12 @@ jobs: uses: tj-actions/changed-files@v35 with: fetch_depth: "100" + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: true + with: + limit-access-to-actor: true - name: Generate DevChain if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true run: | From 65672643777699407fda5bfa281518e24ea5de65 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 16:33:17 +0000 Subject: [PATCH 091/154] more cache, ever --- .github/actions/sync-workspace/action.yml | 2 ++ .github/workflows/circleci.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index ed5b9b98ecd..a2b9b0764ae 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -16,6 +16,8 @@ runs: packages/**/lib packages/**/dist packages/**/build + packages/protocol/*.js + packages/protocol/**/*.js key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} enableCrossOsArchive: true fail-on-cache-miss: true diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f78257488ce..4971eb26650 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -77,6 +77,8 @@ jobs: packages/**/lib packages/**/dist packages/**/build + packages/protocol/*.js + packages/protocol/**/*.js key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | From ee1e2c09d536cec5970950be5b7aa3d6f77900c5 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 10 May 2023 16:51:20 +0000 Subject: [PATCH 092/154] Fixing tests --- .github/workflows/circleci.yml | 39 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4971eb26650..1ad05ee7519 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -371,6 +371,12 @@ jobs: run: | cd packages/sdk/contractkit yarn test:reset + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: true + with: + limit-access-to-actor: true - name: Run tests if: contains(steps.changed-files.outputs.all_files_changed, 'packages/contractkit') || true run: | @@ -456,12 +462,6 @@ jobs: uses: tj-actions/changed-files@v35 with: fetch_depth: "100" - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: true - with: - limit-access-to-actor: true - name: Generate DevChain if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true run: | @@ -485,14 +485,14 @@ jobs: run: | yarn --cwd=packages/cli run celocli account:new # TODO(jcortejoso): Review later - # - name: Install and test the npm package - # if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true - # run: | - # cd packages/cli - # yarn pack - # cd $RUNNER_TEMP - # npm install $RUNNER_WORKSPACE/packages/cli/celo-cli-*.tgz - # npx celocli account:new + - name: Install and test the npm package + if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true + run: | + cd packages/cli + yarn pack + cd $RUNNER_TEMP + npm install $RUNNER_WORKSPACE/celo-monorepo/packages/cli/celo-cli-*.tgz + npx celocli account:new typescript-tests: name: Typescript package Tests runs-on: ["self-hosted", "monorepo"] @@ -521,7 +521,7 @@ jobs: cd packages/typescript yarn pack cd $RUNNER_TEMP - npm install $RUNNER_WORKSPACE/packages/typescript/*.tgz + npm install $RUNNER_WORKSPACE/celo-monorepo/packages/typescript/*.tgz base-test: name: SDK Base package Tests runs-on: ["self-hosted", "monorepo"] @@ -541,7 +541,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Install and test the npm package @@ -550,8 +550,7 @@ jobs: cd packages/sdk/base yarn pack cd $RUNNER_TEMP - npm install $RUNNER_WORKSPACE/packages/sdk/base/*.tgz - + npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/base/*.tgz utils-test: name: SDK Utils package Tests runs-on: ["self-hosted", "monorepo"] @@ -576,8 +575,8 @@ jobs: cd ../utils yarn pack cd $RUNNER_TEMP - npm install $RUNNER_WORKSPACE/packages/sdk/base/*.tgz - npm install $RUNNER_WORKSPACE/packages/sdk/utils/*.tgz + npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/base/*.tgz + npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/utils/*.tgz # end-to-end-geth-transfer-test: # name: Celo-Blockchain E2E Transfer test From 73b47887d833bca61c56faa7c63cade86c634ecd Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 08:07:32 +0000 Subject: [PATCH 093/154] Contractkit specific cache --- .github/actions/sync-workspace/action.yml | 1 + .github/workflows/circleci.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index a2b9b0764ae..df314bca0ce 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -18,6 +18,7 @@ runs: packages/**/build packages/protocol/*.js packages/protocol/**/*.js + packages/sdk/contractkit/src/generated key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} enableCrossOsArchive: true fail-on-cache-miss: true diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 1ad05ee7519..f9fe8216b45 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -79,6 +79,7 @@ jobs: packages/**/build packages/protocol/*.js packages/protocol/**/*.js + packages/sdk/contractkit/src/generated key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # TODO(jcortejoso): Think if remove this, to start clean with any change in deps restore-keys: | From 9355277787d808864a84226de05e60bdd8c3b855 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 08:22:29 +0000 Subject: [PATCH 094/154] Do not debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f9fe8216b45..465c2ce2010 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -375,7 +375,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: true + if: false with: limit-access-to-actor: true - name: Run tests From 2214022d6b73a68a773297b97eeffecc8ba64460 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 09:14:09 +0000 Subject: [PATCH 095/154] Update contract reference to fix tests on other envs (github actions) --- .../protocol/releaseData/versionReports/release1-report.json | 4 ++-- .../protocol/releaseData/versionReports/release2-report.json | 4 ++-- .../protocol/releaseData/versionReports/release3-report.json | 4 ++-- .../protocol/releaseData/versionReports/release4-report.json | 4 ++-- .../protocol/releaseData/versionReports/release5-report.json | 4 ++-- .../protocol/releaseData/versionReports/release6-report.json | 4 ++-- .../protocol/releaseData/versionReports/release7-report.json | 4 ++-- .../protocol/releaseData/versionReports/release8-report.json | 4 ++-- .../protocol/releaseData/versionReports/release9-report.json | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/protocol/releaseData/versionReports/release1-report.json b/packages/protocol/releaseData/versionReports/release1-report.json index 9c97e31bab2..61119eb533b 100644 --- a/packages/protocol/releaseData/versionReports/release1-report.json +++ b/packages/protocol/releaseData/versionReports/release1-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v0/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v1/contracts", + "oldArtifactsFolder": "build/core-contracts.v0/contracts", + "newArtifactsFolder": "build/core-contracts.v1/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release2-report.json b/packages/protocol/releaseData/versionReports/release2-report.json index 6920add9e76..473108158a4 100644 --- a/packages/protocol/releaseData/versionReports/release2-report.json +++ b/packages/protocol/releaseData/versionReports/release2-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v1/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v2/contracts", + "oldArtifactsFolder": "build/core-contracts.v1/contracts", + "newArtifactsFolder": "build/core-contracts.v2/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release3-report.json b/packages/protocol/releaseData/versionReports/release3-report.json index 5e6864c2868..0be386af728 100644 --- a/packages/protocol/releaseData/versionReports/release3-report.json +++ b/packages/protocol/releaseData/versionReports/release3-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v2/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v3/contracts", + "oldArtifactsFolder": "build/core-contracts.v2/contracts", + "newArtifactsFolder": "build/core-contracts.v3/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release4-report.json b/packages/protocol/releaseData/versionReports/release4-report.json index a1e616ae2a4..3d17ad9f799 100644 --- a/packages/protocol/releaseData/versionReports/release4-report.json +++ b/packages/protocol/releaseData/versionReports/release4-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v3/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v4/contracts", + "oldArtifactsFolder": "build/core-contracts.v3/contracts", + "newArtifactsFolder": "build/core-contracts.v4/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release5-report.json b/packages/protocol/releaseData/versionReports/release5-report.json index 62e24408edc..903e93ef574 100644 --- a/packages/protocol/releaseData/versionReports/release5-report.json +++ b/packages/protocol/releaseData/versionReports/release5-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v4/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v5/contracts", + "oldArtifactsFolder": "build/core-contracts.v4/contracts", + "newArtifactsFolder": "build/core-contracts.v5/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release6-report.json b/packages/protocol/releaseData/versionReports/release6-report.json index d633c114262..ea7a7b3bf56 100644 --- a/packages/protocol/releaseData/versionReports/release6-report.json +++ b/packages/protocol/releaseData/versionReports/release6-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v5/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v6/contracts", + "oldArtifactsFolder": "build/core-contracts.v5/contracts", + "newArtifactsFolder": "build/core-contracts.v6/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release7-report.json b/packages/protocol/releaseData/versionReports/release7-report.json index 1d961b99f6d..745c97d1a31 100644 --- a/packages/protocol/releaseData/versionReports/release7-report.json +++ b/packages/protocol/releaseData/versionReports/release7-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v6/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v7/contracts", + "oldArtifactsFolder": "build/core-contracts.v6/contracts", + "newArtifactsFolder": "build/core-contracts.v7/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release8-report.json b/packages/protocol/releaseData/versionReports/release8-report.json index 68321a45b25..b4509da7288 100644 --- a/packages/protocol/releaseData/versionReports/release8-report.json +++ b/packages/protocol/releaseData/versionReports/release8-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v7/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v8/contracts", + "oldArtifactsFolder": "build/core-contracts.v7/contracts", + "newArtifactsFolder": "build/core-contracts.v8/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles|^UsingRegistry/", "report": { "contracts": { diff --git a/packages/protocol/releaseData/versionReports/release9-report.json b/packages/protocol/releaseData/versionReports/release9-report.json index e3e9bec0d83..109934d7aaa 100644 --- a/packages/protocol/releaseData/versionReports/release9-report.json +++ b/packages/protocol/releaseData/versionReports/release9-report.json @@ -1,6 +1,6 @@ { - "oldArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v8/contracts", - "newArtifactsFolder": "/home/circleci/app/packages/protocol/build/core-contracts.v9/contracts", + "oldArtifactsFolder": "build/core-contracts.v8/contracts", + "newArtifactsFolder": "build/core-contracts.v9/contracts", "exclude": "/.*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles|^UsingRegistry/", "report": { "contracts": { From 75bd44bebcfb4448d822467262f00758dac8b8fa Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 09:14:22 +0000 Subject: [PATCH 096/154] Split node cache in two --- .github/actions/sync-workspace/action.yml | 16 ++++++++++++++++ .github/workflows/circleci.yml | 16 +++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index df314bca0ce..57bcccd4ff0 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -22,3 +22,19 @@ runs: key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} enableCrossOsArchive: true fail-on-cache-miss: true + - name: Restore build artifacts cache cache + uses: actions/cache@v3 + id: cache_build_artifacts + with: + # We need to cache all the artifacts generated by yarn install+build + # Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list + path: | + packages/**/lib + packages/**/dist + packages/**/build + packages/protocol/*.js + packages/protocol/**/*.js + packages/sdk/contractkit/src/generated + key: code-${{ github.sha }} + restore-keys: | + code-${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 465c2ce2010..dd7e764e50c 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -74,16 +74,26 @@ jobs: path: | node_modules packages/**/node_modules + key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} + restore-keys: | + node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- + # We use cache to share the build artifacts between jobs (gh artifacts are too slow...) + - name: Restore build artifacts cache cache + uses: actions/cache@v3 + id: cache_build_artifacts + with: + # We need to cache all the artifacts generated by yarn install+build + # Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list + path: | packages/**/lib packages/**/dist packages/**/build packages/protocol/*.js packages/protocol/**/*.js packages/sdk/contractkit/src/generated - key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} - # TODO(jcortejoso): Think if remove this, to start clean with any change in deps + key: code-${{ github.sha }} restore-keys: | - node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- + code-${{ github.sha }} - name: Install yarn dependencies run: yarn install if: steps.cache_node.outputs.cache-hit != 'true' From 1aeb256e07d2e4242372cec4c2ce45257a7b17c6 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 09:21:44 +0000 Subject: [PATCH 097/154] Fix cache --- .github/actions/sync-workspace/action.yml | 8 +------- .github/workflows/circleci.yml | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index 57bcccd4ff0..b84635124c5 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -13,16 +13,10 @@ runs: path: | node_modules packages/**/node_modules - packages/**/lib - packages/**/dist - packages/**/build - packages/protocol/*.js - packages/protocol/**/*.js - packages/sdk/contractkit/src/generated key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} enableCrossOsArchive: true fail-on-cache-miss: true - - name: Restore build artifacts cache cache + - name: Restore build artifacts cache uses: actions/cache@v3 id: cache_build_artifacts with: diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index dd7e764e50c..768b9152e71 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -78,7 +78,7 @@ jobs: restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- # We use cache to share the build artifacts between jobs (gh artifacts are too slow...) - - name: Restore build artifacts cache cache + - name: Restore build artifacts cache uses: actions/cache@v3 id: cache_build_artifacts with: From ceb11ce6a4f5c784b1089dfc75e4b0dcdce1409b Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 11:00:11 +0000 Subject: [PATCH 098/154] Debug e2e --- .github/workflows/circleci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 768b9152e71..a8ffca51422 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -382,12 +382,6 @@ jobs: run: | cd packages/sdk/contractkit yarn test:reset - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 20 - if: false - with: - limit-access-to-actor: true - name: Run tests if: contains(steps.changed-files.outputs.all_files_changed, 'packages/contractkit') || true run: | @@ -670,6 +664,12 @@ jobs: uses: ./.github/actions/protocol-sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: contains(matrix.command, 'ci_test_transfers.sh') + with: + limit-access-to-actor: true - name: Execute matrix command for test run: | ${{ matrix.command }} From fd8ff33e28d962822307d490f9b382209d315dad Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 11:01:30 +0000 Subject: [PATCH 099/154] Job dependencies --- .github/workflows/circleci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index a8ffca51422..2b2d9758123 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -198,7 +198,9 @@ jobs: name: Protocol Tests Prepare runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 - needs: [install-dependencies, lint-checks] + # Comment lint-checks dependency to speed up (as this is a dependency for many other jobs) + # needs: [install-dependencies, lint-checks] + needs: [install-dependencies] outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: From fe9d2aec9c168e2a4998116c2c65ad663220fc9c Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 11:03:51 +0000 Subject: [PATCH 100/154] Do not fail-fast on matrix jobs --- .github/workflows/circleci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 2b2d9758123..6c968fd998e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -285,6 +285,7 @@ jobs: if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' strategy: + fail-fast: false matrix: include: - name: Protocol Test Reslease Snapshots @@ -613,6 +614,7 @@ jobs: if: | needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' strategy: + fail-fast: false matrix: include: - name: Transfer test From 0f49aa533cd951a7908e5fef0851d20211ccf7dc Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 12:03:23 +0000 Subject: [PATCH 101/154] Typos and format. --- .github/workflows/circleci.yml | 88 ++++++++++++++-------------------- 1 file changed, 35 insertions(+), 53 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 6c968fd998e..5ee6c147202 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -278,7 +278,8 @@ jobs: BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g')) yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout protocol-test-matrix: - name: Protocol Test Matrix - ${{ matrix.name }} + # Keeping name short because GitHub UI does not handle long names well + name: ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] @@ -288,7 +289,7 @@ jobs: fail-fast: false matrix: include: - - name: Protocol Test Reslease Snapshots + - name: Protocol Reslease Snapshots command: | yarn --cwd packages/protocol test:release-snapshots if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then @@ -297,26 +298,26 @@ jobs: echo "If these changes are intended, update the 'releaseData/versionReports' accordingly" exit 1 fi - - name: Protocol Test Unit tests - commnd: | + - name: Protocol Unit tests + command: | yarn --cwd packages/protocol test common/ - - name: Protocol Test Compatibility - commnd: | + - name: Protocol Compatibility + command: | yarn --cwd packages/protocol test compatibility/ - - name: Protocol Test Governance Network - commnd: | + - name: Protocol Governance Network + command: | yarn --cwd packages/protocol test governance/network/ - - name: Protocol Test Governance Validators - commnd: | + - name: Protocol Governance Validators + command: | yarn --cwd packages/protocol test governance/validators/ - - name: Protocol Test Governance Voting - commnd: | + - name: Protocol Governance Voting + command: | yarn --cwd packages/protocol test governance/voting/ - - name: Protocol Test Governance Identity - commnd: | + - name: Protocol Governance Identity + command: | yarn --cwd packages/protocol test identity/ - - name: Protocol Test Stability - commnd: | + - name: Protocol Stability + command: | yarn --cwd packages/protocol test stability/ steps: - uses: actions/cache/restore@v3 @@ -586,28 +587,9 @@ jobs: npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/base/*.tgz npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/utils/*.tgz - # end-to-end-geth-transfer-test: - # name: Celo-Blockchain E2E Transfer test - # runs-on: ["self-hosted", "monorepo"] - # needs: [install-dependencies, lint-checks, contractkit-tests] - # steps: - # - uses: actions/cache/restore@v3 - # id: cache_git - # with: - # path: .git - # key: git-${{ github.ref }} - # - uses: actions/checkout@v3 - # - name: Sync workspace - # uses: ./.github/actions/sync-workspace - # with: - # package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - # - name: Run tests - # run: | - # set -e - # cd packages/celotool - # ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} end-to-end-geth-matrix: - name: Celo Blockchain e2e Test Matrix - ${{ matrix.name }} + # Keeping name short because GitHub UI does not handle long names well + name: e2e - ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] @@ -619,42 +601,42 @@ jobs: include: - name: Transfer test command: | - set -e + set -ex cd packages/celotool ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Blockchain Parameters test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_blockchain_parameters.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Slashing test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_slashing.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Governance test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_governance.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Replica test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_replicas.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Sync test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_sync.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Validator order test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_validator_order.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: CIP35 eth compatibility test - commnd: | - set -e + command: | + set -ex cd packages/celotool ./ci_test_cip35.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} steps: @@ -671,7 +653,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: contains(matrix.command, 'ci_test_transfers.sh') + if: contains(matrix.command, 'ci_test_transfers.sh') && false with: limit-access-to-actor: true - name: Execute matrix command for test From 80c7378e1a3e02dcd31f787c2f040a47f046983d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 12:39:45 +0000 Subject: [PATCH 102/154] Fix go path --- .github/workflows/circleci.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5ee6c147202..9674c3dcd96 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -15,7 +15,6 @@ concurrency: defaults: run: - # working-directory: ~/app shell: bash --login -eo pipefail {0} env: @@ -601,42 +600,51 @@ jobs: include: - name: Transfer test command: | - set -ex + set -e + # Forcing to load go and rust paths + source ~/.bashrc cd packages/celotool ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Blockchain Parameters test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_blockchain_parameters.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Slashing test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_slashing.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Governance test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_governance.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Replica test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_replicas.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Sync test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_sync.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Validator order test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_validator_order.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: CIP35 eth compatibility test command: | - set -ex + set -e + source ~/.bashrc cd packages/celotool ./ci_test_cip35.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} steps: From d89f31bde3596b65a5338cc61dd738b502872fec Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 12:49:01 +0000 Subject: [PATCH 103/154] Cache everything! --- .github/actions/sync-workspace/action.yml | 2 ++ .github/workflows/circleci.yml | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index b84635124c5..941761ecfa6 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -27,7 +27,9 @@ runs: packages/**/dist packages/**/build packages/protocol/*.js + packages/protocol/*.js.map packages/protocol/**/*.js + packages/protocol/**/*.js.map packages/sdk/contractkit/src/generated key: code-${{ github.sha }} restore-keys: | diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9674c3dcd96..b31b72ec9ab 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -88,7 +88,9 @@ jobs: packages/**/dist packages/**/build packages/protocol/*.js + packages/protocol/*.js.map packages/protocol/**/*.js + packages/protocol/**/*.js.map packages/sdk/contractkit/src/generated key: code-${{ github.sha }} restore-keys: | @@ -329,6 +331,12 @@ jobs: uses: ./.github/actions/protocol-sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: contains(matrix.command, 'common/') + with: + limit-access-to-actor: true - name: Execute matrix command for test run: | ${{ matrix.command }} From 2728ff99470a0ae5bcabf4c0fc36f1ad9607bb5f Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 14:43:34 +0000 Subject: [PATCH 104/154] Fixing tests --- .github/workflows/circleci.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index b31b72ec9ab..f014d66abf0 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -331,10 +331,13 @@ jobs: uses: ./.github/actions/protocol-sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Build protocol + run: | + yarn --cwd packages/protocol build - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: contains(matrix.command, 'common/') + if: contains(matrix.command, 'common/') && false with: limit-access-to-actor: true - name: Execute matrix command for test @@ -610,49 +613,49 @@ jobs: command: | set -e # Forcing to load go and rust paths - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Blockchain Parameters test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_blockchain_parameters.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Slashing test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_slashing.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Governance test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_governance.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Replica test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_replicas.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Sync test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_sync.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: Validator order test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_validator_order.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} - name: CIP35 eth compatibility test command: | set -e - source ~/.bashrc + export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}" cd packages/celotool ./ci_test_cip35.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST} steps: From 76a85e6dad336a1968e2473c27061685ed06b5ba Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 17:20:57 +0000 Subject: [PATCH 105/154] More tests --- .github/workflows/circleci.yml | 99 +++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index f014d66abf0..2f9e1052180 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -219,6 +219,7 @@ jobs: id: changed-files uses: tj-actions/changed-files@v35 with: + # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - name: Export protocol test must run id: protocol-test-must-run @@ -599,7 +600,7 @@ jobs: end-to-end-geth-matrix: # Keeping name short because GitHub UI does not handle long names well - name: e2e - ${{ matrix.name }} + name: e2e ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] @@ -678,3 +679,99 @@ jobs: - name: Execute matrix command for test run: | ${{ matrix.command }} + + # TODO: Ask Identity team to check if this is relevant + odis-test: + name: ODIS test + runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 + needs: [install-dependencies, lint-checks] + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Run Tests for common package + run: | + yarn --cwd=packages/phone-number-privacy/common test:coverage + - name: Run Tests for combiner + run: | + yarn --cwd=packages/phone-number-privacy/combiner test:coverage + - name: Run Tests for signer + run: | + yarn --cwd=packages/phone-number-privacy/signer test:coverage + + certora-test: + name: Certora test ${{ matrix.name }} + runs-on: ["self-hosted", "monorepo"] + timeout-minutes: 30 + needs: [install-dependencies, lint-checks] + strategy: + matrix: + include: + - name: Locked Gold + command: | + cd packages/protocol + ./specs/scripts/lockedgold.sh + - name: Accounts + command: | + cd packages/protocol + ./specs/scripts/accounts.sh + - name: Accounts + command: | + cd packages/protocol + ./specs/scripts/accountsPrivileged.sh + - name: Accounts + command: | + cd packages/protocol + ./specs/scripts/applyHarness.sh + ./specs/scripts/governance.sh + - name: Accounts + command: | + cd packages/protocol + ./specs/scripts/reserve.sh + steps: + - uses: actions/cache/restore@v3 + id: cache_git + with: + path: .git + key: git-${{ github.ref }} + - uses: actions/checkout@v3 + - name: Sync workspace + uses: ./.github/actions/sync-workspace + with: + package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + fetch_depth: "100" + # TODO: Ask Volpe about this + - name: Disabling certora until the license is figured out + run: | + exit 1 + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '11' + cache: 'maven' + - name: Certora dependencies + run: | + echo "export PATH=$PATH:~/.local/bin" >> $BASH_ENV + sudo apt-get update || sudo apt-get update + sudo apt-get install -y software-properties-common + sudo apt-get install python3-pip + pip3 install certora-cli + wget https://github.com/ethereum/solidity/releases/download/v0.5.13/solc-static-linux + chmod +x solc-static-linux + sudo mv solc-static-linux /usr/bin/solc + - name: Build and run command + run: | + ${{ matrix.command }} + \ No newline at end of file From 2546b7bafd540baefd5493adf657a7ccc0274176 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 17:34:34 +0000 Subject: [PATCH 106/154] Certora tests --- .github/workflows/circleci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 2f9e1052180..96d4b53110e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -713,6 +713,7 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks] strategy: + fail-fast: false matrix: include: - name: Locked Gold @@ -755,7 +756,9 @@ jobs: # TODO: Ask Volpe about this - name: Disabling certora until the license is figured out run: | - exit 1 + echo "Certora is disabled until the license is figured out" + # TODO(jcortejoso) + echo "exit 1" - uses: actions/setup-java@v3 with: distribution: 'zulu' From 8b3f2126bc8640dd66f0fba8328440f7ec834f97 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 11 May 2023 18:25:57 +0000 Subject: [PATCH 107/154] Testing with no java package manager --- .github/workflows/circleci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 96d4b53110e..ec9f420617e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -763,7 +763,6 @@ jobs: with: distribution: 'zulu' java-version: '11' - cache: 'maven' - name: Certora dependencies run: | echo "export PATH=$PATH:~/.local/bin" >> $BASH_ENV From f7899d0b12cb137a0822f5653f352a98b6c4d0cd Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 07:35:24 +0000 Subject: [PATCH 108/154] Debug certora --- .github/workflows/circleci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index ec9f420617e..4e264e72b3b 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -763,12 +763,17 @@ jobs: with: distribution: 'zulu' java-version: '11' + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + if: contains(matrix.command, '/lockedgold.sh') + with: + limit-access-to-actor: true - name: Certora dependencies run: | - echo "export PATH=$PATH:~/.local/bin" >> $BASH_ENV - sudo apt-get update || sudo apt-get update - sudo apt-get install -y software-properties-common - sudo apt-get install python3-pip + echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrc + sudo apt-get update + sudo apt-get install -y software-properties-common python3-pip pip3 install certora-cli wget https://github.com/ethereum/solidity/releases/download/v0.5.13/solc-static-linux chmod +x solc-static-linux From 80f20fa9aedfa8d2144a3b587ce612c8bcfb44ce Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:11:12 +0000 Subject: [PATCH 109/154] debug --- .github/workflows/circleci.yml | 84 +++++++++++++--------------------- 1 file changed, 32 insertions(+), 52 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 4e264e72b3b..9bdb13e0baa 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -32,6 +32,8 @@ jobs: name: Install dependencies outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} + # Propagate more outputs if you need https://github.com/tj-actions/changed-files#outputs + all_files_changed: ${{ steps.changed-files.outputs.all_files_changed }} # runs-on: ubuntu-latest runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 @@ -123,6 +125,13 @@ jobs: exit 0 fi yarn check-licenses + - name: Detect files changed in PR, and exposed as output + id: changed-files + uses: tj-actions/changed-files@v35 + with: + # Checking if changed in the last 100 commits in PRs + fetch_depth: "100" + - run: echo ${{ steps.changed-files.outputs.all_files_changed }} lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] @@ -215,16 +224,10 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - # Checking if changed in the last 100 commits in PRs - fetch_depth: "100" - name: Export protocol test must run id: protocol-test-must-run # TODO(jcortejoso): Remove true - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions @@ -234,18 +237,18 @@ jobs: - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - name: Opcode tests - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true run: | yarn --cwd packages/protocol check-opcodes - name: Generate devchain of previous release - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/protocol') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true run: | echo "Comparing against $RELEASE_TAG" # Github has phased out the git protocol so we ensure that we use @@ -344,7 +347,6 @@ jobs: - name: Execute matrix command for test run: | ${{ matrix.command }} - protocol-test-with-code-coverage: name: Protocol Test with code coverage runs-on: ["self-hosted", "monorepo"] @@ -387,18 +389,13 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - fetch_depth: "100" - name: Generate DevChain - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/contractkit') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || true run: | cd packages/sdk/contractkit yarn test:reset - name: Run tests - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/contractkit') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || true run: | yarn --cwd=packages/sdk/contractkit test identity-tests: @@ -417,18 +414,13 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - fetch_depth: "100" - name: Generate DevChain - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/identity') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || true run: | cd packages/sdk/identity yarn test:reset - name: Run tests - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/identity') || true + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || true run: | yarn --cwd=packages/sdk/identity test transactions-uri-tests: @@ -477,22 +469,17 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - fetch_depth: "100" - name: Generate DevChain - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true + if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | cd packages/cli yarn test:reset - name: Run tests - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true + if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | yarn --cwd=packages/cli test - name: Fail if someone forgot to commit CLI docs - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true + if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | yarn --cwd=packages/cli docs if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then @@ -501,12 +488,12 @@ jobs: exit 1 fi - name: Verify that a new account can be created - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true + if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | yarn --cwd=packages/cli run celocli account:new # TODO(jcortejoso): Review later - name: Install and test the npm package - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/cli') || true + if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | cd packages/cli yarn pack @@ -529,13 +516,8 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - fetch_depth: "100" - name: Install and test the npm package - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/typescript') || true + if: contains(needs.install-dependencies.outputs, 'packages/typescript') || true run: | set -euo pipefail cd packages/typescript @@ -686,6 +668,9 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks] + if: | + includes(needs.install-dependencies.outputs.all_files_changed, "packages/phone-number-privacy") || + includes(needs.install-dependencies.outputs.all_files_changed, "package.json") steps: - uses: actions/cache/restore@v3 id: cache_git @@ -707,11 +692,17 @@ jobs: run: | yarn --cwd=packages/phone-number-privacy/signer test:coverage + # NOTE: This has not been fully tested as we don't have a license for certora certora-test: name: Certora test ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks] + # Disable as certora license is not active + if: | + includes(needs.install-dependencies.outputs.all_files_changed, "packages/protocol") && false + env: + CERTORAKEY: NOT_ACTIVE strategy: fail-fast: false matrix: @@ -748,17 +739,6 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - fetch_depth: "100" - # TODO: Ask Volpe about this - - name: Disabling certora until the license is figured out - run: | - echo "Certora is disabled until the license is figured out" - # TODO(jcortejoso) - echo "exit 1" - uses: actions/setup-java@v3 with: distribution: 'zulu' From d68113b2eaa4b1c3879f411f941b25156259673e Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:13:07 +0000 Subject: [PATCH 110/154] debug --- .github/workflows/circleci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 9bdb13e0baa..ced058e7fd8 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -669,8 +669,8 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks] if: | - includes(needs.install-dependencies.outputs.all_files_changed, "packages/phone-number-privacy") || - includes(needs.install-dependencies.outputs.all_files_changed, "package.json") + contains(needs.install-dependencies.outputs.all_files_changed, "packages/phone-number-privacy") || + contains(needs.install-dependencies.outputs.all_files_changed, "package.json") steps: - uses: actions/cache/restore@v3 id: cache_git @@ -700,7 +700,7 @@ jobs: needs: [install-dependencies, lint-checks] # Disable as certora license is not active if: | - includes(needs.install-dependencies.outputs.all_files_changed, "packages/protocol") && false + contains(needs.install-dependencies.outputs.all_files_changed, "packages/protocol") && false env: CERTORAKEY: NOT_ACTIVE strategy: From 21d704f03c1d78fb7cbe03a265307551038a325a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:17:33 +0000 Subject: [PATCH 111/154] debug --- .github/workflows/circleci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index ced058e7fd8..7029c19ddeb 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -668,9 +668,7 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks] - if: | - contains(needs.install-dependencies.outputs.all_files_changed, "packages/phone-number-privacy") || - contains(needs.install-dependencies.outputs.all_files_changed, "package.json") + if: contains(needs.install-dependencies.outputs.all_files_changed, "packages/phone-number-privacy") steps: - uses: actions/cache/restore@v3 id: cache_git From 9daf43950e66fa051536d6639cc5c1c49601dae9 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:19:23 +0000 Subject: [PATCH 112/154] quotes --- .github/workflows/circleci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 7029c19ddeb..14430195d1b 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -668,7 +668,7 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks] - if: contains(needs.install-dependencies.outputs.all_files_changed, "packages/phone-number-privacy") + if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/phone-number-privacy') steps: - uses: actions/cache/restore@v3 id: cache_git @@ -698,7 +698,7 @@ jobs: needs: [install-dependencies, lint-checks] # Disable as certora license is not active if: | - contains(needs.install-dependencies.outputs.all_files_changed, "packages/protocol") && false + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') && false env: CERTORAKEY: NOT_ACTIVE strategy: From 990675e21f953aaae8e444cb740fe5a62c4db78a Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:30:14 +0000 Subject: [PATCH 113/154] debug --- .github/workflows/circleci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 14430195d1b..34949d09609 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -2,12 +2,12 @@ name: celo-monorepo run-name: celo-monorepo tests on: - push: - branches: - - jcortejoso/circleci-github-actions - # pull_request: + # push: # branches: - # - master + # - jcortejoso/circleci-github-actions + pull_request: + branches: + - master concurrency: group: circle-ci-${{ github.ref }} @@ -131,7 +131,7 @@ jobs: with: # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - - run: echo ${{ steps.changed-files.outputs.all_files_changed }} + - run: echo ${{ steps.changed-files.outputs.all_changed_files }} lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] From 1bf7f053203c966d8f8d35b474857a6574998e42 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:36:24 +0000 Subject: [PATCH 114/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 34949d09609..595d0928edf 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -55,7 +55,7 @@ jobs: set -v # To get the "master" branch mapping git checkout master - git checkout ${GITHUB_REF} + git checkout ${GITHUB_SHA} # Verify that following commands work, they are later called in the incremental testing script # There output does not matter here, the fact that they finish successfully does. git rev-parse --abbrev-ref HEAD From b321cf5696d1f7fce2f924078ac546d24873ca12 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:44:39 +0000 Subject: [PATCH 115/154] Debug --- .github/workflows/circleci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 595d0928edf..10b3176f8c7 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -129,6 +129,8 @@ jobs: id: changed-files uses: tj-actions/changed-files@v35 with: + diff_relative: "true" + path: "." # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - run: echo ${{ steps.changed-files.outputs.all_changed_files }} From fb502607cbf5a66745e706efd6b1dfb4eb1cded0 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 08:56:56 +0000 Subject: [PATCH 116/154] debug --- .github/workflows/circleci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 10b3176f8c7..b04cca61a86 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -129,11 +129,9 @@ jobs: id: changed-files uses: tj-actions/changed-files@v35 with: - diff_relative: "true" - path: "." # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - - run: echo ${{ steps.changed-files.outputs.all_changed_files }} + - run: echo ${{ toJson(steps.changed-files.outputs.all_changed_files) }} lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] @@ -213,6 +211,10 @@ jobs: # Comment lint-checks dependency to speed up (as this is a dependency for many other jobs) # needs: [install-dependencies, lint-checks] needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || + contains(toJson(needs.install-dependencies.outputs.all_files_changed), '\r\npackage.json') || + true outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -229,7 +231,6 @@ jobs: - name: Export protocol test must run id: protocol-test-must-run # TODO(jcortejoso): Remove true - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true run: | # TODO(jcortejoso): This script slightly depends on CircleCI # Ideally refactor this to depend just on GitHub Actions From b634bf1e470f472c2c7ffd4c63793da66ca260b4 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:02:47 +0000 Subject: [PATCH 117/154] debug --- .github/workflows/circleci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index b04cca61a86..1c7352b8e6d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -33,7 +33,7 @@ jobs: outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # Propagate more outputs if you need https://github.com/tj-actions/changed-files#outputs - all_files_changed: ${{ steps.changed-files.outputs.all_files_changed }} + all_files_changed: ",${{ steps.changed-files.outputs.all_files_changed }}" # runs-on: ubuntu-latest runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 @@ -129,9 +129,10 @@ jobs: id: changed-files uses: tj-actions/changed-files@v35 with: + files_separator: "," # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - - run: echo ${{ toJson(steps.changed-files.outputs.all_changed_files) }} + - run: echo ",${{ toJson(steps.changed-files.outputs.all_changed_files) }}" lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] @@ -213,7 +214,8 @@ jobs: needs: [install-dependencies] if: | contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(toJson(needs.install-dependencies.outputs.all_files_changed), '\r\npackage.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') true outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} From 1cf95d5e98e77bc30b13d71a69c338959cf42afd Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:07:40 +0000 Subject: [PATCH 118/154] debug --- .github/workflows/circleci.yml | 60 +++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 1c7352b8e6d..900d8a45bb8 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -215,7 +215,7 @@ jobs: if: | contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || true outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} @@ -230,30 +230,18 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Export protocol test must run - id: protocol-test-must-run - # TODO(jcortejoso): Remove true - run: | - # TODO(jcortejoso): This script slightly depends on CircleCI - # Ideally refactor this to depend just on GitHub Actions - # ./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol - echo "Protocol tests runs always" - echo "PROTOCOL_TEST_MUST_RUN=true" >> "$GITHUB_OUTPUT" - name: Cache protocol devchain uses: actions/cache@v3 id: cache_protocol - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true with: path: packages/protocol/.tmp/released_chain key: protocol-${{ github.sha }} restore-keys: | protocol-${{ github.sha }} - name: Opcode tests - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true run: | yarn --cwd packages/protocol check-opcodes - name: Generate devchain of previous release - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || true run: | echo "Comparing against $RELEASE_TAG" # Github has phased out the git protocol so we ensure that we use @@ -266,7 +254,10 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -294,7 +285,10 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true strategy: fail-fast: false matrix: @@ -358,7 +352,10 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -383,6 +380,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -395,12 +397,10 @@ jobs: with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Generate DevChain - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || true run: | cd packages/sdk/contractkit yarn test:reset - name: Run tests - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || true run: | yarn --cwd=packages/sdk/contractkit test identity-tests: @@ -408,6 +408,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -420,12 +425,10 @@ jobs: with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Generate DevChain - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || true run: | cd packages/sdk/identity yarn test:reset - name: Run tests - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || true run: | yarn --cwd=packages/sdk/identity test transactions-uri-tests: @@ -433,6 +436,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk/transactions-uri') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -450,12 +458,10 @@ jobs: with: fetch_depth: "100" - name: Generate DevChain - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/sdk/transactions-uri') || true run: | cd packages/sdk/identity yarn test:reset - name: Run tests - if: contains(steps.changed-files.outputs.all_files_changed, 'packages/sdk/transactions-uri') || true run: | yarn --cwd=packages/sdk/identity test cli-tests: @@ -463,6 +469,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/cli') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -475,16 +486,13 @@ jobs: with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Generate DevChain - if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | cd packages/cli yarn test:reset - name: Run tests - if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | yarn --cwd=packages/cli test - name: Fail if someone forgot to commit CLI docs - if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | yarn --cwd=packages/cli docs if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then @@ -493,12 +501,10 @@ jobs: exit 1 fi - name: Verify that a new account can be created - if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | yarn --cwd=packages/cli run celocli account:new # TODO(jcortejoso): Review later - name: Install and test the npm package - if: contains(needs.install-dependencies.outputs, 'packages/cli') || true run: | cd packages/cli yarn pack From 76124c28a22115375288d1c663ed96f9bf7714e0 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:14:06 +0000 Subject: [PATCH 119/154] debug --- .github/workflows/circleci.yml | 37 +++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 900d8a45bb8..065a39c5d10 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -129,7 +129,7 @@ jobs: id: changed-files uses: tj-actions/changed-files@v35 with: - files_separator: "," + separator: "," # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - run: echo ",${{ toJson(steps.changed-files.outputs.all_changed_files) }}" @@ -516,6 +516,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/typescript') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -528,7 +533,6 @@ jobs: with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - name: Install and test the npm package - if: contains(needs.install-dependencies.outputs, 'packages/typescript') || true run: | set -euo pipefail cd packages/typescript @@ -540,6 +544,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -569,6 +578,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies] + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -598,7 +612,12 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - needs.pre-protocol-test-release.outputs.protocol-test-must-run == 'true' + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/celotool') || + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk/contractkit') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true strategy: fail-fast: false matrix: @@ -679,7 +698,11 @@ jobs: runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 needs: [install-dependencies, lint-checks] - if: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/phone-number-privacy') + if: | + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/phone-number-privacy') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + true steps: - uses: actions/cache/restore@v3 id: cache_git @@ -709,7 +732,11 @@ jobs: needs: [install-dependencies, lint-checks] # Disable as certora license is not active if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') && false + false && ( + contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || + contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') + ) env: CERTORAKEY: NOT_ACTIVE strategy: From 101f672061447de7706fc82b0f6c4925c11aa030 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:21:19 +0000 Subject: [PATCH 120/154] debug --- .github/workflows/circleci.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 065a39c5d10..7afa6ea5f29 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -33,6 +33,7 @@ jobs: outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # Propagate more outputs if you need https://github.com/tj-actions/changed-files#outputs + # Adding a initial comma so ',' matches also for the first file all_files_changed: ",${{ steps.changed-files.outputs.all_files_changed }}" # runs-on: ubuntu-latest runs-on: ["self-hosted", "monorepo"] @@ -129,10 +130,10 @@ jobs: id: changed-files uses: tj-actions/changed-files@v35 with: + # Using comma as separator to be able to easily match full paths (using ,) separator: "," # Checking if changed in the last 100 commits in PRs fetch_depth: "100" - - run: echo ",${{ toJson(steps.changed-files.outputs.all_changed_files) }}" lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] @@ -216,7 +217,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} steps: @@ -257,7 +258,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -288,7 +289,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false strategy: fail-fast: false matrix: @@ -355,7 +356,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -384,7 +385,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -412,7 +413,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -440,7 +441,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk/transactions-uri') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -473,7 +474,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/cli') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -520,7 +521,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/typescript') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -548,7 +549,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -582,7 +583,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git @@ -617,7 +618,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk/contractkit') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false strategy: fail-fast: false matrix: @@ -702,7 +703,7 @@ jobs: contains(needs.install-dependencies.outputs.all_files_changed, 'packages/phone-number-privacy') || contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || - true + false steps: - uses: actions/cache/restore@v3 id: cache_git From ecf9b77e4381d2d9c56c7245e8be17c1c18e2750 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:27:42 +0000 Subject: [PATCH 121/154] Force triggering everything --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e3408fcefa7..bc6cba82d3b 100644 --- a/package.json +++ b/package.json @@ -133,4 +133,4 @@ "websocket-extensions": "^0.1.4", "y18n": "^5.0.5" } -} +} \ No newline at end of file From 2860727cd9a9f7156a8e780607d8fb2ce300924d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:34:52 +0000 Subject: [PATCH 122/154] debug --- .github/workflows/circleci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 7afa6ea5f29..e7786a78b1d 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -134,6 +134,7 @@ jobs: separator: "," # Checking if changed in the last 100 commits in PRs fetch_depth: "100" + - run: echo ",${{ steps.changed-files.outputs.all_files_changed }}" lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] From a457d853c933b985be1e84045e950dd8bf8820e6 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 09:49:06 +0000 Subject: [PATCH 123/154] debug --- .github/workflows/circleci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index e7786a78b1d..5555c9cf25c 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -133,7 +133,7 @@ jobs: # Using comma as separator to be able to easily match full paths (using ,) separator: "," # Checking if changed in the last 100 commits in PRs - fetch_depth: "100" + fetch_depth: "150" - run: echo ",${{ steps.changed-files.outputs.all_files_changed }}" lint-checks: name: Lint code From 6b400df879a5c46bef927677518ef876318b5ed3 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:00:37 +0000 Subject: [PATCH 124/154] debug --- .github/workflows/circleci.yml | 94 +++++++++++++++++----------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 5555c9cf25c..80ab5f0ca31 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -34,7 +34,7 @@ jobs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # Propagate more outputs if you need https://github.com/tj-actions/changed-files#outputs # Adding a initial comma so ',' matches also for the first file - all_files_changed: ",${{ steps.changed-files.outputs.all_files_changed }}" + all_modified_files: ",${{ steps.changed-files.outputs.all_modified_files }}" # runs-on: ubuntu-latest runs-on: ["self-hosted", "monorepo"] timeout-minutes: 30 @@ -126,7 +126,7 @@ jobs: exit 0 fi yarn check-licenses - - name: Detect files changed in PR, and exposed as output + - name: Detect files changed in PR, and expose as output id: changed-files uses: tj-actions/changed-files@v35 with: @@ -134,7 +134,7 @@ jobs: separator: "," # Checking if changed in the last 100 commits in PRs fetch_depth: "150" - - run: echo ",${{ steps.changed-files.outputs.all_files_changed }}" + - run: echo ",${{ steps.changed-files.outputs.all_modified_files }}" lint-checks: name: Lint code runs-on: ["self-hosted", "monorepo"] @@ -215,9 +215,9 @@ jobs: # needs: [install-dependencies, lint-checks] needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false outputs: protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }} @@ -256,9 +256,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -287,9 +287,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false strategy: fail-fast: false @@ -354,9 +354,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -383,9 +383,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/contractkit') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/contractkit') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -411,9 +411,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/identity') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/identity') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -439,9 +439,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk/transactions-uri') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk/transactions-uri') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -472,9 +472,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/cli') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/cli') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -519,9 +519,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/typescript') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -547,9 +547,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -581,9 +581,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -614,11 +614,11 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/celotool') || - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/sdk/contractkit') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/celotool') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk/contractkit') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false strategy: fail-fast: false @@ -701,9 +701,9 @@ jobs: timeout-minutes: 30 needs: [install-dependencies, lint-checks] if: | - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/phone-number-privacy') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: - uses: actions/cache/restore@v3 @@ -735,9 +735,9 @@ jobs: # Disable as certora license is not active if: | false && ( - contains(needs.install-dependencies.outputs.all_files_changed, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_files_changed, ',package.json') || - contains(needs.install-dependencies.outputs.all_files_changed, ',yarn.lock') + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || + contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ) env: CERTORAKEY: NOT_ACTIVE From 92813778e1e20c6c3fa5b1653106ac5c79963b5b Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:33:47 +0000 Subject: [PATCH 125/154] Added npm scheduled job --- .github/workflows/cron-npm-install.yml | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/cron-npm-install.yml diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml new file mode 100644 index 00000000000..e95180f0489 --- /dev/null +++ b/.github/workflows/cron-npm-install.yml @@ -0,0 +1,30 @@ +name: NPM install testing workflow +# By default the sha where it runs is latest commit on default branch +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule +on: + schedule: + - cron: 0 19 * * * + workflow_dispatch: + +jobs: + install-npm-package: + name: Install NPM package + runs-on: ubuntu-latest + container: + image: node:12-stretch-slim + strategy: + fail-fast: false + matrix: + package: + - '@celo/typescript' + - '@celo/utils' + - '@celo/contractkit' + - '@celo/celocli' + steps: + - name: Installing npm package + run: yarn add ${{ matrix.package }} + - name: Test celocli command + if: matrix.package == '@celo/celocli' + run: | + npx celocli account:new + \ No newline at end of file From 1fbef2b211a841bc4a1263588ba9daaf7e12cc37 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:36:04 +0000 Subject: [PATCH 126/154] force execution npm install --- .github/workflows/cron-npm-install.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index e95180f0489..0da238d1178 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -3,8 +3,11 @@ name: NPM install testing workflow # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule on: schedule: - - cron: 0 19 * * * + - cron: 0 19 * * * workflow_dispatch: + pull_request: + branches: + - master jobs: install-npm-package: From 3170b9b80819f8016ff16cffe3a40a0d8872c452 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:41:16 +0000 Subject: [PATCH 127/154] Changed container --- .github/workflows/cron-npm-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index 0da238d1178..32247b8846e 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -14,7 +14,7 @@ jobs: name: Install NPM package runs-on: ubuntu-latest container: - image: node:12-stretch-slim + image: node:12-buster strategy: fail-fast: false matrix: From cc5245cfc09d159761dd62b86480ff7dc2eb70d2 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:43:14 +0000 Subject: [PATCH 128/154] Bumped node version --- .github/workflows/cron-npm-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index 32247b8846e..c83fa615d66 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -14,7 +14,7 @@ jobs: name: Install NPM package runs-on: ubuntu-latest container: - image: node:12-buster + image: node:14-bullseye strategy: fail-fast: false matrix: From 77086905c64aa2b516b97fc491032caf1a1bd2b0 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:55:28 +0000 Subject: [PATCH 129/154] Fix dependencies --- .github/workflows/cron-npm-install.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index c83fa615d66..2f89316bc30 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -11,7 +11,7 @@ on: jobs: install-npm-package: - name: Install NPM package + name: ${{ matrix.package }} NPM package install runs-on: ubuntu-latest container: image: node:14-bullseye @@ -24,6 +24,11 @@ jobs: - '@celo/contractkit' - '@celo/celocli' steps: + - name: Install @celo/celocli dependencies + if: matrix.package == '@celo/celocli' + run: | + apt update + apt install -y libusb-1.0-0-dev - name: Installing npm package run: yarn add ${{ matrix.package }} - name: Test celocli command From a652450639c458e717bd33a59d062a21c8f87422 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 10:58:04 +0000 Subject: [PATCH 130/154] Fix celocli command --- .github/workflows/cron-npm-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index 2f89316bc30..fbde0e0284f 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -34,5 +34,5 @@ jobs: - name: Test celocli command if: matrix.package == '@celo/celocli' run: | - npx celocli account:new + yarn --cwd=packages/cli run celocli account:new \ No newline at end of file From e4294e673ec38a8e5ce8e1b845315cd04ba37164 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 13:19:00 +0000 Subject: [PATCH 131/154] Undo changes --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f34a81c692..4c4e21f453b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -183,7 +183,7 @@ jobs: root: . paths: - . - + lint-checks: <<: *defaults resource_class: large From 87c873f913b8c366110a7de5622ad44fdc895738 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 13:20:41 +0000 Subject: [PATCH 132/154] Fail if cache missed --- .github/actions/sync-workspace/action.yml | 4 +++- .github/workflows/circleci.yml | 29 ----------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index 941761ecfa6..3a67d1a1ef1 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -33,4 +33,6 @@ runs: packages/sdk/contractkit/src/generated key: code-${{ github.sha }} restore-keys: | - code-${{ github.sha }} \ No newline at end of file + code-${{ github.sha }} + enableCrossOsArchive: true + fail-on-cache-miss: true diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 80ab5f0ca31..232b40e5d1e 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -348,35 +348,6 @@ jobs: - name: Execute matrix command for test run: | ${{ matrix.command }} - protocol-test-with-code-coverage: - name: Protocol Test with code coverage - runs-on: ["self-hosted", "monorepo"] - timeout-minutes: 30 - needs: [install-dependencies, lint-checks, pre-protocol-test-release] - if: | - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || - contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || - false - steps: - - uses: actions/cache/restore@v3 - id: cache_git - with: - path: .git - key: git-${{ github.ref }} - - uses: actions/checkout@v3 - - name: Sync workspace - uses: ./.github/actions/protocol-sync-workspace - with: - package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Run unit tests with code coverage - run: | - yarn --cwd packages/protocol test:coverage - - name: Upload Coverage Test Results - uses: actions/upload-artifact@v3 - with: - name: Protocol Test Coverage - path: packages/protocol/coverage contractkit-tests: name: ContractKit Tests runs-on: ["self-hosted", "monorepo"] From 7fd940d31cbef98132a6fa870db40a6b86707bf7 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 13:23:16 +0000 Subject: [PATCH 133/154] format --- .github/workflows/circleci.yml | 6 +++--- .github/workflows/cron-npm-install.yml | 1 - .github/workflows/protocol_tests.yml | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 232b40e5d1e..6721270c4d3 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -2,9 +2,9 @@ name: celo-monorepo run-name: celo-monorepo tests on: - # push: - # branches: - # - jcortejoso/circleci-github-actions + push: + branches: + - master pull_request: branches: - master diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index fbde0e0284f..25483888421 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -35,4 +35,3 @@ jobs: if: matrix.package == '@celo/celocli' run: | yarn --cwd=packages/cli run celocli account:new - \ No newline at end of file diff --git a/.github/workflows/protocol_tests.yml b/.github/workflows/protocol_tests.yml index 9bcc4fb94cf..5e953feced4 100644 --- a/.github/workflows/protocol_tests.yml +++ b/.github/workflows/protocol_tests.yml @@ -1,7 +1,5 @@ name: Protocol Foundry tests -# on: [push, pull_request] -# TODO(jcortejoso): Delete -on: [workflow_call] +on: [push, pull_request] jobs: check: From ae2a6657a4e70d8e15d4b80d0281b5cbada1bb79 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 14:32:07 +0000 Subject: [PATCH 134/154] Upload cron protocol-test-with-coverage --- .github/workflows/circleci.yml | 8 ----- .../cron-protocol-test-with-coverage.yml | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/cron-protocol-test-with-coverage.yml diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 6721270c4d3..77b3ff428a3 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -476,14 +476,6 @@ jobs: - name: Verify that a new account can be created run: | yarn --cwd=packages/cli run celocli account:new - # TODO(jcortejoso): Review later - - name: Install and test the npm package - run: | - cd packages/cli - yarn pack - cd $RUNNER_TEMP - npm install $RUNNER_WORKSPACE/celo-monorepo/packages/cli/celo-cli-*.tgz - npx celocli account:new typescript-tests: name: Typescript package Tests runs-on: ["self-hosted", "monorepo"] diff --git a/.github/workflows/cron-protocol-test-with-coverage.yml b/.github/workflows/cron-protocol-test-with-coverage.yml new file mode 100644 index 00000000000..032f9acb8e2 --- /dev/null +++ b/.github/workflows/cron-protocol-test-with-coverage.yml @@ -0,0 +1,31 @@ +# This tests are pretty slow and flacky +name: Protocol tests with coverage +# By default the sha where it runs is latest commit on default branch +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule +on: + schedule: + - cron: 0 13 * * * + workflow_dispatch: + +jobs: + # This seems to take ages and last codecov report is from 2021-02-25 :/ + # https://app.codecov.io/gh/celo-org/celo-monorepo/commits + protocol-test-with-code-coverage: + runs-on: ["self-hosted", "monorepo"] + steps: + - uses: actions/checkout@v3 + - name: Install yarn dependencies + run: yarn install + - name: Build packages + run: yarn build --ignore docs --include-dependencies + - name: Run protocol tests with coverage + run: yarn --cwd packages/protocol test:coverage + - name: Store results + uses: actions/upload-artifact@v3 + with: + name: protocol-coverage + path: packages/protocol/coverage + - name: Upload results to codecov + run: yarn codecov -F protocol + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 0f632ac3bcea7de11ee7a78c4d9a52932c5e6d95 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 14:37:54 +0000 Subject: [PATCH 135/154] Undo change --- .github/workflows/protocol_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/protocol_tests.yml b/.github/workflows/protocol_tests.yml index 5e953feced4..b28f036eb56 100644 --- a/.github/workflows/protocol_tests.yml +++ b/.github/workflows/protocol_tests.yml @@ -7,7 +7,7 @@ jobs: run: working-directory: packages/protocol name: Run tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: From 2565a08ceb2340dfb459f4a4008fe83f999fe853 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 15:19:40 +0000 Subject: [PATCH 136/154] Flake-tracker refactor to support GitHub worflows --- packages/flake-tracker/src/config.js | 46 ++++++++++++++++++-------- packages/flake-tracker/src/github.js | 48 +++++++++++++--------------- packages/flake-tracker/src/utils.js | 14 +++----- 3 files changed, 59 insertions(+), 49 deletions(-) diff --git a/packages/flake-tracker/src/config.js b/packages/flake-tracker/src/config.js index 50b9eada7f0..cc4dea1eb3a 100644 --- a/packages/flake-tracker/src/config.js +++ b/packages/flake-tracker/src/config.js @@ -1,6 +1,15 @@ -const org = process.env.CIRCLE_PROJECT_USERNAME || 'celo-org' -const repo = process.env.CIRCLE_PROJECT_REPONAME || 'celo-monorepo' -const defaultNumRetries = process.env.CIRCLE_BRANCH === 'master' ? 15 : 5 +const isCI = process.env.CIRCLECI || process.env.CI +const org = + process.env.CIRCLE_PROJECT_USERNAME || process.env.GITHUB_REPOSITORY.split('/')[0] || 'celo-org' +const repo = + process.env.CIRCLE_PROJECT_REPONAME || + process.env.GITHUB_REPOSITORY.split('/')[1] || + 'celo-monorepo' +const branch = process.env.CIRCLE_BRANCH || process.env.GITHUB_REF_NAME +const sha = process.env.CIRCLE_SHA1 || process.env.GITHUB_SHA +const CiJob = process.env.CIRCLE_JOB || process.env.GITHUB_JOB +const prNumber = getPullNumber() +const defaultNumRetries = branch === 'master' ? 15 : 5 const flakeTrackerID = 71131 // This is the FlakeTracker GitHub App ID. // NOTE: Avoid editing the following constants unless you are making changes to the flake trackers' functionality. @@ -27,9 +36,7 @@ const flakeTrackerID = 71131 // This is the FlakeTracker GitHub App ID. // shouldTrackFlakes => tests are retried `numRetries` times and flakey results are logged w/ test output const shouldTrackFlakes = - (process.env.CIRCLECI && - process.env.CIRCLE_PROJECT_REPONAME !== 'celo-blockchain' && - process.env.FLAKEY !== 'false') || + (isCI && repo !== 'celo-blockchain' && process.env.FLAKEY !== 'false') || process.env.FLAKEY === 'true' // shouldLogRetryErrorsOnFailure => log raw test error immediately after every retry. @@ -41,34 +48,47 @@ const numRetries = process.env.NUM_RETRIES ? Number(process.env.NUM_RETRIES) : d // shouldSkipKnownFlakes => flakey test issues are fetched from github and corresponding tests are skipped const shouldSkipKnownFlakes = shouldTrackFlakes && - process.env.CIRCLECI && + isCI && process.env.FLAKE_TRACKER_SECRET && process.env.SKIP_KNOWN_FLAKES !== 'false' // shouldAddCheckToPR => GitHub Check added to PR -const shouldAddCheckToPR = - shouldTrackFlakes && process.env.CIRCLECI && process.env.FLAKE_TRACKER_SECRET +const shouldAddCheckToPR = shouldTrackFlakes && isCI && process.env.FLAKE_TRACKER_SECRET // newFlakesShouldFailCheckSuite => determines whether GitHub Check has status 'failure' or 'neutral' when new flakey tests are found. const newFlakesShouldFailCheckSuite = shouldAddCheckToPR && process.env.FLAKES_FAIL_CHECK_SUITE // shouldCreateIssues => GitHub Issues created for new flakey tests const shouldCreateIssues = - shouldTrackFlakes && - process.env.CIRCLECI && - process.env.FLAKE_TRACKER_SECRET && - process.env.CIRCLE_BRANCH === 'master' + shouldTrackFlakes && isCI && process.env.FLAKE_TRACKER_SECRET && branch === 'master' // For convenience... const shouldReportFlakes = shouldAddCheckToPR || shouldCreateIssues const shouldUseGitHub = shouldSkipKnownFlakes || shouldReportFlakes +function getPullNumber() { + if (process.env.CIRCLE_PULL_REQUEST) { + return process.env.CIRCLE_PULL_REQUEST.split('/').slice(-1)[0] + } else if (process.env.GITHUB_REF_NAME) { + return process.env.GITHUB_REF_NAME.split('/')[2] + } + console.info( + 'Unable to determine pull request number. Expected when run in local or not triggered by a PR event' + ) + return null +} + module.exports = { flakeTrackerID: flakeTrackerID, newFlakesShouldFailCheckSuite: newFlakesShouldFailCheckSuite, numRetries: numRetries, + isCI: isCI, org: org, repo: repo, + branch: branch, + sha: sha, + CiJob: CiJob, + prNumber: prNumber, shouldAddCheckToPR: shouldAddCheckToPR, shouldCreateIssues: shouldCreateIssues, shouldLogRetryErrorsOnFailure: shouldLogRetryErrorsOnFailure, diff --git a/packages/flake-tracker/src/github.js b/packages/flake-tracker/src/github.js index 656323baf68..420d5b0a180 100644 --- a/packages/flake-tracker/src/github.js +++ b/packages/flake-tracker/src/github.js @@ -14,8 +14,8 @@ const defaults = { const FlakeLabel = 'FLAKEY' const getLabels = () => { const labels = [FlakeLabel, utils.getPackageName()] - if (process.env.CIRCLECI) { - labels.push(process.env.CIRCLE_JOB) + if (config.isCI) { + labels.push(config.CiJob) } return labels } @@ -46,7 +46,7 @@ class GitHub { } async report(flakes, skippedTests, obsoleteIssues) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return const promises = [] if (config.shouldCreateIssues) { // Check list of ALL flakey issues to ensure no duplicates @@ -71,13 +71,13 @@ class GitHub { } async createIssues(flakes) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return return Promise.all(flakes.map((f) => this.createIssue(f))) } async createIssue(flake) { - if (!process.env.CIRCLECI) return - flake.body = 'Discovered at commit ' + process.env.CIRCLE_SHA1 + '\n\n' + flake.body + '\n' + if (!config.isCI) return + flake.body = 'Discovered at commit ' + config.sha + '\n\n' + flake.body + '\n' const fn = () => this.rest.issues.create({ ...defaults, @@ -90,8 +90,8 @@ class GitHub { } async fetchMandatoryTestsForPR() { - if (!process.env.CIRCLECI || process.env.CIRCLE_BRANCH === 'master') return [] - const prNumber = utils.getPullNumber() + if (!config.isCI || config.branch === 'master') return [] + const prNumber = config.prNumber const fn = () => this.rest.pulls.get({ ...defaults, @@ -128,31 +128,27 @@ class GitHub { } async handleObsoleteIssues(obsoleteIssues) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return const promises = [this.addObsoleteIssuesCheck(obsoleteIssues)] - if (process.env.CIRCLE_BRANCH === 'master') { + if (config.branch === 'master') { promises.push(this.closeIssues(obsoleteIssues)) } return Promise.all(promises) } async closeIssues(issues) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return return Promise.all(issues.map((i) => this.closeIssue(i))) } async closeIssue(issue) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return const fn = () => this.rest.issues.update({ ...defaults, issue_number: issue.number, state: 'closed', - body: - 'FlakeTracker closed this issue after commit ' + - process.env.CIRCLE_SHA1 + - '\n\n' + - issue.body, + body: 'FlakeTracker closed this issue after commit ' + config.sha + '\n\n' + issue.body, }) console.log('\nClosing obsolete issue ' + issue.number + '...') const errMsg = 'Failed to close obsolete issue.' @@ -160,19 +156,19 @@ class GitHub { } async addObsoleteIssuesCheck(obsoleteIssues) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return if (obsoleteIssues.length) { await this.addCheckRun( { ...defaults, name: utils.getTestSuiteTitles().join(' -> '), - head_sha: process.env.CIRCLE_SHA1, + head_sha: config.sha, conclusion: 'neutral', output: { title: 'Obsolete Issues', summary: 'Some flakey test issues no longer correspond to actual tests', text: - (process.env.CIRCLE_BRANCH === 'master' + (config.branch === 'master' ? 'Because these flakey test issues are now obsolete on master, they have been automatically closed.' : 'If tests have been refactored or renamed please update the following issues accordingly (but not too long before your PR is merged, as to avoid interfering with other concurrent workflows). If left unchanged, these issues will be automatically closed when this PR is merged.') + '\n\n' + @@ -187,15 +183,15 @@ class GitHub { // addSummaryCheck is called in a final job added to the CI workflow. // It provides a breakdown of where flakey tests are located. async addSummaryCheck() { - if (!process.env.CIRCLECI) return + if (!config.isCI) return const title = 'Flakey Test Summary' - const optsBase = { ...defaults, name: 'Summary', head_sha: process.env.CIRCLE_SHA1 } + const optsBase = { ...defaults, name: 'Summary', head_sha: config.sha } // Get FlakeTracker check runs added so far let fn = () => this.rest.checks.listSuitesForRef({ ...defaults, - ref: process.env.CIRCLE_SHA1, + ref: config.sha, app_id: config.flakeTrackerID, }) @@ -265,7 +261,7 @@ class GitHub { } async addFlakeCheck(flakes, skippedTests) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return const conclusion = utils.getConclusion(flakes, skippedTests) // Only add checks when there's flakiness (otherwise check suite gets cluttered) @@ -305,7 +301,7 @@ class GitHub { { ...defaults, name: name, - head_sha: process.env.CIRCLE_SHA1, + head_sha: config.sha, conclusion: conclusionToDisplay, output: output, }, @@ -314,7 +310,7 @@ class GitHub { } async addCheckRun(opts, errMsg) { - if (!process.env.CIRCLECI) return + if (!config.isCI) return const fn = () => { return this.rest.checks.create(opts) } diff --git a/packages/flake-tracker/src/utils.js b/packages/flake-tracker/src/utils.js index 851bf520543..95fc5250acd 100644 --- a/packages/flake-tracker/src/utils.js +++ b/packages/flake-tracker/src/utils.js @@ -1,3 +1,5 @@ +const { config } = require('process') + // Emojis const fire = String.fromCodePoint(0x1f525) const partyFace = String.fromCodePoint(0x1f973) @@ -40,13 +42,6 @@ function fmtIssueBody(errors) { return body } -function getPullNumber() { - if (process.env.CIRCLECI && process.env.CIRCLE_BRANCH !== 'master') { - const prUrl = process.env.CIRCLE_PULL_REQUEST - return prUrl.slice(prUrl.lastIndexOf('/') + 1) - } -} - // Parses list of flakey test issues to ignore from the PR's body. // The tests corresponding to these issues will not be skipped. function parseMandatoryTestIssuesFromPullBody(prBody) { @@ -70,8 +65,8 @@ function getTestSuiteDir() { function getTestSuiteTitles() { const titles = [getTestSuiteDir()] - if (process.env.CIRCLECI) { - titles.unshift(process.env.CIRCLE_JOB) + if (config.isCI) { + titles.unshift(config.CiJob) } return titles } @@ -299,7 +294,6 @@ module.exports = { fmtWorkflowSummary: fmtWorkflowSummary, getConclusion: getConclusion, getPackageName: getPackageName, - getPullNumber: getPullNumber, getRandomSuccessImage: getRandomSuccessImage, getTestSuiteDir: getTestSuiteDir, getTestSuiteTitles: getTestSuiteTitles, From 561abf99b20cd1359fb07a004ae127415b0a8165 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 12 May 2023 16:18:58 +0000 Subject: [PATCH 137/154] Retry commands --- .github/workflows/circleci.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 77b3ff428a3..22b52c26cb2 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -1,6 +1,9 @@ name: celo-monorepo run-name: celo-monorepo tests +# Dockefile for the self-hosted runner: +# https://github.com/celo-org/infrastructure/blob/master/terraform/root-modules/gcp/integration-tests-gke/files/github-arc/Dockerfile-monorepo + on: push: branches: @@ -284,7 +287,7 @@ jobs: # Keeping name short because GitHub UI does not handle long names well name: ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] - timeout-minutes: 30 + timeout-minutes: 60 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || @@ -346,8 +349,12 @@ jobs: with: limit-access-to-actor: true - name: Execute matrix command for test - run: | - ${{ matrix.command }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + command: | + ${{ matrix.command }} contractkit-tests: name: ContractKit Tests runs-on: ["self-hosted", "monorepo"] @@ -574,7 +581,7 @@ jobs: # Keeping name short because GitHub UI does not handle long names well name: e2e ${{ matrix.name }} runs-on: ["self-hosted", "monorepo"] - timeout-minutes: 30 + timeout-minutes: 60 needs: [install-dependencies, lint-checks, pre-protocol-test-release] if: | contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || @@ -654,8 +661,12 @@ jobs: with: limit-access-to-actor: true - name: Execute matrix command for test - run: | - ${{ matrix.command }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + command: | + ${{ matrix.command }} # TODO: Ask Identity team to check if this is relevant odis-test: From f30f93f3a3c26f59d9adabd1fb59eb38b053e3de Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 24 May 2023 08:14:50 +0000 Subject: [PATCH 138/154] Testing with celo-blockchain release branch --- .github/workflows/circleci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 22b52c26cb2..82f6f361fbe 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -28,7 +28,8 @@ env: GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"' # Git Tag for contract release to use RELEASE_TAG: core-contracts.v9 - CELO_BLOCKCHAIN_BRANCH_TO_TEST: master + # CELO_BLOCKCHAIN_BRANCH_TO_TEST: master + CELO_BLOCKCHAIN_BRANCH_TO_TEST: release/1.7.x jobs: install-dependencies: From 3f2594a55708948bc78082614167c254da697341 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 24 May 2023 09:51:28 +0000 Subject: [PATCH 139/154] Increase mocha timeout --- packages/flake-tracker/src/mocha/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/flake-tracker/src/mocha/config.js b/packages/flake-tracker/src/mocha/config.js index ef9eaa95501..1733b0b2e1d 100644 --- a/packages/flake-tracker/src/mocha/config.js +++ b/packages/flake-tracker/src/mocha/config.js @@ -4,5 +4,6 @@ module.exports = shouldTrackFlakes ? { reporter: require.resolve('./reporter'), retries: numRetries, + timeout: '120s', } : {} From 70dccf9677a41bdbffe0a925d2d55dcafee551c1 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 24 May 2023 14:24:04 +0000 Subject: [PATCH 140/154] Disable mocha timeouts --- packages/flake-tracker/src/mocha/config.js | 1 - packages/protocol/truffle-config.js | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flake-tracker/src/mocha/config.js b/packages/flake-tracker/src/mocha/config.js index 1733b0b2e1d..ef9eaa95501 100644 --- a/packages/flake-tracker/src/mocha/config.js +++ b/packages/flake-tracker/src/mocha/config.js @@ -4,6 +4,5 @@ module.exports = shouldTrackFlakes ? { reporter: require.resolve('./reporter'), retries: numRetries, - timeout: '120s', } : {} diff --git a/packages/protocol/truffle-config.js b/packages/protocol/truffle-config.js index 98db1afe31c..3fb0e31da37 100644 --- a/packages/protocol/truffle-config.js +++ b/packages/protocol/truffle-config.js @@ -5,6 +5,7 @@ const WebsocketSubprovider = require('web3-provider-engine/subproviders/websocke const { TruffleArtifactAdapter } = require('@0x/sol-trace') const { CoverageSubprovider } = require('@0x/sol-coverage') const flakeTrackingConfig = require('@celo/flake-tracker/src/mocha/config.js') +const mochaConfig = { enableTimeouts: false } var Web3 = require('web3') var net = require('net') @@ -225,7 +226,7 @@ module.exports = { }, }, networks, - mocha: flakeTrackingConfig, + mocha: { ...flakeTrackingConfig, ...mochaConfig }, } if (process.argv.includes('--gas')) { From e9ed4c2dc8f163f5f484664bd51eac513c427162 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 24 May 2023 15:41:07 +0000 Subject: [PATCH 141/154] Increase action retry timeout --- .github/workflows/circleci.yml | 4 ++-- packages/protocol/truffle-config.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 82f6f361fbe..47d78a9cdc4 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -352,7 +352,7 @@ jobs: - name: Execute matrix command for test uses: nick-fields/retry@v2 with: - timeout_minutes: 10 + timeout_minutes: 30 max_attempts: 3 command: | ${{ matrix.command }} @@ -664,7 +664,7 @@ jobs: - name: Execute matrix command for test uses: nick-fields/retry@v2 with: - timeout_minutes: 10 + timeout_minutes: 30 max_attempts: 3 command: | ${{ matrix.command }} diff --git a/packages/protocol/truffle-config.js b/packages/protocol/truffle-config.js index 3fb0e31da37..98db1afe31c 100644 --- a/packages/protocol/truffle-config.js +++ b/packages/protocol/truffle-config.js @@ -5,7 +5,6 @@ const WebsocketSubprovider = require('web3-provider-engine/subproviders/websocke const { TruffleArtifactAdapter } = require('@0x/sol-trace') const { CoverageSubprovider } = require('@0x/sol-coverage') const flakeTrackingConfig = require('@celo/flake-tracker/src/mocha/config.js') -const mochaConfig = { enableTimeouts: false } var Web3 = require('web3') var net = require('net') @@ -226,7 +225,7 @@ module.exports = { }, }, networks, - mocha: { ...flakeTrackingConfig, ...mochaConfig }, + mocha: flakeTrackingConfig, } if (process.argv.includes('--gas')) { From 8f06fff6148295ca65f30dc3e7272f412e98ce91 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 24 May 2023 18:13:29 +0200 Subject: [PATCH 142/154] Fix flake-tracker when run out from CI --- packages/flake-tracker/src/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flake-tracker/src/config.js b/packages/flake-tracker/src/config.js index cc4dea1eb3a..e4fbac1c938 100644 --- a/packages/flake-tracker/src/config.js +++ b/packages/flake-tracker/src/config.js @@ -1,9 +1,9 @@ const isCI = process.env.CIRCLECI || process.env.CI const org = - process.env.CIRCLE_PROJECT_USERNAME || process.env.GITHUB_REPOSITORY.split('/')[0] || 'celo-org' + process.env.CIRCLE_PROJECT_USERNAME || process.env.GITHUB_REPOSITORY?.split('/')[0] || 'celo-org' const repo = process.env.CIRCLE_PROJECT_REPONAME || - process.env.GITHUB_REPOSITORY.split('/')[1] || + process.env.GITHUB_REPOSITORY?.split('/')[1] || 'celo-monorepo' const branch = process.env.CIRCLE_BRANCH || process.env.GITHUB_REF_NAME const sha = process.env.CIRCLE_SHA1 || process.env.GITHUB_SHA From ca0141090c2abe109e6ff786677a957ef4946a07 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 24 May 2023 18:37:22 +0200 Subject: [PATCH 143/154] Fix flake-tracker when run out from CI --- packages/flake-tracker/src/config.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/flake-tracker/src/config.js b/packages/flake-tracker/src/config.js index e4fbac1c938..0806539da0e 100644 --- a/packages/flake-tracker/src/config.js +++ b/packages/flake-tracker/src/config.js @@ -1,10 +1,12 @@ const isCI = process.env.CIRCLECI || process.env.CI -const org = - process.env.CIRCLE_PROJECT_USERNAME || process.env.GITHUB_REPOSITORY?.split('/')[0] || 'celo-org' -const repo = - process.env.CIRCLE_PROJECT_REPONAME || - process.env.GITHUB_REPOSITORY?.split('/')[1] || - 'celo-monorepo' +let org, repo +if (process.env.GITHUB_REPOSITORY) { + org = process.env.GITHUB_REPOSITORY.split('/')[0] + repo = process.env.GITHUB_REPOSITORY.split('/')[1] +} else { + org = process.env.CIRCLE_PROJECT_USERNAME || 'celo-org' + repo = process.env.CIRCLE_PROJECT_REPONAME || 'celo-monorepo' +} const branch = process.env.CIRCLE_BRANCH || process.env.GITHUB_REF_NAME const sha = process.env.CIRCLE_SHA1 || process.env.GITHUB_SHA const CiJob = process.env.CIRCLE_JOB || process.env.GITHUB_JOB From 0fc14c623a0ba02d24f41b6b05feabf1f9e5cacf Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 26 May 2023 10:19:54 +0200 Subject: [PATCH 144/154] Review improvements --- .github/workflows/circleci.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 47d78a9cdc4..07be845746a 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -62,7 +62,7 @@ jobs: git checkout master git checkout ${GITHUB_SHA} # Verify that following commands work, they are later called in the incremental testing script - # There output does not matter here, the fact that they finish successfully does. + # Their output does not matter here, the fact that they finish successfully does. git rev-parse --abbrev-ref HEAD git fetch --all --tags - name: Calculate node cache keys @@ -84,6 +84,7 @@ jobs: restore-keys: | node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}- # We use cache to share the build artifacts between jobs (gh artifacts are too slow...) + # For more context check https://github.com/actions/upload-artifact/issues/199 - name: Restore build artifacts cache uses: actions/cache@v3 id: cache_build_artifacts @@ -120,15 +121,8 @@ jobs: - name: Build packages run: yarn build --ignore docs --include-dependencies - name: Check licenses + if: steps.cache_node.outputs.cache-hit != 'true' run: | - if [ ! -e ~/.tmp/yarn_deps_have_changed ]; then - # Internally `yarn check-licenses` downloads dependencies into its cache again even if node_modules are up-to-date - # which happens when we've restored our cached node_modules. - # Making `yarn check-licenses` take ~45secs instead of ~3secs (depending on network conditions and build machine) - # So here we skip checking when it's unnecessary - echo "Skipping checking licenses, dependencies haven't changed" - exit 0 - fi yarn check-licenses - name: Detect files changed in PR, and expose as output id: changed-files @@ -177,6 +171,7 @@ jobs: - name: Run Jest Tests run: | mkdir -p test-results/jest + # Skipping packages that have an specific job yarn run lerna \ --ignore @celo/contractkit \ --ignore @celo/protocol \ From fde4ee31ba4d1c14478caeb3bb4ef6c5a094d22d Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 30 May 2023 13:31:37 +0200 Subject: [PATCH 145/154] More review driven improvements --- .github/workflows/circleci.yml | 3 +-- .github/workflows/cron-npm-install.yml | 1 + .github/workflows/cron-protocol-test-with-coverage.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 07be845746a..4f2429b75e5 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -171,7 +171,7 @@ jobs: - name: Run Jest Tests run: | mkdir -p test-results/jest - # Skipping packages that have an specific job + # Skipping packages that are tested in a specific job below yarn run lerna \ --ignore @celo/contractkit \ --ignore @celo/protocol \ @@ -664,7 +664,6 @@ jobs: command: | ${{ matrix.command }} - # TODO: Ask Identity team to check if this is relevant odis-test: name: ODIS test runs-on: ["self-hosted", "monorepo"] diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml index 25483888421..5ec884dad4b 100644 --- a/.github/workflows/cron-npm-install.yml +++ b/.github/workflows/cron-npm-install.yml @@ -3,6 +3,7 @@ name: NPM install testing workflow # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule on: schedule: + # daily at 19:00 UTC - cron: 0 19 * * * workflow_dispatch: pull_request: diff --git a/.github/workflows/cron-protocol-test-with-coverage.yml b/.github/workflows/cron-protocol-test-with-coverage.yml index 032f9acb8e2..f5dd4f36847 100644 --- a/.github/workflows/cron-protocol-test-with-coverage.yml +++ b/.github/workflows/cron-protocol-test-with-coverage.yml @@ -4,6 +4,7 @@ name: Protocol tests with coverage # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule on: schedule: + # daily at 13:00 UTC - cron: 0 13 * * * workflow_dispatch: From e8ad3de971a8923cb156b16ea482be4f14ca5036 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Tue, 30 May 2023 13:33:23 +0200 Subject: [PATCH 146/154] CiJob -> ciJob --- packages/flake-tracker/src/config.js | 4 +- packages/flake-tracker/src/github.js | 2 +- packages/flake-tracker/src/utils.js | 250 ++++++++++++++------------- 3 files changed, 133 insertions(+), 123 deletions(-) diff --git a/packages/flake-tracker/src/config.js b/packages/flake-tracker/src/config.js index 0806539da0e..8b7d9b7b36e 100644 --- a/packages/flake-tracker/src/config.js +++ b/packages/flake-tracker/src/config.js @@ -9,7 +9,7 @@ if (process.env.GITHUB_REPOSITORY) { } const branch = process.env.CIRCLE_BRANCH || process.env.GITHUB_REF_NAME const sha = process.env.CIRCLE_SHA1 || process.env.GITHUB_SHA -const CiJob = process.env.CIRCLE_JOB || process.env.GITHUB_JOB +const ciJob = process.env.CIRCLE_JOB || process.env.GITHUB_JOB const prNumber = getPullNumber() const defaultNumRetries = branch === 'master' ? 15 : 5 const flakeTrackerID = 71131 // This is the FlakeTracker GitHub App ID. @@ -89,7 +89,7 @@ module.exports = { repo: repo, branch: branch, sha: sha, - CiJob: CiJob, + ciJob: ciJob, prNumber: prNumber, shouldAddCheckToPR: shouldAddCheckToPR, shouldCreateIssues: shouldCreateIssues, diff --git a/packages/flake-tracker/src/github.js b/packages/flake-tracker/src/github.js index 420d5b0a180..42edc81992e 100644 --- a/packages/flake-tracker/src/github.js +++ b/packages/flake-tracker/src/github.js @@ -15,7 +15,7 @@ const FlakeLabel = 'FLAKEY' const getLabels = () => { const labels = [FlakeLabel, utils.getPackageName()] if (config.isCI) { - labels.push(config.CiJob) + labels.push(config.ciJob) } return labels } diff --git a/packages/flake-tracker/src/utils.js b/packages/flake-tracker/src/utils.js index 95fc5250acd..2a65eceda78 100644 --- a/packages/flake-tracker/src/utils.js +++ b/packages/flake-tracker/src/utils.js @@ -1,99 +1,101 @@ -const { config } = require('process') +const { config } = require("process"); // Emojis -const fire = String.fromCodePoint(0x1f525) -const partyFace = String.fromCodePoint(0x1f973) -const stressFace = String.fromCodePoint(0x1f613) -const greenCheck = String.fromCodePoint(0x2705) -const redX = String.fromCodePoint(0x274c) -const snowflake = String.fromCharCode(0x2744) -const warning = String.fromCodePoint(0x26a0) -const relievedSmileFace = String.fromCodePoint(0x1f60c) -const hands = String.fromCodePoint(0x1f64c) -const warningLight = String.fromCodePoint(0x1f6a8) - -const flakeTitlePrefix = '[FLAKEY TEST] ' +const fire = String.fromCodePoint(0x1f525); +const partyFace = String.fromCodePoint(0x1f973); +const stressFace = String.fromCodePoint(0x1f613); +const greenCheck = String.fromCodePoint(0x2705); +const redX = String.fromCodePoint(0x274c); +const snowflake = String.fromCharCode(0x2744); +const warning = String.fromCodePoint(0x26a0); +const relievedSmileFace = String.fromCodePoint(0x1f60c); +const hands = String.fromCodePoint(0x1f64c); +const warningLight = String.fromCodePoint(0x1f6a8); + +const flakeTitlePrefix = "[FLAKEY TEST] "; const statuses = { - failure: 'flakey tests were found', - neutral: 'flakey tests were skipped', - success: 'no flakey tests found!', -} + failure: "flakey tests were found", + neutral: "flakey tests were skipped", + success: "no flakey tests found!", +}; const emojis = { failure: redX, neutral: warningLight, success: greenCheck, -} +}; function fmtFlakeIssue(testID, errors) { return { title: flakeTitlePrefix + testID, body: fmtIssueBody(errors), - } + }; } function fmtIssueBody(errors) { - errors.push('Test Passed!') - let body = '' + errors.push("Test Passed!"); + let body = ""; for (let i = 0; i < errors.length; i++) { - body += 'Attempt No. ' + (i + 1) + ':\n\n' + errors[i] + '\n\n' + body += "Attempt No. " + (i + 1) + ":\n\n" + errors[i] + "\n\n"; } - return body + return body; } // Parses list of flakey test issues to ignore from the PR's body. // The tests corresponding to these issues will not be skipped. function parseMandatoryTestIssuesFromPullBody(prBody) { - const urls = prBody.match(/https?[\S]+issues\/[0-9]+/g) || [] + const urls = prBody.match(/https?[\S]+issues\/[0-9]+/g) || []; const issueNumbers = urls.map((url) => - url.slice(url.lastIndexOf('/') + 1).replace(/[^0-9]+/g, '') - ) - return issueNumbers + url.slice(url.lastIndexOf("/") + 1).replace(/[^0-9]+/g, "") + ); + return issueNumbers; } function getPackageName() { - const testSuiteDir = getTestSuiteDir() - const i = testSuiteDir.indexOf('/') - return i == -1 ? testSuiteDir : testSuiteDir.slice(0, i) + const testSuiteDir = getTestSuiteDir(); + const i = testSuiteDir.indexOf("/"); + return i == -1 ? testSuiteDir : testSuiteDir.slice(0, i); } function getTestSuiteDir() { - const rootDelim = 'packages/' - return process.cwd().slice(process.cwd().lastIndexOf(rootDelim) + rootDelim.length) + const rootDelim = "packages/"; + return process + .cwd() + .slice(process.cwd().lastIndexOf(rootDelim) + rootDelim.length); } function getTestSuiteTitles() { - const titles = [getTestSuiteDir()] + const titles = [getTestSuiteDir()]; if (config.isCI) { - titles.unshift(config.CiJob) + titles.unshift(config.ciJob); } - return titles + return titles; } function fmtTestTitles(titles) { - titles.unshift(...getTestSuiteTitles()) - return titles.join(' -> ').trim() + titles.unshift(...getTestSuiteTitles()); + return titles.join(" -> ").trim(); } function parseFirstErrFromFlakeBody(body) { - return body.split(/Attempt No\. [0-9]+:/g)[1] + return body.split(/Attempt No\. [0-9]+:/g)[1]; } function parseFirstLineOfStack(stack) { - return stack.split('at ')[1] + return stack.split("at ")[1]; } function parsePathFromStack(stack) { - return parseFirstLineOfStack(stack).split(':')[0] + return parseFirstLineOfStack(stack).split(":")[0]; } function parseErrLineNumberFromStack(stack) { - return Number(parseFirstLineOfStack(stack).split(':')[1]) + return Number(parseFirstLineOfStack(stack).split(":")[1]); } function parseTestIdFromFlakeTitle(title) { - return title.replace(flakeTitlePrefix, '').trim() + return title.replace(flakeTitlePrefix, "").trim(); } function parseDownFlakeIssue(issue) { @@ -102,15 +104,15 @@ function parseDownFlakeIssue(issue) { html_url, number, body, - }))(issue) + }))(issue); } function getConclusion(flakes, skippedTests) { - let conclusion = 'failure' + let conclusion = "failure"; if (!flakes.length) { - conclusion = skippedTests.length ? 'neutral' : 'success' + conclusion = skippedTests.length ? "neutral" : "success"; } - return conclusion + return conclusion; } // You can set verbosity to either 0, 1, 2, 3, or 4 @@ -121,168 +123,176 @@ function getConclusion(flakes, skippedTests) { // 0 => short one line status function fmtSummary(flakes, skippedTests, verbosity) { if (![0, 1, 2, 3, 4].includes(verbosity)) { - verbosity = 0 // default is lowest verbosity + verbosity = 0; // default is lowest verbosity } if (verbosity == 0) { if (flakes.length) { - return 'New flakiness detected ' + redX + return "New flakiness detected " + redX; } if (skippedTests.length) { - return 'Some tests were skipped due to flakiness. No new flakey tests were found.' + return "Some tests were skipped due to flakiness. No new flakey tests were found."; } - return 'We have achieved zero flakiness ' + hands + ' ' + greenCheck + return "We have achieved zero flakiness " + hands + " " + greenCheck; } - let summary = verbosity > 2 ? '\n_____FlakeTracker_____\n' : '' + let summary = verbosity > 2 ? "\n_____FlakeTracker_____\n" : ""; if (skippedTests.length) { - summary += '\n' + warning + ' ' + summary += "\n" + warning + " "; if (skippedTests.length === 1) { - summary += '1 flakey test was skipped \n' + summary += "1 flakey test was skipped \n"; } else { - summary += skippedTests.length + ' flakey tests were skipped \n' + summary += skippedTests.length + " flakey tests were skipped \n"; } if (verbosity > 1) { skippedTests.forEach((skip) => { - summary += '\n' + skip + '\n' - }) + summary += "\n" + skip + "\n"; + }); } } else { - summary += '\n' + fire + ' no flakey tests were skipped\n' + summary += "\n" + fire + " no flakey tests were skipped\n"; } if (flakes.length) { - summary += '\n' + stressFace + ' ' + summary += "\n" + stressFace + " "; if (flakes.length === 1) { - summary += '1 new flakey test found\n' + summary += "1 new flakey test found\n"; } else { - summary += flakes.length + ' new flakey tests found\n' + summary += flakes.length + " new flakey tests found\n"; } switch (verbosity) { case 2: flakes.forEach((f) => { - summary += '\n' + f.title + '\n' - }) - break + summary += "\n" + f.title + "\n"; + }); + break; case 3: flakes.forEach((f) => { - summary += '\n' + f.title + parseFirstErrFromFlakeBody(f.body) + '\n' - }) - break + summary += "\n" + f.title + parseFirstErrFromFlakeBody(f.body) + "\n"; + }); + break; case 4: - let i = 0 + let i = 0; flakes.forEach((f) => { - summary += '\n' + ++i + ')\n\n' + f.title + '\n\n' + f.body + '\n' - }) - break + summary += "\n" + ++i + ")\n\n" + f.title + "\n\n" + f.body + "\n"; + }); + break; default: - break + break; } } else { - summary += '\n' + partyFace + ' no new flakey tests found!\n' + summary += "\n" + partyFace + " no new flakey tests found!\n"; } - return summary + return summary; } function sumVals(obj) { - return Object.values(obj).reduce((acc, x) => acc + x, 0) + return Object.values(obj).reduce((acc, x) => acc + x, 0); } // Use i == 0 for breakdowns by job, i == 1 for breakdowns by package function parseBreakdown(breakdownByTestSuite, i) { - const breakdown = {} + const breakdown = {}; Object.keys(breakdownByTestSuite).forEach((testSuite) => { - const key = testSuite.split(' -> ')[i] // We id test suites by `jobName -> packageName` + const key = testSuite.split(" -> ")[i]; // We id test suites by `jobName -> packageName` breakdown[key] = breakdown[key] ? breakdown[key] + breakdownByTestSuite[testSuite] - : breakdownByTestSuite[testSuite] - }) - return breakdown + : breakdownByTestSuite[testSuite]; + }); + return breakdown; } function fmtBreakdown(breakdownByTestSuite, total) { - let text = '' - const breakdownByPackage = parseBreakdown(breakdownByTestSuite, 1) - const breakdownByJob = parseBreakdown(breakdownByTestSuite, 0) + let text = ""; + const breakdownByPackage = parseBreakdown(breakdownByTestSuite, 1); + const breakdownByJob = parseBreakdown(breakdownByTestSuite, 0); const fmtPercentage = (n, d) => { - return ((n / d) * 100).toFixed(1) + '%' - } + return ((n / d) * 100).toFixed(1) + "%"; + }; - text += '\n\tBy Package:\n' + text += "\n\tBy Package:\n"; Object.keys(breakdownByPackage).forEach((pkg) => { - const num = breakdownByPackage[pkg] - text += '\n\t\t' + pkg + ': ' + num + ' (' + fmtPercentage(num, total) + ')\n' - }) + const num = breakdownByPackage[pkg]; + text += + "\n\t\t" + pkg + ": " + num + " (" + fmtPercentage(num, total) + ")\n"; + }); - text += '\n\tBy Job:\n' + text += "\n\tBy Job:\n"; Object.keys(breakdownByJob).forEach((job) => { - const num = breakdownByJob[job] - text += '\n\t\t' + job + ': ' + num + ' (' + fmtPercentage(num, total) + ')\n' - }) + const num = breakdownByJob[job]; + text += + "\n\t\t" + job + ": " + num + " (" + fmtPercentage(num, total) + ")\n"; + }); - return text + return text; } function parseNumFlakes(text, regex) { return (text.match(regex) || []) - .map((str) => str.replace(/[^0-9]+/, '')) - .reduce((acc, x) => acc + Number(x), 0) + .map((str) => str.replace(/[^0-9]+/, "")) + .reduce((acc, x) => acc + Number(x), 0); } // This is used only by the flakey-test-summary job added to the end of the workflow function fmtWorkflowSummary(foundFlakes, skippedFlakes, totalFlakes) { - let summary = '\n_____FlakeTracker Workflow Summary_____\n' + let summary = "\n_____FlakeTracker Workflow Summary_____\n"; - const total = sumVals(totalFlakes) - const found = sumVals(foundFlakes) - const skipped = sumVals(skippedFlakes) + const total = sumVals(totalFlakes); + const found = sumVals(foundFlakes); + const skipped = sumVals(skippedFlakes); summary += - '\nTotal flakey tests in this workflow: ' + + "\nTotal flakey tests in this workflow: " + total + - ' ' + - '(discovered: ' + + " " + + "(discovered: " + found + - ', skipped: ' + + ", skipped: " + skipped + - ')\n' + ")\n"; if (total) { - summary += '\nBreakdown of all flakey tests:\n' + fmtBreakdown(totalFlakes, total) + summary += + "\nBreakdown of all flakey tests:\n" + fmtBreakdown(totalFlakes, total); if (found) { - summary += '\nBreakdown of new flakey tests:\n' + fmtBreakdown(foundFlakes, found) + summary += + "\nBreakdown of new flakey tests:\n" + fmtBreakdown(foundFlakes, found); } if (skipped) { - summary += '\nBreakdown of skipped flakey tests:\n' + fmtBreakdown(skippedFlakes, skipped) + summary += + "\nBreakdown of skipped flakey tests:\n" + + fmtBreakdown(skippedFlakes, skipped); } } - return summary + return summary; } function getRandomSuccessImage() { const fmtImage = (url) => { return { image_url: url, - alt: 'Hooray! ' + url, - } - } + alt: "Hooray! " + url, + }; + }; const images = [ // Please add more gifs :) - 'https://media.giphy.com/media/mQG644PY8O7rG/source.gif', - 'https://media.giphy.com/media/4xpB3eE00FfBm/source.gif', - 'https://media.giphy.com/media/kBZBlLVlfECvOQAVno/source.gif', - 'https://media.giphy.com/media/l4JySAWfMaY7w88sU/source.gif', - 'https://media.giphy.com/media/2fQ1Gq3KOpvNs4NTmu/source.gif', - ].map(fmtImage) - return images[Math.floor(Math.random() * images.length)] + "https://media.giphy.com/media/mQG644PY8O7rG/source.gif", + "https://media.giphy.com/media/4xpB3eE00FfBm/source.gif", + "https://media.giphy.com/media/kBZBlLVlfECvOQAVno/source.gif", + "https://media.giphy.com/media/l4JySAWfMaY7w88sU/source.gif", + "https://media.giphy.com/media/2fQ1Gq3KOpvNs4NTmu/source.gif", + ].map(fmtImage); + return images[Math.floor(Math.random() * images.length)]; } function calcObsoleteFlakeIssues(skippedTests, knownFlakes) { - return knownFlakes.filter((i) => !skippedTests.some((skipped) => i.title.includes(skipped))) + return knownFlakes.filter( + (i) => !skippedTests.some((skipped) => i.title.includes(skipped)) + ); } module.exports = { @@ -306,4 +316,4 @@ module.exports = { parsePathFromStack: parsePathFromStack, parseTestIdFromFlakeTitle: parseTestIdFromFlakeTitle, statuses: statuses, -} +}; From 0e4ea189f0b353784a6445c579938c7a11a7ce5c Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 31 May 2023 08:39:34 +0200 Subject: [PATCH 147/154] Test coverage workflow --- .github/workflows/cron-protocol-test-with-coverage.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/cron-protocol-test-with-coverage.yml b/.github/workflows/cron-protocol-test-with-coverage.yml index f5dd4f36847..55f86ae3854 100644 --- a/.github/workflows/cron-protocol-test-with-coverage.yml +++ b/.github/workflows/cron-protocol-test-with-coverage.yml @@ -6,8 +6,13 @@ on: schedule: # daily at 13:00 UTC - cron: 0 13 * * * + # TODO(jcortejoso): Delete before merging + push: + branches: + - jcortejoso/circleci-github-actions workflow_dispatch: + jobs: # This seems to take ages and last codecov report is from 2021-02-25 :/ # https://app.codecov.io/gh/celo-org/celo-monorepo/commits From f0b1af1e10e8ab5bfce9e558b126f8ed5b065098 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Wed, 31 May 2023 17:16:46 +0200 Subject: [PATCH 148/154] Final changes --- .github/workflows/cron-protocol-test-with-coverage.yml | 5 ----- package.json | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/cron-protocol-test-with-coverage.yml b/.github/workflows/cron-protocol-test-with-coverage.yml index 55f86ae3854..f5dd4f36847 100644 --- a/.github/workflows/cron-protocol-test-with-coverage.yml +++ b/.github/workflows/cron-protocol-test-with-coverage.yml @@ -6,13 +6,8 @@ on: schedule: # daily at 13:00 UTC - cron: 0 13 * * * - # TODO(jcortejoso): Delete before merging - push: - branches: - - jcortejoso/circleci-github-actions workflow_dispatch: - jobs: # This seems to take ages and last codecov report is from 2021-02-25 :/ # https://app.codecov.io/gh/celo-org/celo-monorepo/commits diff --git a/package.json b/package.json index bc6cba82d3b..e3408fcefa7 100644 --- a/package.json +++ b/package.json @@ -133,4 +133,4 @@ "websocket-extensions": "^0.1.4", "y18n": "^5.0.5" } -} \ No newline at end of file +} From e05ec3fc0c52839a70a9d23a1ac1cdbdbab658ad Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 1 Jun 2023 13:12:59 +0200 Subject: [PATCH 149/154] Fix linter --- packages/flake-tracker/src/utils.js | 250 +++++++++++++--------------- 1 file changed, 120 insertions(+), 130 deletions(-) diff --git a/packages/flake-tracker/src/utils.js b/packages/flake-tracker/src/utils.js index 2a65eceda78..38ec92e23e5 100644 --- a/packages/flake-tracker/src/utils.js +++ b/packages/flake-tracker/src/utils.js @@ -1,101 +1,99 @@ -const { config } = require("process"); +const { config } = require('process') // Emojis -const fire = String.fromCodePoint(0x1f525); -const partyFace = String.fromCodePoint(0x1f973); -const stressFace = String.fromCodePoint(0x1f613); -const greenCheck = String.fromCodePoint(0x2705); -const redX = String.fromCodePoint(0x274c); -const snowflake = String.fromCharCode(0x2744); -const warning = String.fromCodePoint(0x26a0); -const relievedSmileFace = String.fromCodePoint(0x1f60c); -const hands = String.fromCodePoint(0x1f64c); -const warningLight = String.fromCodePoint(0x1f6a8); - -const flakeTitlePrefix = "[FLAKEY TEST] "; +const fire = String.fromCodePoint(0x1f525) +const partyFace = String.fromCodePoint(0x1f973) +const stressFace = String.fromCodePoint(0x1f613) +const greenCheck = String.fromCodePoint(0x2705) +const redX = String.fromCodePoint(0x274c) +const snowflake = String.fromCharCode(0x2744) +const warning = String.fromCodePoint(0x26a0) +const relievedSmileFace = String.fromCodePoint(0x1f60c) +const hands = String.fromCodePoint(0x1f64c) +const warningLight = String.fromCodePoint(0x1f6a8) + +const flakeTitlePrefix = '[FLAKEY TEST] ' const statuses = { - failure: "flakey tests were found", - neutral: "flakey tests were skipped", - success: "no flakey tests found!", -}; + failure: 'flakey tests were found', + neutral: 'flakey tests were skipped', + success: 'no flakey tests found!', +} const emojis = { failure: redX, neutral: warningLight, success: greenCheck, -}; +} function fmtFlakeIssue(testID, errors) { return { title: flakeTitlePrefix + testID, body: fmtIssueBody(errors), - }; + } } function fmtIssueBody(errors) { - errors.push("Test Passed!"); - let body = ""; + errors.push('Test Passed!') + let body = '' for (let i = 0; i < errors.length; i++) { - body += "Attempt No. " + (i + 1) + ":\n\n" + errors[i] + "\n\n"; + body += 'Attempt No. ' + (i + 1) + ':\n\n' + errors[i] + '\n\n' } - return body; + return body } // Parses list of flakey test issues to ignore from the PR's body. // The tests corresponding to these issues will not be skipped. function parseMandatoryTestIssuesFromPullBody(prBody) { - const urls = prBody.match(/https?[\S]+issues\/[0-9]+/g) || []; + const urls = prBody.match(/https?[\S]+issues\/[0-9]+/g) || [] const issueNumbers = urls.map((url) => - url.slice(url.lastIndexOf("/") + 1).replace(/[^0-9]+/g, "") - ); - return issueNumbers; + url.slice(url.lastIndexOf('/') + 1).replace(/[^0-9]+/g, '') + ) + return issueNumbers } function getPackageName() { - const testSuiteDir = getTestSuiteDir(); - const i = testSuiteDir.indexOf("/"); - return i == -1 ? testSuiteDir : testSuiteDir.slice(0, i); + const testSuiteDir = getTestSuiteDir() + const i = testSuiteDir.indexOf('/') + return i == -1 ? testSuiteDir : testSuiteDir.slice(0, i) } function getTestSuiteDir() { - const rootDelim = "packages/"; - return process - .cwd() - .slice(process.cwd().lastIndexOf(rootDelim) + rootDelim.length); + const rootDelim = 'packages/' + return process.cwd().slice(process.cwd().lastIndexOf(rootDelim) + rootDelim.length) } function getTestSuiteTitles() { - const titles = [getTestSuiteDir()]; + const titles = [getTestSuiteDir()] if (config.isCI) { - titles.unshift(config.ciJob); + titles.unshift(config.ciJob) } - return titles; + return titles } function fmtTestTitles(titles) { - titles.unshift(...getTestSuiteTitles()); - return titles.join(" -> ").trim(); + titles.unshift(...getTestSuiteTitles()) + return titles.join(' -> ').trim() } function parseFirstErrFromFlakeBody(body) { - return body.split(/Attempt No\. [0-9]+:/g)[1]; + return body.split(/Attempt No\. [0-9]+:/g)[1] } function parseFirstLineOfStack(stack) { - return stack.split("at ")[1]; + return stack.split('at ')[1] } function parsePathFromStack(stack) { - return parseFirstLineOfStack(stack).split(":")[0]; + return parseFirstLineOfStack(stack).split(':')[0] } function parseErrLineNumberFromStack(stack) { - return Number(parseFirstLineOfStack(stack).split(":")[1]); + return Number(parseFirstLineOfStack(stack).split(':')[1]) } function parseTestIdFromFlakeTitle(title) { - return title.replace(flakeTitlePrefix, "").trim(); + return title.replace(flakeTitlePrefix, '').trim() } function parseDownFlakeIssue(issue) { @@ -104,15 +102,15 @@ function parseDownFlakeIssue(issue) { html_url, number, body, - }))(issue); + }))(issue) } function getConclusion(flakes, skippedTests) { - let conclusion = "failure"; + let conclusion = 'failure' if (!flakes.length) { - conclusion = skippedTests.length ? "neutral" : "success"; + conclusion = skippedTests.length ? 'neutral' : 'success' } - return conclusion; + return conclusion } // You can set verbosity to either 0, 1, 2, 3, or 4 @@ -123,176 +121,168 @@ function getConclusion(flakes, skippedTests) { // 0 => short one line status function fmtSummary(flakes, skippedTests, verbosity) { if (![0, 1, 2, 3, 4].includes(verbosity)) { - verbosity = 0; // default is lowest verbosity + verbosity = 0 // default is lowest verbosity } if (verbosity == 0) { if (flakes.length) { - return "New flakiness detected " + redX; + return 'New flakiness detected ' + redX } if (skippedTests.length) { - return "Some tests were skipped due to flakiness. No new flakey tests were found."; + return 'Some tests were skipped due to flakiness. No new flakey tests were found.' } - return "We have achieved zero flakiness " + hands + " " + greenCheck; + return 'We have achieved zero flakiness ' + hands + ' ' + greenCheck } - let summary = verbosity > 2 ? "\n_____FlakeTracker_____\n" : ""; + let summary = verbosity > 2 ? '\n_____FlakeTracker_____\n' : '' if (skippedTests.length) { - summary += "\n" + warning + " "; + summary += '\n' + warning + ' ' if (skippedTests.length === 1) { - summary += "1 flakey test was skipped \n"; + summary += '1 flakey test was skipped \n' } else { - summary += skippedTests.length + " flakey tests were skipped \n"; + summary += skippedTests.length + ' flakey tests were skipped \n' } if (verbosity > 1) { skippedTests.forEach((skip) => { - summary += "\n" + skip + "\n"; - }); + summary += '\n' + skip + '\n' + }) } } else { - summary += "\n" + fire + " no flakey tests were skipped\n"; + summary += '\n' + fire + ' no flakey tests were skipped\n' } if (flakes.length) { - summary += "\n" + stressFace + " "; + summary += '\n' + stressFace + ' ' if (flakes.length === 1) { - summary += "1 new flakey test found\n"; + summary += '1 new flakey test found\n' } else { - summary += flakes.length + " new flakey tests found\n"; + summary += flakes.length + ' new flakey tests found\n' } switch (verbosity) { case 2: flakes.forEach((f) => { - summary += "\n" + f.title + "\n"; - }); - break; + summary += '\n' + f.title + '\n' + }) + break case 3: flakes.forEach((f) => { - summary += "\n" + f.title + parseFirstErrFromFlakeBody(f.body) + "\n"; - }); - break; + summary += '\n' + f.title + parseFirstErrFromFlakeBody(f.body) + '\n' + }) + break case 4: - let i = 0; + let i = 0 flakes.forEach((f) => { - summary += "\n" + ++i + ")\n\n" + f.title + "\n\n" + f.body + "\n"; - }); - break; + summary += '\n' + ++i + ')\n\n' + f.title + '\n\n' + f.body + '\n' + }) + break default: - break; + break } } else { - summary += "\n" + partyFace + " no new flakey tests found!\n"; + summary += '\n' + partyFace + ' no new flakey tests found!\n' } - return summary; + return summary } function sumVals(obj) { - return Object.values(obj).reduce((acc, x) => acc + x, 0); + return Object.values(obj).reduce((acc, x) => acc + x, 0) } // Use i == 0 for breakdowns by job, i == 1 for breakdowns by package function parseBreakdown(breakdownByTestSuite, i) { - const breakdown = {}; + const breakdown = {} Object.keys(breakdownByTestSuite).forEach((testSuite) => { - const key = testSuite.split(" -> ")[i]; // We id test suites by `jobName -> packageName` + const key = testSuite.split(' -> ')[i] // We id test suites by `jobName -> packageName` breakdown[key] = breakdown[key] ? breakdown[key] + breakdownByTestSuite[testSuite] - : breakdownByTestSuite[testSuite]; - }); - return breakdown; + : breakdownByTestSuite[testSuite] + }) + return breakdown } function fmtBreakdown(breakdownByTestSuite, total) { - let text = ""; - const breakdownByPackage = parseBreakdown(breakdownByTestSuite, 1); - const breakdownByJob = parseBreakdown(breakdownByTestSuite, 0); + let text = '' + const breakdownByPackage = parseBreakdown(breakdownByTestSuite, 1) + const breakdownByJob = parseBreakdown(breakdownByTestSuite, 0) const fmtPercentage = (n, d) => { - return ((n / d) * 100).toFixed(1) + "%"; - }; + return ((n / d) * 100).toFixed(1) + '%' + } - text += "\n\tBy Package:\n"; + text += '\n\tBy Package:\n' Object.keys(breakdownByPackage).forEach((pkg) => { - const num = breakdownByPackage[pkg]; - text += - "\n\t\t" + pkg + ": " + num + " (" + fmtPercentage(num, total) + ")\n"; - }); + const num = breakdownByPackage[pkg] + text += '\n\t\t' + pkg + ': ' + num + ' (' + fmtPercentage(num, total) + ')\n' + }) - text += "\n\tBy Job:\n"; + text += '\n\tBy Job:\n' Object.keys(breakdownByJob).forEach((job) => { - const num = breakdownByJob[job]; - text += - "\n\t\t" + job + ": " + num + " (" + fmtPercentage(num, total) + ")\n"; - }); + const num = breakdownByJob[job] + text += '\n\t\t' + job + ': ' + num + ' (' + fmtPercentage(num, total) + ')\n' + }) - return text; + return text } function parseNumFlakes(text, regex) { return (text.match(regex) || []) - .map((str) => str.replace(/[^0-9]+/, "")) - .reduce((acc, x) => acc + Number(x), 0); + .map((str) => str.replace(/[^0-9]+/, '')) + .reduce((acc, x) => acc + Number(x), 0) } // This is used only by the flakey-test-summary job added to the end of the workflow function fmtWorkflowSummary(foundFlakes, skippedFlakes, totalFlakes) { - let summary = "\n_____FlakeTracker Workflow Summary_____\n"; + let summary = '\n_____FlakeTracker Workflow Summary_____\n' - const total = sumVals(totalFlakes); - const found = sumVals(foundFlakes); - const skipped = sumVals(skippedFlakes); + const total = sumVals(totalFlakes) + const found = sumVals(foundFlakes) + const skipped = sumVals(skippedFlakes) summary += - "\nTotal flakey tests in this workflow: " + + '\nTotal flakey tests in this workflow: ' + total + - " " + - "(discovered: " + + ' ' + + '(discovered: ' + found + - ", skipped: " + + ', skipped: ' + skipped + - ")\n"; + ')\n' if (total) { - summary += - "\nBreakdown of all flakey tests:\n" + fmtBreakdown(totalFlakes, total); + summary += '\nBreakdown of all flakey tests:\n' + fmtBreakdown(totalFlakes, total) if (found) { - summary += - "\nBreakdown of new flakey tests:\n" + fmtBreakdown(foundFlakes, found); + summary += '\nBreakdown of new flakey tests:\n' + fmtBreakdown(foundFlakes, found) } if (skipped) { - summary += - "\nBreakdown of skipped flakey tests:\n" + - fmtBreakdown(skippedFlakes, skipped); + summary += '\nBreakdown of skipped flakey tests:\n' + fmtBreakdown(skippedFlakes, skipped) } } - return summary; + return summary } function getRandomSuccessImage() { const fmtImage = (url) => { return { image_url: url, - alt: "Hooray! " + url, - }; - }; + alt: 'Hooray! ' + url, + } + } const images = [ // Please add more gifs :) - "https://media.giphy.com/media/mQG644PY8O7rG/source.gif", - "https://media.giphy.com/media/4xpB3eE00FfBm/source.gif", - "https://media.giphy.com/media/kBZBlLVlfECvOQAVno/source.gif", - "https://media.giphy.com/media/l4JySAWfMaY7w88sU/source.gif", - "https://media.giphy.com/media/2fQ1Gq3KOpvNs4NTmu/source.gif", - ].map(fmtImage); - return images[Math.floor(Math.random() * images.length)]; + 'https://media.giphy.com/media/mQG644PY8O7rG/source.gif', + 'https://media.giphy.com/media/4xpB3eE00FfBm/source.gif', + 'https://media.giphy.com/media/kBZBlLVlfECvOQAVno/source.gif', + 'https://media.giphy.com/media/l4JySAWfMaY7w88sU/source.gif', + 'https://media.giphy.com/media/2fQ1Gq3KOpvNs4NTmu/source.gif', + ].map(fmtImage) + return images[Math.floor(Math.random() * images.length)] } function calcObsoleteFlakeIssues(skippedTests, knownFlakes) { - return knownFlakes.filter( - (i) => !skippedTests.some((skipped) => i.title.includes(skipped)) - ); + return knownFlakes.filter((i) => !skippedTests.some((skipped) => i.title.includes(skipped))) } module.exports = { @@ -316,4 +306,4 @@ module.exports = { parsePathFromStack: parsePathFromStack, parseTestIdFromFlakeTitle: parseTestIdFromFlakeTitle, statuses: statuses, -}; +} From f7eab28dadb4d7863b519330695b2a84d3241a36 Mon Sep 17 00:00:00 2001 From: Eela Nagaraj Date: Fri, 2 Jun 2023 12:50:41 +0200 Subject: [PATCH 150/154] Add TestMode.ContractCall --- .../celotool/src/cmds/geth/simulate_client.ts | 21 +++++- packages/celotool/src/lib/geth.ts | 75 ++++++++++++------- 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/packages/celotool/src/cmds/geth/simulate_client.ts b/packages/celotool/src/cmds/geth/simulate_client.ts index 2cdc45779d9..31fb59d0b08 100644 --- a/packages/celotool/src/cmds/geth/simulate_client.ts +++ b/packages/celotool/src/cmds/geth/simulate_client.ts @@ -1,6 +1,6 @@ /* tslint:disable no-console */ import { AccountType, generateAddress } from 'src/lib/generate_utils' -import { getIndexForLoadTestThread, simulateClient, TestMode } from 'src/lib/geth' +import { TestMode, getIndexForLoadTestThread, simulateClient } from 'src/lib/geth' import * as yargs from 'yargs' export const command = 'simulate-client' @@ -13,6 +13,8 @@ interface SimulateClientArgv extends yargs.Argv { index: number mnemonic: string recipientIndex: number + contractAddress: string + contractData: string clientCount: number reuseClient: boolean testMode: string @@ -47,6 +49,16 @@ export const builder = () => { 'Index of the load test account to send transactions to. Used to generate account address', default: 0, }) + .options('contract-address', { + type: 'string', + description: `Contract Address to send to when using test mode: ${TestMode.ContractCall}`, + default: '', + }) + .options('contract-data', { + type: 'string', + description: `Data to send to when using test mode: ${TestMode.ContractCall}`, + default: '', + }) .options('mnemonic', { type: 'string', description: 'Mnemonic used to generate account addresses', @@ -64,8 +76,9 @@ export const builder = () => { }) .options('test-mode', { type: 'string', - description: 'Load test mode: mixed transaction types, big calldatas, or simple transfers', - choices: [TestMode.Mixed, TestMode.Data, TestMode.Transfer], + description: + 'Load test mode: mixed transaction types, big calldatas, simple transfers, or contract calls', + choices: [TestMode.Mixed, TestMode.Data, TestMode.Transfer, TestMode.ContractCall], default: TestMode.Mixed, }) } @@ -99,6 +112,8 @@ export const handler = async (argv: SimulateClientArgv) => { simulateClient( senderAddress, recipientAddress, + argv.contractAddress, + argv.contractData, argv.delay, argv.blockscoutUrl, argv.blockscoutMeasurePercent, diff --git a/packages/celotool/src/lib/geth.ts b/packages/celotool/src/lib/geth.ts index c572e5efbfe..d718a00cdf8 100644 --- a/packages/celotool/src/lib/geth.ts +++ b/packages/celotool/src/lib/geth.ts @@ -19,11 +19,11 @@ import { convertToContractDecimals } from './contract-utils' import { envVar, fetchEnv, isVmBased } from './env-utils' import { AccountType, + Validator, generateGenesis, generateGenesisWithMigrations, generatePrivateKey, privateKeyToPublicKey, - Validator, } from './generate_utils' import { retrieveClusterIPAddress, retrieveIPAddress } from './helm_deploy' import { GethInstanceConfig } from './interfaces/geth-instance-config' @@ -548,11 +548,14 @@ export enum TestMode { Mixed = 'mixed', Data = 'data', Transfer = 'transfer', + ContractCall = 'contract-call', } export const simulateClient = async ( senderAddress: string, recipientAddress: string, + contractAddress: string, + contractData: string, txPeriodMs: number, // time between new transactions in ms blockscoutUrl: string, blockscoutMeasurePercent: number, // percent of time in range [0, 100] to measure blockscout for a tx @@ -648,9 +651,17 @@ export const simulateClient = async ( const totalTxGas = 500000 // aim for half million gas txs const calldataGas = totalTxGas - intrinsicGas const calldataSize = calldataGas / 4 // 119750 < tx pool size limit (128k) - const dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs + let dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs // Also running below the 128kb limit from the tx pool + if (testMode === TestMode.ContractCall) { + if (!contractData || !contractAddress) { + throw new Error('Contract address and data must be provided for TestMode.ContractCall') + } + dataStr = contractData + recipientAddressFinal = contractAddress + } + await txConf .transferFn( kit, @@ -689,32 +700,40 @@ const getBigData = (size: number) => { } const getTxConf = async (testMode: TestMode) => { - if (testMode === TestMode.Data) { - return { - feeCurrencyGold: true, - tokenName: 'cGLD.L', - transferFn: transferCalldata, - } - } - if (testMode === TestMode.Transfer) { - return { - feeCurrencyGold: true, - tokenName: 'cGLD', - transferFn: transferCeloGold, - } - } - - // randomly choose which token to use - const useGold = Boolean(Math.round(Math.random())) - const _transferFn = useGold ? transferCeloGold : transferCeloDollars - const _tokenName = useGold ? 'cGLD' : 'cUSD' - - // randomly choose which gas currency to use - const _feeCurrencyGold = Boolean(Math.round(Math.random())) - return { - feeCurrencyGold: _feeCurrencyGold, - tokenName: _tokenName, - transferFn: _transferFn, + switch (testMode) { + case TestMode.Data: + return { + feeCurrencyGold: true, + tokenName: 'cGLD.L', + transferFn: transferCalldata, + } + case TestMode.Transfer: + return { + feeCurrencyGold: true, + tokenName: 'cGLD', + transferFn: transferCeloGold, + } + case TestMode.Mixed: + // randomly choose which token to use + const useGold = Boolean(Math.round(Math.random())) + const _transferFn = useGold ? transferCeloGold : transferCeloDollars + const _tokenName = useGold ? 'cGLD' : 'cUSD' + + // randomly choose which gas currency to use + const _feeCurrencyGold = Boolean(Math.round(Math.random())) + return { + feeCurrencyGold: _feeCurrencyGold, + tokenName: _tokenName, + transferFn: _transferFn, + } + case TestMode.ContractCall: + return { + feeCurrencyGold: true, + tokenName: 'contract', // For logging + transferFn: transferCalldata, + } + default: + throw new Error(`Unimplemented TestMode: ${testMode}`) } } From b4583b2825dbbb0a2a43c46d4171fb5abf804790 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 2 Jun 2023 12:56:40 +0200 Subject: [PATCH 151/154] Load test gas size changes --- .../celotool/src/cmds/geth/simulate_client.ts | 17 ++++++++++++++++- packages/celotool/src/lib/geth.ts | 9 +++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/celotool/src/cmds/geth/simulate_client.ts b/packages/celotool/src/cmds/geth/simulate_client.ts index 2cdc45779d9..41d487f1773 100644 --- a/packages/celotool/src/cmds/geth/simulate_client.ts +++ b/packages/celotool/src/cmds/geth/simulate_client.ts @@ -1,6 +1,7 @@ /* tslint:disable no-console */ +import BigNumber from 'bignumber.js' import { AccountType, generateAddress } from 'src/lib/generate_utils' -import { getIndexForLoadTestThread, simulateClient, TestMode } from 'src/lib/geth' +import { TestMode, getIndexForLoadTestThread, simulateClient } from 'src/lib/geth' import * as yargs from 'yargs' export const command = 'simulate-client' @@ -15,6 +16,8 @@ interface SimulateClientArgv extends yargs.Argv { recipientIndex: number clientCount: number reuseClient: boolean + maxGasPrice: number + totalTxGas: number testMode: string } @@ -62,6 +65,16 @@ export const builder = () => { description: 'Use the same client for all the threads/accounts', default: false, }) + .options('max-gas-price', { + type: 'number', + description: 'Max gasPrice to use for transactions', + default: 0, + }) + .options('total-tx-gas', { + type: 'number', + description: 'Gas Target when using data transfers', + default: 500000, + }) .options('test-mode', { type: 'string', description: 'Load test mode: mixed transaction types, big calldatas, or simple transfers', @@ -105,6 +118,8 @@ export const handler = async (argv: SimulateClientArgv) => { argv.index, argv.testMode as TestMode, thread, + new BigNumber(argv.maxGasPrice), + argv.totalTxGas, `http://localhost:${web3ProviderPort}` ) } diff --git a/packages/celotool/src/lib/geth.ts b/packages/celotool/src/lib/geth.ts index c572e5efbfe..3cc2e88f76f 100644 --- a/packages/celotool/src/lib/geth.ts +++ b/packages/celotool/src/lib/geth.ts @@ -19,11 +19,11 @@ import { convertToContractDecimals } from './contract-utils' import { envVar, fetchEnv, isVmBased } from './env-utils' import { AccountType, + Validator, generateGenesis, generateGenesisWithMigrations, generatePrivateKey, privateKeyToPublicKey, - Validator, } from './generate_utils' import { retrieveClusterIPAddress, retrieveIPAddress } from './helm_deploy' import { GethInstanceConfig } from './interfaces/geth-instance-config' @@ -559,6 +559,8 @@ export const simulateClient = async ( index: number, testMode: TestMode, thread: number, + maxGasPrice: BigNumber = new BigNumber(0), + totalTxGas: number = 500000, // aim for half million gas txs web3Provider: string = 'http://localhost:8545' ) => { // Assume the node is accessible via localhost with senderAddress unlocked @@ -631,6 +633,9 @@ export const simulateClient = async ( ) nonce = nonceResult.nonce gasPrice = nonceResult.newPrice + if (maxGasPrice.isGreaterThan(0)) { + gasPrice = BigNumber.min(gasPrice, maxGasPrice) + } lastGasPriceMinimum = gasPrice txOptions = { gasPrice: gasPrice.toString(), @@ -645,7 +650,7 @@ export const simulateClient = async ( }) } const intrinsicGas = 21000 - const totalTxGas = 500000 // aim for half million gas txs + // const totalTxGas = 500000 // aim for half million gas txs const calldataGas = totalTxGas - intrinsicGas const calldataSize = calldataGas / 4 // 119750 < tx pool size limit (128k) const dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs From 97f71d662858c3202f3845a7f94072ffc6924b69 Mon Sep 17 00:00:00 2001 From: Eela Nagaraj Date: Fri, 2 Jun 2023 14:10:11 +0200 Subject: [PATCH 152/154] Zero out transfer value and fix logging --- packages/celotool/src/lib/geth.ts | 40 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/packages/celotool/src/lib/geth.ts b/packages/celotool/src/lib/geth.ts index d718a00cdf8..90c302c7cdd 100644 --- a/packages/celotool/src/lib/geth.ts +++ b/packages/celotool/src/lib/geth.ts @@ -592,6 +592,23 @@ export const simulateClient = async ( console.info(`Sleeping for ${randomSleep} ms`) await sleep(randomSleep) + const intrinsicGas = 21000 + const totalTxGas = 500000 // aim for half million gas txs + const calldataGas = totalTxGas - intrinsicGas + const calldataSize = calldataGas / 4 // 119750 < tx pool size limit (128k) + let dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs + // Also running below the 128kb limit from the tx pool + let transferAmount = LOAD_TEST_TRANSFER_WEI + + if (testMode === TestMode.ContractCall) { + if (!contractData || !contractAddress) { + throw new Error('Contract address and data must be provided for TestMode.ContractCall') + } + dataStr = contractData + recipientAddressFinal = contractAddress + transferAmount = new BigNumber(0) + } + const baseLogMessage: any = { loadTestID: index, threadID: thread, @@ -647,30 +664,9 @@ export const simulateClient = async ( ...baseLogMessage, }) } - const intrinsicGas = 21000 - const totalTxGas = 500000 // aim for half million gas txs - const calldataGas = totalTxGas - intrinsicGas - const calldataSize = calldataGas / 4 // 119750 < tx pool size limit (128k) - let dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs - // Also running below the 128kb limit from the tx pool - - if (testMode === TestMode.ContractCall) { - if (!contractData || !contractAddress) { - throw new Error('Contract address and data must be provided for TestMode.ContractCall') - } - dataStr = contractData - recipientAddressFinal = contractAddress - } await txConf - .transferFn( - kit, - senderAddress, - recipientAddressFinal, - LOAD_TEST_TRANSFER_WEI, - dataStr, - txOptions - ) + .transferFn(kit, senderAddress, recipientAddressFinal, transferAmount, dataStr, txOptions) .then(async (txResult: TransactionResult) => { lastTx = await txResult.getHash() lastNonce = (await kit.web3.eth.getTransaction(lastTx)).nonce From f9398559ded1e0c4b1fc536aca9b3ef169a92525 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Mon, 5 Jun 2023 09:02:20 +0200 Subject: [PATCH 153/154] Added gasPrice limit and gasSize parameters --- packages/celotool/src/lib/geth.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/celotool/src/lib/geth.ts b/packages/celotool/src/lib/geth.ts index 424aa58ff49..aba42cf1256 100644 --- a/packages/celotool/src/lib/geth.ts +++ b/packages/celotool/src/lib/geth.ts @@ -595,7 +595,7 @@ export const simulateClient = async ( await sleep(randomSleep) const intrinsicGas = 21000 - const totalTxGas = 500000 // aim for half million gas txs + // const totalTxGas = 500000 // aim for half million gas txs const calldataGas = totalTxGas - intrinsicGas const calldataSize = calldataGas / 4 // 119750 < tx pool size limit (128k) let dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs @@ -669,12 +669,6 @@ export const simulateClient = async ( ...baseLogMessage, }) } - const intrinsicGas = 21000 - // const totalTxGas = 500000 // aim for half million gas txs - const calldataGas = totalTxGas - intrinsicGas - const calldataSize = calldataGas / 4 // 119750 < tx pool size limit (128k) - let dataStr = testMode === TestMode.Data ? getBigData(calldataSize) : undefined // aim for half million gas txs - // Also running below the 128kb limit from the tx pool if (testMode === TestMode.ContractCall) { if (!contractData || !contractAddress) { From db0790001784c5efd69ffc23c4431e8fd79795bd Mon Sep 17 00:00:00 2001 From: Eela Nagaraj Date: Wed, 7 Jun 2023 17:59:43 +0200 Subject: [PATCH 154/154] Reduce base threads and refactor signing and unlocking --- .../celotool/src/cmds/geth/simulate_client.ts | 19 ++++-- packages/celotool/src/lib/geth.ts | 64 ++++++++----------- 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/packages/celotool/src/cmds/geth/simulate_client.ts b/packages/celotool/src/cmds/geth/simulate_client.ts index 31fb59d0b08..5d25070bd34 100644 --- a/packages/celotool/src/cmds/geth/simulate_client.ts +++ b/packages/celotool/src/cmds/geth/simulate_client.ts @@ -1,6 +1,11 @@ /* tslint:disable no-console */ -import { AccountType, generateAddress } from 'src/lib/generate_utils' -import { TestMode, getIndexForLoadTestThread, simulateClient } from 'src/lib/geth' +import { AccountType, generateAddress, generatePrivateKey } from 'src/lib/generate_utils' +import { + MAX_LOADTEST_THREAD_COUNT, + TestMode, + getIndexForLoadTestThread, + simulateClient, +} from 'src/lib/geth' import * as yargs from 'yargs' export const command = 'simulate-client' @@ -66,9 +71,10 @@ export const builder = () => { }) .options('client-count', { type: 'number', - description: 'Number of clients to simulate', + description: `Number of clients to simulate, must not exceed ${MAX_LOADTEST_THREAD_COUNT}`, default: 1, }) + .check((argv) => argv['client-count'] <= MAX_LOADTEST_THREAD_COUNT) .options('reuse-client', { type: 'boolean', description: 'Use the same client for all the threads/accounts', @@ -87,7 +93,7 @@ export const handler = async (argv: SimulateClientArgv) => { for (let thread = 0; thread < argv.clientCount; thread++) { const senderIndex = getIndexForLoadTestThread(argv.index, thread) const recipientIndex = getIndexForLoadTestThread(argv.recipientIndex, thread) - const senderAddress = generateAddress( + const senderPK = generatePrivateKey( argv.mnemonic, AccountType.LOAD_TESTING_ACCOUNT, senderIndex @@ -101,16 +107,15 @@ export const handler = async (argv: SimulateClientArgv) => { const web3ProviderPort = argv.reuseClient ? 8545 : 8545 + thread console.log( - `Account for sender index ${argv.index} thread ${thread}, final index ${senderIndex}: ${senderAddress}` + `PK for sender index ${argv.index} thread ${thread}, final index ${senderIndex}: ${senderPK}` ) console.log( `Account for recipient index ${argv.recipientIndex} thread ${thread}, final index ${recipientIndex}: ${recipientAddress}` ) console.log(`web3ProviderPort for thread ${thread}: ${web3ProviderPort}`) - // tslint:disable-next-line: no-floating-promises simulateClient( - senderAddress, + senderPK, recipientAddress, argv.contractAddress, argv.contractData, diff --git a/packages/celotool/src/lib/geth.ts b/packages/celotool/src/lib/geth.ts index 90c302c7cdd..cb41b222031 100644 --- a/packages/celotool/src/lib/geth.ts +++ b/packages/celotool/src/lib/geth.ts @@ -23,6 +23,7 @@ import { generateGenesis, generateGenesisWithMigrations, generatePrivateKey, + privateKeyToAddress, privateKeyToPublicKey, } from './generate_utils' import { retrieveClusterIPAddress, retrieveIPAddress } from './helm_deploy' @@ -78,6 +79,7 @@ export const LOG_TAG_TRANSACTION_VALIDATION_ERROR = 'validate_transaction_error' // for log messages which show time needed to receive the receipt after // the transaction has been sent export const LOG_TAG_TX_TIME_MEASUREMENT = 'tx_time_measurement' +export const MAX_LOADTEST_THREAD_COUNT = 100 export const getEnodeAddress = (nodeId: string, ipAddress: string, port: number) => { return `enode://${nodeId}@${ipAddress}:${port}` @@ -552,7 +554,7 @@ export enum TestMode { } export const simulateClient = async ( - senderAddress: string, + senderPK: string, recipientAddress: string, contractAddress: string, contractData: string, @@ -566,13 +568,11 @@ export const simulateClient = async ( ) => { // Assume the node is accessible via localhost with senderAddress unlocked const kit = newKitFromWeb3(new Web3(web3Provider)) - const password = fetchEnv('PASSWORD') let lastNonce: number = -1 let lastTx: string = '' let lastGasPriceMinimum: BigNumber = new BigNumber(0) let nonce: number = 0 - let unlockNeeded: boolean = true let recipientAddressFinal: string = recipientAddress const useRandomRecipient = fetchEnv(envVar.LOAD_TEST_USE_RANDOM_RECIPIENT) @@ -583,7 +583,8 @@ export const simulateClient = async ( ) await sleep(sleepTime) } - kit.defaultAccount = senderAddress + kit.addAccount(senderPK) + kit.defaultAccount = privateKeyToAddress(senderPK) // sleep a random amount of time in the range [0, txPeriodMs) before starting so // that if multiple simulations are started at the same time, they don't all @@ -612,7 +613,7 @@ export const simulateClient = async ( const baseLogMessage: any = { loadTestID: index, threadID: thread, - sender: senderAddress, + sender: kit.defaultAccount, recipient: recipientAddressFinal, feeCurrency: '', txHash: '', @@ -620,10 +621,6 @@ export const simulateClient = async ( while (true) { const sendTransactionTime = Date.now() - if (unlockNeeded) { - await unlock(kit, kit.defaultAccount, password, 9223372036) - unlockNeeded = false - } const txConf = await getTxConf(testMode) baseLogMessage.tokenName = txConf.tokenName @@ -666,13 +663,20 @@ export const simulateClient = async ( } await txConf - .transferFn(kit, senderAddress, recipientAddressFinal, transferAmount, dataStr, txOptions) + .transferFn( + kit, + kit.defaultAccount, + recipientAddressFinal, + transferAmount, + dataStr, + txOptions + ) .then(async (txResult: TransactionResult) => { lastTx = await txResult.getHash() lastNonce = (await kit.web3.eth.getTransaction(lastTx)).nonce await onLoadTestTxResult( kit, - senderAddress, + kit.defaultAccount!, txResult, sendTransactionTime, baseLogMessage, @@ -681,9 +685,12 @@ export const simulateClient = async ( ) }) .catch((error: any) => { - if (catchNeedUnlock(error, baseLogMessage)) { - unlockNeeded = true - } + console.error('Load test transaction failed with error:', error) + tracerLog({ + tag: LOG_TAG_TRANSACTION_ERROR, + error: error.toString(), + ...baseLogMessage, + }) }) if (sendTransactionTime + txPeriodMs > Date.now()) { await sleep(sendTransactionTime + txPeriodMs - Date.now()) @@ -760,27 +767,6 @@ const getNonce = async ( } } -// Catch errors from the transfer Fn, and returns if an account unlock -// is needed. -const catchNeedUnlock = (error: any, baseLogMessage: any) => { - let unlockNeeded = false - if ( - typeof error === 'string' && - error.includes('Error: authentication needed: password or unlock') - ) { - console.warn('Load test transaction failed with locked account:', error) - unlockNeeded = true - } else { - console.error('Load test transaction failed with error:', error) - tracerLog({ - tag: LOG_TAG_TRANSACTION_ERROR, - error: error.toString(), - ...baseLogMessage, - }) - } - return unlockNeeded -} - const getFeeCurrency = async (kit: ContractKit, feeCurrencyGold: boolean, baseLogMessage: any) => { try { return feeCurrencyGold ? '' : await kit.registry.addressFor(CeloContract.StableToken) @@ -860,9 +846,11 @@ export const onLoadTestTxResult = async ( * @param thread the thread number inside the pod */ export function getIndexForLoadTestThread(pod: number, thread: number) { - // max number of threads to avoid overlap is [0, base) - const base = 10000 - return pod * base + thread + if (thread > MAX_LOADTEST_THREAD_COUNT) { + throw new Error(`thread count must be smaller than ${MAX_LOADTEST_THREAD_COUNT}`) + } + // max number of threads to avoid overlap is [0, MAX_LOADTEST_THREAD_COUNT) + return pod * MAX_LOADTEST_THREAD_COUNT + thread } /**