version: 2.1 parameters: run_flaky_tests: type: boolean default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 jobs: build: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project steps: - run: sudo apt update && sudo apt install zstd - checkout - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn - save_cache: key: v1-deps-{{ checksum "yarn.lock" }} paths: - node_modules - run: name: Build command: | if [ "${CIRCLE_BRANCH}" == "master" ]; then NX_BIN_URL=http://127.0.0.1:8080/assets/js/soljson NX_WASM_URL=http://127.0.0.1:8080/assets/js/soljson NX_NPM_URL=http://127.0.0.1:9090/ yarn build:production else NX_BIN_URL=http://127.0.0.1:8080/assets/js/soljson NX_WASM_URL=http://127.0.0.1:8080/assets/js/soljson NX_NPM_URL=http://127.0.0.1:9090/ yarn build fi - run: yarn run build:e2e - run: grep -ir "[0-9]+commit" apps/* libs/* --include \*.ts --include \*.tsx --include \*.json > soljson-versions.txt - restore_cache: keys: - soljson-v7-{{ checksum "soljson-versions.txt" }} - run: yarn run downloadsolc_assets_e2e - save_cache: key: soljson-v7-{{ checksum "soljson-versions.txt" }} paths: - dist/apps/remix-ide/assets/js/soljson - run: mkdir persist && tar -cf - dist | zstd -1 -o persist/dist.tar.zst - persist_to_workspace: root: . paths: - "persist" build-desktop: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project steps: - checkout - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn - save_cache: key: v1-deps-{{ checksum "yarn.lock" }} paths: - node_modules - run: name: Build command: | yarn build:desktop - run: mkdir persist && zip -0 -r persist/desktopbuild.zip dist/apps/remix-ide - persist_to_workspace: root: . paths: - "persist" build-plugin: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project parameters: plugin: type: string steps: - checkout - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn - save_cache: key: v1-deps-{{ checksum "yarn.lock" }} paths: - node_modules - run: yarn nx build << parameters.plugin >> --configuration=production - run: mkdir persist && zip -0 -r persist/plugin-<< parameters.plugin >>.zip dist - persist_to_workspace: root: . paths: - "persist" test-remixdesktop-linux: machine: image: ubuntu-2004:current resource_class: xlarge working_directory: ~/remix-project parallelism: 15 steps: - run: ldd --version - checkout - attach_workspace: at: . - run: unzip ./persist/desktopbuild.zip - run: command: | nvm install 20.2 nvm use 20.2 node -v npm install --global yarn node-gyp python -m pip install --upgrade pip pip install setuptools mkdir apps/remixdesktop/build cp -r dist/apps/remix-ide apps/remixdesktop/build cd apps/remixdesktop/ yarn add node-pty yarn --ignore-optional yarn add @remix-project/remix-ws-templates ./rundist.bash test_only - run: name: "Run tests" command: | nvm use 20.2 cd apps/remixdesktop/ ./run_ci_test.sh - run: name: "Run isogit tests" command: | nvm use 20.2 cd apps/remixdesktop/ ./run_git_ui_isogit_tests.sh - store_test_results: path: ./apps/remixdesktop/reports/tests - store_artifacts: path: ./apps/remixdesktop/reports/screenshots build-remixdesktop-linux: machine: image: ubuntu-2004:current resource_class: xlarge working_directory: ~/remix-project steps: - run: ldd --version - checkout - attach_workspace: at: . - run: unzip ./persist/desktopbuild.zip - run: command: | nvm install 20.2 nvm use 20.2 node -v npm install --global yarn node-gyp python -m pip install --upgrade pip pip install setuptools mkdir apps/remixdesktop/build cp -r dist/apps/remix-ide apps/remixdesktop/build cd apps/remixdesktop/ yarn add node-pty yarn --ignore-optional yarn add @remix-project/remix-ws-templates ./rundist.bash rm -rf release/*-unpacked - save_cache: key: remixdesktop-linux-deps-{{ checksum "apps/remixdesktop/yarn.lock" }} paths: - apps/remixdesktop/node_modules - run: name: "remove unnecessary files" command: | rm -rf ~/remix-project/apps/remixdesktop/release/.icon* rm -rf ~/remix-project/apps/remixdesktop/release/builder* - store_artifacts: path: apps/remixdesktop/release/ destination: remixdesktop-linux - persist_to_workspace: root: apps/remixdesktop paths: - "release" build-remixdesktop-windows: executor: name: win/default # executor type size: xlarge # can be medium, large, xlarge, 2xlarge shell: bash.exe working_directory: ~/remix-project steps: - checkout - attach_workspace: at: . - run: unzip ./persist/desktopbuild.zip - run: command: | nvm install 20.2 nvm use 20.2 node -v npx -v npm install --global yarn npm install --global node-gyp yarn -v - run: command: | mkdir apps/remixdesktop/build cp -r dist/apps/remix-ide apps/remixdesktop/build cd apps/remixdesktop/ python -m pip install --upgrade pip pip install setuptools yarn ./rundist.bash rm -rf release/*-unpacked - persist_to_workspace: root: apps/remixdesktop paths: - "release" test-remixdesktop-windows: executor: name: win/default # executor type size: xlarge # can be medium, large, xlarge, 2xlarge shell: bash.exe parallelism: 10 working_directory: ~/remix-project steps: - run: name: Restart local mstsc command: psexec64.exe -accepteula -nobanner -i 0 mstsc /v:localhost /w:2560 /h:1140 background: true shell: powershell.exe - run: name: Naive impl to wait until the screen stretches command: Start-Sleep 5 shell: powershell.exe - run: name: Get screen info command: | Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Screen]::AllScreens | fl * shell: powershell.exe - checkout - attach_workspace: at: . - run: unzip ./persist/desktopbuild.zip - run: command: | nvm install 20.2 nvm use 20.2 node -v npx -v npm install --global yarn npm install --global node-gyp yarn -v - run: name: start selenium command: | cd "apps/remixdesktop/" yarn -v shell: powershell.exe - run: command: | mkdir apps/remixdesktop/build cp -r dist/apps/remix-ide apps/remixdesktop/build cd apps/remixdesktop/ nvm use 20.2 node -v python -m pip install --upgrade pip pip install setuptools yarn ./rundist.bash - run: name: run tests command: | cd "apps/remixdesktop/" yarn -v sleep 15 ./run_ci_test.sh - run: name: "Run isogit tests" command: | cd apps/remixdesktop/ yarn -v sleep 15 ./run_git_ui_isogit_tests.sh - store_test_results: path: ./apps/remixdesktop/reports/tests - store_artifacts: path: ./apps/remixdesktop/reports/screenshots # see https://docs.digicert.com/en/software-trust-manager/ci-cd-integrations/script-integrations/github-integration-ksp.html sign-remixdesktop-windows: executor: win/default # executor type working_directory: ~/remix-project steps: - checkout - attach_workspace: at: . - run: name: "Certificate-Setup" shell: powershell.exe command: | cd C:\ New-Item C:\CERT_FILE.p12.b64 Set-Content -Path C:\CERT_FILE.p12.b64 -Value $env:SM_CLIENT_CERT_FILE_B64 certutil -decode CERT_FILE.p12.b64 Certificate_pkcs12.p12 cat Certificate_pkcs12.p12 - restore_cache: name: Restore smtools-windows-x64.msi keys: - dl-smtools-windows-x64.msi - run: name: "Client-Tool-Download" shell: powershell.exe command: | cd C:\ if (Test-Path 'c:\smtools-windows-x64.msi') { echo 'File exists, skipping download...' } else { echo 'Downloading smtools-windows-x64.msi ...' curl.exe -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:$env:SM_API_KEY" -o smtools-windows-x64.msi } - save_cache: key: dl-smtools-windows-x64.msi paths: - c:\smtools-windows-x64.msi - run: name: "Client-Tool-Setup" shell: powershell.exe command: | cd C:\ msiexec.exe /i smtools-windows-x64.msi /quiet /qn | Wait-Process & $env:SSM\smksp_cert_sync.exe & $env:SSM\smctl.exe healthcheck - run: name: "Find Signtool" shell: powershell.exe command: | Get-ChildItem -Path 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit' -Filter signtool.exe -Recurse - run: name: read env shell: powershell.exe command: | # Specify the path to your package.json file $packageJsonPath = "C:\Users\circleci\remix-project\apps\remixdesktop\package.json" # Check if the file exists if (Test-Path $packageJsonPath) { # Read the content of the package.json file $packageJsonContent = Get-Content $packageJsonPath -Raw | ConvertFrom-Json # Check if the 'version' field exists in the package.json if ($packageJsonContent.'version' -ne $null) { # Store the version value in an environment variable $version = $packageJsonContent.version $file = "C:\Users\circleci\remix-project\release\Remix-Desktop-Setup-$($version).exe" Write-Host "Version $(file) stored in PACKAGE_VERSION environment variable." "Set-Variable -Name 'PACKAGE_VERSION' -Value '$file' -Scope Global" > SetEnvVars.ps1 dir Env: } else { Write-Host "Error: 'version' field not found in package.json." } } else { Write-Host "Error: package.json file not found at $packageJsonPath." } - run: name: "Signtool-Signing" shell: powershell.exe command: | . .\SetEnvVars.ps1 dir Env: & $env:Signtool sign /sha1 $env:SM_CODE_SIGNING_CERT_SHA1_HASH /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $PACKAGE_VERSION - run: name: "Signtool-Verification" shell: powershell.exe command: | . .\SetEnvVars.ps1 $verify_output = $(& $env:Signtool verify /v /pa $PACKAGE_VERSION) echo ${verify_output} if (!$verify_output.Contains("Number of files successfully Verified: 1")) { echo 'Verification failed' exit 1 } - run: name: "remove unnecessary files" shell: bash.exe command: | rm -rf ~/remix-project/release/.icon* rm -rf ~/remix-project/release/builder* - store_artifacts: path: ~/remix-project/release/ destination: remixdesktop-windows - persist_to_workspace: root: ~/remix-project/ paths: - "release" environment: SM_CLIENT_CERT_FILE: 'C:\Certificate_pkcs12.p12' Signtool: 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\signtool.exe' SSM: 'C:\Program Files\DigiCert\DigiCert One Signing Manager Tools' build-remixdesktop-mac: macos: xcode: 14.2.0 resource_class: macos.m1.large.gen1 working_directory: ~/remix-project parameters: arch: type: string steps: - checkout - attach_workspace: at: . - run: name: Install Apple Certificate command: | echo $APPLE_CERTIFICATE_BASE64 | base64 --decode > /tmp/certificate.p12 security create-keychain -p ci-password build.keychain security default-keychain -s build.keychain security unlock-keychain -p ci-password build.keychain curl -o DeveloperIDG2CA.cer "https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer" sudo security import DeveloperIDG2CA.cer -k /Library/Keychains/System.keychain -T /usr/bin/codesign sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain DeveloperIDG2CA.cer security import /tmp/certificate.p12 -k build.keychain -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign security set-key-partition-list -S apple-tool:,apple: -s -k ci-password build.keychain security find-identity -v -p codesigning - run: unzip ./persist/desktopbuild.zip - run: command: | ls -la dist/apps/remix-ide nvm install 20.2 nvm use 20.2 - restore_cache: keys: - remixdesktop-deps-mac-{{ checksum "apps/remixdesktop/yarn.lock" }} - run: command: | nvm use 20.2 cd apps/remixdesktop yarn || yarn find ./node_modules yarn add @remix-project/remix-ws-templates - save_cache: key: remixdesktop-deps-mac-{{ checksum "apps/remixdesktop/yarn.lock" }} paths: - apps/remixdesktop/node_modules # use USE_HARD_LINK=false https://github.com/electron-userland/electron-builder/issues/3179 - run: command: | nvm use 20.2 mkdir apps/remixdesktop/build cp -r dist/apps/remix-ide apps/remixdesktop/build cd apps/remixdesktop yarn - run: command: | nvm use 20.2 cd apps/remixdesktop yarn installRipGrepMacOX<< parameters.arch >> PUBLISH_FOR_PULL_REQUEST='false' USE_HARD_LINKS=false ./rundist.bash --<< parameters.arch >> if [ -f release/latest-mac.yml ]; then cat release/latest-mac.yml mv release/latest-mac.yml release/latest-mac-<< parameters.arch >>.yml fi find build - run: name: Notarize the app command: | brew install jq cd apps/remixdesktop zsh notarizedmg.sh - run: name: "remove unnecessary files" command: | rm -rf ~/remix-project/apps/remixdesktop/release/.icon* rm -rf ~/remix-project/apps/remixdesktop/release/builder* rm -rf ~/remix-project/apps/remixdesktop/release/*.blockmap rm -rf ~/remix-project/apps/remixdesktop/release/_.* - store_artifacts: path: apps/remixdesktop/release/ destination: remixdesktop-mac - persist_to_workspace: root: apps/remixdesktop paths: - "release" test-remixdesktop-mac: macos: xcode: 14.2.0 resource_class: macos.m1.large.gen1 working_directory: ~/remix-project parallelism: 10 steps: - checkout - attach_workspace: at: . - run: unzip ./persist/desktopbuild.zip - run: command: | ls -la dist/apps/remix-ide nvm install 20.2 nvm use 20.2 - restore_cache: keys: - remixdesktop-deps-mac-{{ checksum "apps/remixdesktop/yarn.lock" }} - run: command: | nvm use 20.2 cd apps/remixdesktop yarn || yarn yarn add @remix-project/remix-ws-templates - save_cache: key: remixdesktop-deps-mac-{{ checksum "apps/remixdesktop/yarn.lock" }} paths: - apps/remixdesktop/node_modules - run: command: | nvm use 20.2 mkdir apps/remixdesktop/build cp -r dist/apps/remix-ide apps/remixdesktop/build cd apps/remixdesktop yarn - run: command: | nvm use 20.2 cd apps/remixdesktop yarn installRipGrepMacOXarm64 PUBLISH_FOR_PULL_REQUEST='false' DO_NOT_NOTARIZE='true' USE_HARD_LINKS=false ./rundist.bash --arm64 find build - run: name: "Run tests" command: | nvm use 20.2 cd apps/remixdesktop ./run_ci_test.sh - run: name: "Run isogit tests" command: | nvm use 20.2 cd apps/remixdesktop ./run_git_ui_isogit_tests.sh - store_test_results: path: ./apps/remixdesktop/reports/tests - store_artifacts: path: ./apps/remixdesktop/reports/screenshots uploadartifacts: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project steps: - checkout - attach_workspace: at: . - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn - run: name: "Upload Artifacts" command: npx ts-node apps/remix-ide/ci/update_desktop_release_assets.ts lint: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project steps: - checkout - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn - run: yarn nx graph --file=./projects.json - run: name: Remix Libs Linting command: node ./apps/remix-ide/ci/lint-targets.js remix-libs: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project steps: - checkout - attach_workspace: at: . - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn --version - run: yarn - run: yarn build:libs - run: cd dist/libs/remix-tests && yarn - run: cd dist/libs/remix-tests && yarn add @remix-project/remix-url-resolver ../../libs/remix-url-resolver - run: cd dist/libs/remix-tests && yarn add @remix-project/remix-lib ../../libs/remix-lib - run: cd dist/libs/remix-tests && yarn add @remix-project/remix-solidity ../../libs/remix-solidity - run: cd dist/libs/remix-tests && yarn add @remix-project/remix-simulator ../../libs/remix-simulator - run: cd dist/libs/remix-tests && ./bin/remix-tests ./../../../libs/remix-tests/tests/examples_0/assert_ok_test.sol - run: node dist/libs/remix-tests/bin/remix-tests ./libs/remix-tests/tests/examples_0/assert_ok_test.sol - run: yarn run test:libs remix-ide-browser: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project parameters: browser: type: string script: type: string job: type: string jobsize: type: string parallelism: << parameters.parallelism >> steps: - checkout - attach_workspace: at: . - run: sudo apt update && sudo apt install python3-pip -y zstd - run: zstd -d persist/dist.tar.zst -o persist/dist.tar - run: tar -xf persist/dist.tar - run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules || yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules - run: mkdir node_modules/hardhat && wget https://unpkg.com/hardhat/console.sol -O node_modules/hardhat/console.sol - run: ls -la ./dist/apps/remix-ide/assets/js - when: condition: equal: [ "chrome", << parameters.browser >> ] steps: - browser-tools/install-browser-tools: install-firefox: false install-chrome: true install-chromedriver: false install-geckodriver: false - run: yarn install_webdriver - run: google-chrome --version - when: condition: equal: [ "firefox", << parameters.browser >> ] steps: - browser-tools/install-browser-tools: install-firefox: true install-chrome: false install-geckodriver: false install-chromedriver: false - run: yarn install_webdriver - run: firefox --version - run: ./apps/remix-ide/ci/<< parameters.script >> << parameters.browser >> << parameters.jobsize >> << parameters.job >> - store_test_results: path: ./reports/tests - store_artifacts: path: ./reports/screenshots tests-passed: machine: image: default steps: - run: echo done remix-test-plugins: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project parameters: plugin: type: string parallelism: type: integer default: 1 parallelism: << parameters.parallelism >> steps: - checkout - attach_workspace: at: . - run: sudo apt update && sudo apt install zstd - run: zstd -d persist/dist.tar.zst -o persist/dist.tar - run: tar -xf persist/dist.tar - run: unzip ./persist/plugin-<< parameters.plugin >>.zip - run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules || yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules - browser-tools/install-browser-tools: install-firefox: false install-chrome: true install-geckodriver: false install-chromedriver: false - run: yarn install_webdriver - run: google-chrome --version - run: ./apps/remix-ide/ci/browser_test_plugin.sh << parameters.plugin >> - store_test_results: path: ./reports/tests - store_artifacts: path: ./reports/screenshots predeploy: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge working_directory: ~/remix-project steps: - checkout - restore_cache: keys: - v1-deps-{{ checksum "yarn.lock" }} - run: yarn - save_cache: key: v1-deps-{{ checksum "yarn.lock" }} paths: - node_modules - run: yarn build:production - run: mkdir persist && zip -0 -r persist/predeploy.zip dist - persist_to_workspace: root: . paths: - "persist" deploy-build: docker: - image: cimg/node:20.0.0-browsers resource_class: xlarge environment: COMMIT_AUTHOR_EMAIL: "yann@ethereum.org" COMMIT_AUTHOR: "Circle CI" working_directory: ~/remix-project parameters: script: type: string steps: - checkout - attach_workspace: at: . - run: unzip ./persist/predeploy.zip - run: ./apps/remix-ide/ci/deploy_from_travis_remix-<< parameters.script >>.sh workflows: run_flaky_tests: when: << pipeline.parameters.run_flaky_tests >> jobs: - build - remix-ide-browser: requires: - build matrix: parameters: browser: ["chrome", "firefox"] script: ["flaky.sh"] job: ["nogroup"] jobsize: ["1"] parallelism: 10 run_flaky_tests: jobs: - build - remix-ide-browser: requires: - build matrix: parameters: browser: ["chrome"] script: ["metamask.sh"] job: ["nogroup"] jobsize: ["1"] parallelism: 1 build_all: unless: << pipeline.parameters.run_flaky_tests >> jobs: - build - build-desktop - build-remixdesktop-mac: requires: - build-desktop matrix: parameters: arch: ["arm64", "x64"] filters: branches: only: [/.*desktop.*/] - test-remixdesktop-mac: requires: - build-desktop filters: branches: only: [/.*desktop.*/] - build-remixdesktop-windows: requires: - build-desktop filters: branches: only: [/.*desktop.*/] - sign-remixdesktop-windows: requires: - build-remixdesktop-windows - build-remixdesktop-linux: requires: - build-desktop filters: branches: only: [/.*desktop.*/] - test-remixdesktop-linux: requires: - build-desktop - test-remixdesktop-windows: requires: - build-desktop filters: branches: only: [/.*desktop.*/] - uploadartifacts: requires: - build-remixdesktop-mac - build-remixdesktop-linux - sign-remixdesktop-windows - test-remixdesktop-windows - test-remixdesktop-linux - test-remixdesktop-mac filters: branches: only: [/.*desktop-master.*/] - build-plugin: matrix: parameters: plugin: ["plugin_api"] - lint: requires: - build - remix-libs - remix-test-plugins: name: test-plugin-<< matrix.plugin >> requires: - build - build-plugin matrix: alias: plugins parameters: plugin: ["plugin_api"] parallelism: [1, 9] exclude: - plugin: plugin_api parallelism: 1 - remix-ide-browser: requires: - build matrix: parameters: browser: ["chrome", "firefox"] script: ["browser_test.sh"] job: ["0","1","2","3","4","5","6","7","8","9"] jobsize: ["10"] parallelism: 15 - tests-passed: requires: - lint - remix-libs - remix-ide-browser - plugins - predeploy: filters: branches: only: ['master', 'remix_live', 'remix_beta'] - deploy-build: script: "live" name: "deploy-live" requires: - lint - remix-libs - remix-ide-browser - plugins - predeploy filters: branches: only: remix_live - deploy-build: script: "alpha" name: "deploy-alpha" requires: - lint - remix-libs - remix-ide-browser - plugins - predeploy filters: branches: only: master - deploy-build: script: "beta" name: "deploy-beta" requires: - lint - remix-libs - remix-ide-browser - plugins - predeploy filters: branches: only: remix_beta # VS Code Extension Version: 1.5.1