From 0888c05098c94151462e30528a32322ae793d9ac Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 13 Dec 2023 13:06:18 +0000 Subject: [PATCH] chore(ci): combine deploy / release jobs + canary update (#3610) - Combine all release / deploy jobs into 1 to simplify CI - Add canary flow that tests NPM releases are working before tagging them as `latest` - remove old canary code - add `DRY_DEPLOY` functionality to terraform script (`terraform plan`) Closes #3563 Closes #3579 --- .circleci/config.yml | 82 +++++-------------- build-system/scripts/deploy_npm | 28 +++++-- build-system/scripts/deploy_terraform | 6 +- build_manifest.yml | 13 --- .../token_portal/typescript_glue_code.md | 4 +- .../tutorials/uniswap/typescript_glue_code.md | 2 +- yarn-project/canary/.eslintrc.cjs | 1 - yarn-project/canary/.gitignore | 1 - yarn-project/canary/Dockerfile | 37 --------- yarn-project/canary/Dockerfile.build | 9 -- yarn-project/canary/README.md | 15 ---- .../canary/jest.integration.config.json | 13 --- yarn-project/canary/package.json | 50 ----------- .../canary/scripts/docker-compose-browser.yml | 9 -- .../canary/scripts/docker-compose.yml | 9 -- .../canary/scripts/extract_packages.sh | 11 --- yarn-project/canary/scripts/run_tests | 27 ------ .../canary/scripts/update_packages.sh | 24 ------ .../canary/src/aztec_js_browser.test.ts | 25 ------ yarn-project/canary/src/cli.test.ts | 14 ---- .../src/uniswap_trade_on_l1_from_l2.test.ts | 36 -------- yarn-project/canary/src/web/index.html | 10 --- yarn-project/canary/tsconfig.json | 42 ---------- yarn-project/deploy_npm.sh | 12 ++- .../end-to-end/scripts/setup_canary.sh | 62 -------------- .../src/uniswap_trade_on_l1_from_l2.test.ts | 2 + yarn-project/package.json | 3 +- yarn-project/tsconfig.json | 1 - yarn-project/yarn.lock | 43 +--------- 29 files changed, 63 insertions(+), 528 deletions(-) delete mode 100644 yarn-project/canary/.eslintrc.cjs delete mode 100644 yarn-project/canary/.gitignore delete mode 100644 yarn-project/canary/Dockerfile delete mode 100644 yarn-project/canary/Dockerfile.build delete mode 100644 yarn-project/canary/README.md delete mode 100644 yarn-project/canary/jest.integration.config.json delete mode 100644 yarn-project/canary/package.json delete mode 100644 yarn-project/canary/scripts/docker-compose-browser.yml delete mode 100644 yarn-project/canary/scripts/docker-compose.yml delete mode 100755 yarn-project/canary/scripts/extract_packages.sh delete mode 100755 yarn-project/canary/scripts/run_tests delete mode 100755 yarn-project/canary/scripts/update_packages.sh delete mode 100644 yarn-project/canary/src/aztec_js_browser.test.ts delete mode 100644 yarn-project/canary/src/cli.test.ts delete mode 100644 yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts delete mode 100644 yarn-project/canary/src/web/index.html delete mode 100644 yarn-project/canary/tsconfig.json delete mode 100755 yarn-project/end-to-end/scripts/setup_canary.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index fb0ea6e4b9a..6580d59be53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -904,8 +904,8 @@ jobs: name: "Assemble benchmark summary from uploaded logs" command: ./scripts/ci/assemble_e2e_benchmark.sh - # Release jobs. - release-npm: + # Deploy & release jobs. + deploy-and-release: machine: image: ubuntu-2204:2023.07.2 resource_class: medium @@ -913,68 +913,45 @@ jobs: - *checkout - *setup_env - run: - name: "yarn-project" + name: "Release to dockerhub" + command: | + should_release || exit 0 + deploy_dockerhub noir + deploy_dockerhub aztec-sandbox + deploy_dockerhub cli + deploy_dockerhub aztec-faucet + deploy_dockerhub mainnet-fork + - run: + name: "Release canary to NPM: yarn-project" + command: | + should_release || exit 0 + yarn-project/deploy_npm.sh canary + - run: + name: "Release latest to NPM: yarn-project" command: | should_release || exit 0 yarn-project/deploy_npm.sh latest - run: - name: "l1-contracts" + name: "Release canary to NPM: l1-contracts" command: | should_release || exit 0 - deploy_npm l1-contracts - - release-dockerhub: - machine: - image: ubuntu-2204:2023.07.2 - resource_class: medium - steps: - - *checkout - - *setup_env + deploy_npm l1-contracts canary - run: - name: "Release to dockerhub" + name: "Release latest to NPM: l1-contracts" command: | should_release || exit 0 - deploy_dockerhub noir - deploy_dockerhub aztec-sandbox - deploy_dockerhub cli - deploy_dockerhub aztec-faucet - deploy_dockerhub mainnet-fork - - # Deploy jobs. - deploy-mainnet-fork: - machine: - image: ubuntu-2204:2023.07.2 - resource_class: medium - steps: - - *checkout - - *setup_env + deploy_npm l1-contracts latest - run: name: "Deploy mainnet fork" command: | should_deploy || exit 0 deploy mainnet-fork - - deploy-contracts: - machine: - image: ubuntu-2204:2023.07.2 - resource_class: medium - steps: - - *checkout - - *setup_env - run: name: "Deploy L1 contracts to mainnet fork" working_directory: l1-contracts command: | should_deploy || exit 0 ./scripts/ci_deploy_contracts.sh - - deploy-devnet: - machine: - image: ubuntu-2204:2023.07.2 - resource_class: medium - steps: - - *checkout - - *setup_env - run: name: "Deploy devnet to AWS" command: | @@ -1213,19 +1190,4 @@ workflows: <<: *defaults # Production releases. - - release-dockerhub: *defaults_deploy - - release-npm: *defaults_deploy - - # Production deployment. - - deploy-mainnet-fork: - requires: - - release-dockerhub - <<: *defaults_deploy - - deploy-contracts: - requires: - - deploy-mainnet-fork - <<: *defaults_deploy - - deploy-devnet: - requires: - - deploy-contracts - <<: *defaults_deploy + - deploy-and-release: *defaults_deploy \ No newline at end of file diff --git a/build-system/scripts/deploy_npm b/build-system/scripts/deploy_npm index 16df5a156d0..22b5a63d9a7 100755 --- a/build-system/scripts/deploy_npm +++ b/build-system/scripts/deploy_npm @@ -3,7 +3,8 @@ set -eu readonly REPOSITORY=$1 -readonly STANDALONE=${2:-} +readonly DIST_TAG=${2:-"latest"} +readonly STANDALONE=${3:-} # Only publish tagged commits to npm. [ -n "${COMMIT_TAG:-}" ] || { echo "Will only publish tagged commits to npm. Skipping." && exit 0; } @@ -12,7 +13,7 @@ extract_repo $REPOSITORY /usr/src project cd project/src/$(query_manifest relativeProjectDir $REPOSITORY) -echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc +echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >.npmrc VERSION=$(extract_tag_version $REPOSITORY true) @@ -21,14 +22,17 @@ TAG=$(echo "$VERSION" | grep -oP ".*-\K(.*)(?=\.\d+)" || true) TAG_ARG="" if [ -n "$TAG" ]; then TAG_ARG="--tag $TAG" +else + TAG_ARG="--tag $DIST_TAG" + TAG=$DIST_TAG fi -readonly PUBLISHED_VERSION=$(npm show . version ${TAG_ARG:-} 2> /dev/null) +readonly PUBLISHED_VERSION=$(npm show . version ${TAG_ARG:-} 2>/dev/null) readonly HIGHER_VERSION=$(npx semver ${VERSION} ${PUBLISHED_VERSION} | tail -1) # If there is already a published package equal to given version, assume this is a re-run of a deploy, and early out. if [ "$VERSION" == "$PUBLISHED_VERSION" ]; then - echo "Tagged version $VERSION is equal to published version $PUBLISHED_VERSION. Skipping publish." + echo "Tagged ${DIST_TAG:+ $DIST_TAG}version $VERSION is equal to published ${DIST_TAG:+ $DIST_TAG}version $PUBLISHED_VERSION. Skipping publish." exit 0 fi @@ -40,18 +44,26 @@ fi # Update the package version in package.json. TMP=$(mktemp) -jq --arg v $VERSION '.version = $v' package.json > $TMP && mv $TMP package.json +jq --arg v $VERSION '.version = $v' package.json >$TMP && mv $TMP package.json if [ -z "$STANDALONE" ]; then # Update each dependent @aztec package version in package.json. for PKG in $(jq --raw-output ".dependencies | keys[] | select(contains(\"@aztec/\"))" package.json); do - jq --arg v $VERSION ".dependencies[\"$PKG\"] = \$v" package.json > $TMP && mv $TMP package.json + jq --arg v $VERSION ".dependencies[\"$PKG\"] = \$v" package.json >$TMP && mv $TMP package.json done fi # Publish if we have a commit tag -if [ "$DRY_DEPLOY" -eq 1 ] ; then +if [ "$DRY_DEPLOY" -eq 1 ]; then npm publish --dry-run $TAG_ARG --access public else - npm publish $TAG_ARG --access public + # npm publish $TAG_ARG --access public + # Check if version exists + if npm view "$PACKAGE_NAME@$VERSION" version >/dev/null 2>&1; then + # Tag the existing version + npm dist-tag add $PACKAGE_NAME@$VERSION $TAG + else + # Publish new version + npm publish $TAG_ARG --access public + fi fi diff --git a/build-system/scripts/deploy_terraform b/build-system/scripts/deploy_terraform index b81c4d3f4b2..f5ff4dc810b 100755 --- a/build-system/scripts/deploy_terraform +++ b/build-system/scripts/deploy_terraform @@ -43,4 +43,8 @@ for RESOURCE in $TO_TAINT; do terraform taint $RESOURCE || true done -terraform apply -input=false -auto-approve +if [ "$DRY_DEPLOY" -eq 1 ]; then + terraform plan -input=false -auto-approve +else + terraform apply -input=false -auto-approve +fi diff --git a/build_manifest.yml b/build_manifest.yml index 43bce1a4071..00309fad698 100644 --- a/build_manifest.yml +++ b/build_manifest.yml @@ -174,19 +174,6 @@ boxes-token: dependencies: - aztec-sandbox -canary-build: - buildDir: yarn-project - projectDir: yarn-project/canary - dockerfile: Dockerfile.build - dependencies: - - yarn-project - -canary: - buildDir: yarn-project - projectDir: yarn-project/canary - dependencies: - - yarn-project - end-to-end: buildDir: yarn-project projectDir: yarn-project/end-to-end diff --git a/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md b/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md index 8775c14955a..1bd59d9a331 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md +++ b/docs/docs/dev_docs/tutorials/token_portal/typescript_glue_code.md @@ -116,7 +116,7 @@ describe('e2e_cross_chain_messaging', () => { let outbox: any; beforeEach(async () => { - logger = createDebugLogger('aztec:canary_uniswap'); + logger = createDebugLogger('aztec:e2e_uniswap'); const pxe = createPXEClient(PXE_URL); await waitForSandbox(pxe); const wallets = await getSandboxAccountsWallets(pxe); @@ -165,7 +165,7 @@ This fetches the wallets from the sandbox and deploys our cross chain harness on ```bash cd packages/src -DEBUG='aztec:canary_uniswap' yarn test +DEBUG='aztec:e2e_uniswap' yarn test ``` ### Error handling diff --git a/docs/docs/dev_docs/tutorials/uniswap/typescript_glue_code.md b/docs/docs/dev_docs/tutorials/uniswap/typescript_glue_code.md index ff965fa77d7..9ac161a01eb 100644 --- a/docs/docs/dev_docs/tutorials/uniswap/typescript_glue_code.md +++ b/docs/docs/dev_docs/tutorials/uniswap/typescript_glue_code.md @@ -115,7 +115,7 @@ const hdAccount = mnemonicToAccount(MNEMONIC); const expectedForkBlockNumber = 17514288; #include_code uniswap_l1_l2_test_setup_const yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts raw -#include_code uniswap_setup yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts raw +#include_code uniswap_setup yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts raw #include_code uniswap_l1_l2_test_beforeAll yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts raw ``` diff --git a/yarn-project/canary/.eslintrc.cjs b/yarn-project/canary/.eslintrc.cjs deleted file mode 100644 index e659927475c..00000000000 --- a/yarn-project/canary/.eslintrc.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@aztec/foundation/eslint'); diff --git a/yarn-project/canary/.gitignore b/yarn-project/canary/.gitignore deleted file mode 100644 index 9dea6a91bc6..00000000000 --- a/yarn-project/canary/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tsconfig.tsbuildinfo \ No newline at end of file diff --git a/yarn-project/canary/Dockerfile b/yarn-project/canary/Dockerfile deleted file mode 100644 index 3856f455c9f..00000000000 --- a/yarn-project/canary/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM node:18.19.0-alpine AS builder - -RUN apk update && apk add --no-cache bash jq curl - -COPY ./end-to-end /usr/src/end-to-end -COPY ./canary /usr/src/canary - -# Setup & Build end-to-end package -WORKDIR /usr/src/end-to-end -# Extract canary @aztec dependencies -RUN ../canary/scripts/extract_packages.sh ../canary/package.json > ./target_pkgs.txt -# Update end-to-end dependencies with target version -RUN ./scripts/setup_canary.sh ./target_pkgs.txt package.json -RUN rm ./target_pkgs.txt -# yarn install & build to apply changes (canary packages) -RUN yarn && yarn build - -# Install & build canary packages -WORKDIR /usr/src/canary -RUN ./scripts/update_packages.sh canary ../end-to-end/ -RUN yarn && yarn build - -FROM node:18.19.0-alpine -RUN apk update && apk add --no-cache udev ttf-freefont chromium bash -ENV CHROME_BIN="/usr/bin/chromium-browser" PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" - -COPY --from=builder /usr/src/end-to-end /usr/src/end-to-end -COPY --from=builder /usr/src/canary /usr/src/canary - -WORKDIR /usr/src/canary -# Copy browser script -RUN cp ../end-to-end/scripts/start_e2e_ci_browser.sh ./scripts/start_e2e_ci_browser.sh -RUN chmod +x scripts/start_e2e_ci_browser.sh - -RUN cp ./node_modules/@aztec/aztec.js/dest/main.js src/web/ - -ENTRYPOINT ["yarn", "test"] diff --git a/yarn-project/canary/Dockerfile.build b/yarn-project/canary/Dockerfile.build deleted file mode 100644 index fadd8daaa8b..00000000000 --- a/yarn-project/canary/Dockerfile.build +++ /dev/null @@ -1,9 +0,0 @@ -FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project AS builder -WORKDIR /usr/src/yarn-project/canary -# Productionify. See comment in yarn-project-base/Dockerfile. -RUN yarn cache clean && yarn workspaces focus --production - -FROM node:18.19.0-alpine -COPY --from=builder /usr/src /usr/src -WORKDIR /usr/src/yarn-project/canary -ENTRYPOINT ["yarn", "test"] \ No newline at end of file diff --git a/yarn-project/canary/README.md b/yarn-project/canary/README.md deleted file mode 100644 index 3ff4851a9ec..00000000000 --- a/yarn-project/canary/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Canary - -This package is designed for running a comprehensive end to end test of the system using deployed artifacts. It is built and executed after the deployment of artifacts to npm and dockerhub. - -## Development - -If you have an instance of the aztec-sandbox running, then you can simply run `yarn test uniswap` to execute the test. - -To build and execute the test: - -`export FORK_BLOCK_NUMBER=17514288` -`export FORK_URL='https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c'` -`docker build --build-arg COMMIT_TAG= .` -`cd ./scripts` -`docker-compose up` diff --git a/yarn-project/canary/jest.integration.config.json b/yarn-project/canary/jest.integration.config.json deleted file mode 100644 index d9dc9cf2dbb..00000000000 --- a/yarn-project/canary/jest.integration.config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "preset": "ts-jest/presets/default-esm", - "globals": { - "ts-jest": { - "useESM": true - } - }, - "moduleNameMapper": { - "^(\\.{1,2}/.*)\\.js$": "$1" - }, - "testRegex": "./src/.*\\.test\\.ts$", - "rootDir": "./src" -} diff --git a/yarn-project/canary/package.json b/yarn-project/canary/package.json deleted file mode 100644 index dc95e326550..00000000000 --- a/yarn-project/canary/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@aztec/canary", - "version": "0.0.0", - "type": "module", - "exports": "./dest/index.js", - "license": "Apache-2.0", - "scripts": { - "build": "yarn clean && tsc -b", - "build:dev": "tsc -b --watch", - "clean": "rm -rf ./dest .tsbuildinfo", - "formatting": "run -T prettier --check ./src && run -T eslint ./src", - "formatting:fix": "run -T prettier -w ./src", - "test": "DEBUG='aztec:*' NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand --passWithNoTests --testTimeout=15000" - }, - "jest": { - "preset": "ts-jest/presets/default-esm", - "moduleNameMapper": { - "^(\\.{1,2}/.*)\\.js$": "$1" - }, - "testRegex": "./src/.*\\.test\\.ts$", - "rootDir": "./src" - }, - "dependencies": { - "@aztec/aztec.js": "workspace:^", - "@aztec/cli": "workspace:^", - "@aztec/end-to-end": "workspace:^", - "@aztec/ethereum": "workspace:^", - "@aztec/l1-artifacts": "workspace:^", - "@aztec/noir-contracts": "workspace:^", - "@jest/globals": "^29.5.0", - "@types/jest": "^29.5.0", - "@types/koa-static": "^4.0.2", - "@types/node": "^18.7.23", - "abitype": "^0.9.8", - "jest": "^29.5.0", - "koa": "^2.14.2", - "koa-static": "^5.0.0", - "ts-jest": "^29.1.0", - "ts-node": "^10.9.1", - "tslib": "^2.4.0", - "typescript": "^5.0.4", - "viem": "^1.2.5" - }, - "files": [ - "dest", - "src", - "!*.test.*" - ], - "types": "./dest/index.d.ts" -} diff --git a/yarn-project/canary/scripts/docker-compose-browser.yml b/yarn-project/canary/scripts/docker-compose-browser.yml deleted file mode 100644 index 98d8a7d9625..00000000000 --- a/yarn-project/canary/scripts/docker-compose-browser.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: '3' -services: - canary: - image: aztecprotocol/canary:latest - environment: - ETHEREUM_HOST: http://ethereum:8545 - CHAIN_ID: 31337 - PXE_URL: http://aztec:8080 - command: ['./scripts/start_e2e_ci_browser.sh', './src/aztec_js_browser.test.ts'] diff --git a/yarn-project/canary/scripts/docker-compose.yml b/yarn-project/canary/scripts/docker-compose.yml deleted file mode 100644 index 74a28452a07..00000000000 --- a/yarn-project/canary/scripts/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: '3' -services: - canary: - image: aztecprotocol/canary:latest - environment: - ETHEREUM_HOST: http://ethereum:8545 - CHAIN_ID: 31337 - PXE_URL: http://aztec:8080 - command: ${TEST:-./src/cli.test.ts} diff --git a/yarn-project/canary/scripts/extract_packages.sh b/yarn-project/canary/scripts/extract_packages.sh deleted file mode 100755 index 78255e01b24..00000000000 --- a/yarn-project/canary/scripts/extract_packages.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -FILE=$1 - -# Capture the output of the jq command in a Bash array -mapfile -t TARGET_PKGS < <(jq -r '.dependencies | keys[] | select(startswith("@aztec/") and . != "@aztec/end-to-end")' $FILE) - -# Loop through the array and print each element on a new line -for pkg in "${TARGET_PKGS[@]}"; do - echo "$pkg" -done \ No newline at end of file diff --git a/yarn-project/canary/scripts/run_tests b/yarn-project/canary/scripts/run_tests deleted file mode 100755 index 6bde0b451a4..00000000000 --- a/yarn-project/canary/scripts/run_tests +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -# This script is used to run an e2e test in CI (see config.yml and cond_spot_run_tests). -# It sets a few environment variables used inside the docker-compose.yml, pulls images, and runs docker-compose. -[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace -set -eu - -export TEST=$1 -export IMAGE=${2:-canary} -export COMPOSE_FILE=${3:-./scripts/docker-compose.yml} -: -# if test name ends with uniswap_trade_on_l1_from_l2.test.ts, use the forked mainnet -if [[ "$TEST" == *"uniswap_trade_on_l1_from_l2"* ]]; then - export FORK_URL=https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c - export FORK_BLOCK_NUMBER=17514288 -fi - -# Login to ECR. -ecr_login - -export PATH="$PATH:$(git rev-parse --show-toplevel)/build-system/scripts" -IMAGE_URI=$(calculate_image_uri $IMAGE) -retry docker pull $IMAGE_URI -retry docker tag $IMAGE_URI aztecprotocol/canary:latest - -export SANDBOX_VERSION=canary -docker-compose -f ../aztec-sandbox/docker-compose.yml -f $COMPOSE_FILE rm -f -docker-compose -f ../aztec-sandbox/docker-compose.yml -f $COMPOSE_FILE up --exit-code-from canary diff --git a/yarn-project/canary/scripts/update_packages.sh b/yarn-project/canary/scripts/update_packages.sh deleted file mode 100755 index 085dfd217bd..00000000000 --- a/yarn-project/canary/scripts/update_packages.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -eu - -DIST_TAG=$1 -E2E_DIR=$2 - -if [ -z "$DIST_TAG" ]; then - echo "No dist tag provided." - exit 0 -fi - -echo "Updating Aztec dependencies to tag $DIST_TAG" - -TMP=$(mktemp) -# Update NPM dependencies to dist tag -for PKG in $(jq --raw-output ".dependencies | keys[] | select(contains(\"@aztec/\") and (. != \"@aztec/end-to-end\"))" package.json); do - jq --arg v $DIST_TAG ".dependencies[\"$PKG\"] = \$v" package.json >$TMP && mv $TMP package.json -done - -# Update end-to-end to local dependency -TMP=$(mktemp) -jq --arg dir "file:$E2E_DIR" '.dependencies["@aztec/end-to-end"] = $dir' package.json >$TMP && mv $TMP package.json - -jq ".references = []" tsconfig.json >$TMP && mv $TMP tsconfig.json diff --git a/yarn-project/canary/src/aztec_js_browser.test.ts b/yarn-project/canary/src/aztec_js_browser.test.ts deleted file mode 100644 index 3db3febdb67..00000000000 --- a/yarn-project/canary/src/aztec_js_browser.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { createDebugLogger, fileURLToPath } from '@aztec/aztec.js'; -import { browserTestSuite } from '@aztec/end-to-end'; - -import Koa from 'koa'; -import serve from 'koa-static'; -import path, { dirname } from 'path'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); -const PORT = 3000; - -const logger = createDebugLogger('aztec:canary_aztec.js:web'); -const pageLogger = createDebugLogger('aztec:canary_aztec.js:web:page'); - -const setupApp = () => { - const app = new Koa(); - app.use(serve(path.resolve(__dirname, './web'))); - const server = app.listen(PORT, () => { - logger(`Server started at http://localhost:${PORT}`); - }); - - return server; -}; - -browserTestSuite(setupApp, pageLogger); diff --git a/yarn-project/canary/src/cli.test.ts b/yarn-project/canary/src/cli.test.ts deleted file mode 100644 index ef5e9184789..00000000000 --- a/yarn-project/canary/src/cli.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createDebugLogger, createPXEClient, makeFetch, waitForSandbox } from '@aztec/aztec.js'; -import { cliTestSuite } from '@aztec/end-to-end'; - -const { PXE_URL = 'http://localhost:8080' } = process.env; - -const debug = createDebugLogger('aztec:canary_cli'); - -const setupRPC = async () => { - const pxe = createPXEClient(PXE_URL, makeFetch([1, 2, 3, 4, 5], true)); - await waitForSandbox(pxe); - return pxe; -}; - -cliTestSuite('CLI Canary', setupRPC, () => Promise.resolve(), debug, PXE_URL); diff --git a/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts b/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts deleted file mode 100644 index ff00b4f92f9..00000000000 --- a/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { createDebugLogger, createPXEClient, getSandboxAccountsWallets, waitForSandbox } from '@aztec/aztec.js'; -import { UniswapSetupContext, uniswapL1L2TestSuite } from '@aztec/end-to-end'; - -import { createPublicClient, createWalletClient, http } from 'viem'; -import { mnemonicToAccount } from 'viem/accounts'; -import { foundry } from 'viem/chains'; - -const { PXE_URL = 'http://localhost:8080', ETHEREUM_HOST = 'http://localhost:8545' } = process.env; -export const MNEMONIC = 'test test test test test test test test test test test junk'; -const hdAccount = mnemonicToAccount(MNEMONIC); -// This tests works on forked mainnet, configured on the CI. -const EXPECTED_FORKED_BLOCK = 17514288; - -// docs:start:uniswap_setup -const setup = async (): Promise => { - const logger = createDebugLogger('aztec:canary_uniswap'); - const pxe = createPXEClient(PXE_URL); - await waitForSandbox(pxe); - - const walletClient = createWalletClient({ - account: hdAccount, - chain: foundry, - transport: http(ETHEREUM_HOST), - }); - const publicClient = createPublicClient({ - chain: foundry, - transport: http(ETHEREUM_HOST), - }); - - const [ownerWallet, sponsorWallet] = await getSandboxAccountsWallets(pxe); - - return { pxe, logger, publicClient, walletClient, ownerWallet, sponsorWallet }; -}; -// docs:end:uniswap_setup - -uniswapL1L2TestSuite(setup, () => Promise.resolve(), EXPECTED_FORKED_BLOCK); diff --git a/yarn-project/canary/src/web/index.html b/yarn-project/canary/src/web/index.html deleted file mode 100644 index 97e7d022731..00000000000 --- a/yarn-project/canary/src/web/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/yarn-project/canary/tsconfig.json b/yarn-project/canary/tsconfig.json deleted file mode 100644 index a80b4f11c64..00000000000 --- a/yarn-project/canary/tsconfig.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "compilerOptions": { - "outDir": "dest", - "rootDir": "src", - "target": "es2020", - "lib": ["dom", "esnext", "es2017.object"], - "module": "NodeNext", - "moduleResolution": "NodeNext", - "strict": true, - "declaration": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "downlevelIteration": true, - "inlineSourceMap": true, - "declarationMap": true, - "importHelpers": true, - "resolveJsonModule": true, - "composite": true, - "skipLibCheck": true - }, - "references": [ - { - "path": "../aztec.js" - }, - { - "path": "../cli" - }, - { - "path": "../end-to-end" - }, - { - "path": "../ethereum" - }, - { - "path": "../l1-artifacts" - }, - { - "path": "../noir-contracts" - } - ], - "include": ["src"] -} diff --git a/yarn-project/deploy_npm.sh b/yarn-project/deploy_npm.sh index f092e6fe106..19c58b80d6c 100755 --- a/yarn-project/deploy_npm.sh +++ b/yarn-project/deploy_npm.sh @@ -23,8 +23,14 @@ function deploy_package() { VERSION=$(extract_tag_version $REPOSITORY false) echo "Deploying $REPOSITORY $VERSION $DIST_TAG" - if [ -n "$DIST_TAG" ]; then + # If the commit tag itself has a dist-tag (e.g. v2.1.0-testnet.123), extract the dist-tag. + TAG=$(echo "$VERSION" | grep -oP ".*-\K(.*)(?=\.\d+)" || true) + TAG_ARG="" + if [ -n "$TAG" ]; then + TAG_ARG="--tag $TAG" + else TAG_ARG="--tag $DIST_TAG" + TAG=$DIST_TAG fi PUBLISHED_VERSION=$(npm show . version ${TAG_ARG:-} 2>/dev/null) || true @@ -32,7 +38,7 @@ function deploy_package() { # Check if there is already a published package equal to given version, assume this is a re-run of a deploy if [ "$VERSION" == "$PUBLISHED_VERSION" ]; then - echo "Tagged ${DIST_TAG:+ $DIST_TAG}version $VERSION is equal to published ${DIST_TAG:+ $DIST_TAG}version $PUBLISHED_VERSION." + echo "Tagged $TAG version $VERSION is equal to published $TAG version $PUBLISHED_VERSION." echo "Skipping publish." exit 0 fi @@ -61,7 +67,7 @@ function deploy_package() { # Check if version exists if npm view "$PACKAGE_NAME@$VERSION" version >/dev/null 2>&1; then # Tag the existing version - npm dist-tag add $PACKAGE_NAME@$VERSION $DIST_TAG + npm dist-tag add $PACKAGE_NAME@$VERSION $TAG else # Publish new version npm publish $TAG_ARG --access public diff --git a/yarn-project/end-to-end/scripts/setup_canary.sh b/yarn-project/end-to-end/scripts/setup_canary.sh deleted file mode 100755 index 14d7e176652..00000000000 --- a/yarn-project/end-to-end/scripts/setup_canary.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -set -eu - -TARGET_PKGS_FILE=$1 - -DIST_TAG=canary - -# Check if file exists and read it into an array -if [ -f "$TARGET_PKGS_FILE" ]; then - mapfile -t TARGET_PKGS < <(cat "$TARGET_PKGS_FILE") - echo "Loaded package array:" - for i in "${TARGET_PKGS[@]}"; do - echo "$i" - done -else - echo "File $TARGET_PKGS_FILE does not exist." -fi - -if [ -z "$DIST_TAG" ]; then - echo "No dist tag provided." - exit 0 -fi - -echo "Removing all files & folders that aren't needed for canary tests" -TARGET_DIR="./src" -cd "$TARGET_DIR" - -# Loop through all files and folders in the directory -for item in $(ls -A); do - if [[ "$item" != "index.ts" && "$item" != "shared" ]]; then - # Remove the item (either file or folder) - rm -rf "$item" - fi -done -cd .. - -echo "Updating external Aztec dependencies to tag '$DIST_TAG'" -JSON_TARGET_PKGS=$(printf '%s\n' "${TARGET_PKGS[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))') - -TMP=$(mktemp) -jq --arg v $DIST_TAG --argjson target_pkgs "$JSON_TARGET_PKGS" ' -.dependencies |= with_entries( - select( - (.key | startswith("@aztec")) as $isAztec | - if $isAztec then - .key as $k | any($target_pkgs[]; . == $k) - else - true - end - ) | - if .key as $k | any($target_pkgs[]; . == $k) then - .value = $v - else - . - end -)' package.json >$TMP && mv $TMP package.json - -echo "Updating end-to-end tsconfig.json" -TMP=$(mktemp) -# Copy canary's tsconfig.json -cp ../canary/tsconfig.json tsconfig.json -jq 'del(.references)' tsconfig.json >$TMP && mv $TMP tsconfig.json diff --git a/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts b/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts index 9bc5db2f362..5e20be7f9f5 100644 --- a/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts +++ b/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts @@ -9,6 +9,7 @@ const EXPECTED_FORKED_BLOCK = 0; //17514288; let teardown: () => Promise; +// docs:start:uniswap_setup const testSetup = async (): Promise => { const { teardown: teardown_, @@ -28,6 +29,7 @@ const testSetup = async (): Promise => { return { pxe, logger, publicClient, walletClient, ownerWallet, sponsorWallet }; }; +// docs:end:uniswap_setup const testCleanup = async () => { await teardown(); diff --git a/yarn-project/package.json b/yarn-project/package.json index 089ce942376..34945e2ad55 100644 --- a/yarn-project/package.json +++ b/yarn-project/package.json @@ -10,7 +10,7 @@ "formatting:fix": "FORCE_COLOR=true yarn workspaces foreach -p -v run formatting:fix", "lint": "yarn eslint --cache --ignore-pattern l1-artifacts .", "format": "yarn prettier --cache -w .", - "test": "FORCE_COLOR=true yarn workspaces foreach --exclude @aztec/aztec3-packages --exclude @aztec/end-to-end --exclude @aztec/canary --exclude private-token -p -j unlimited -v run test", + "test": "FORCE_COLOR=true yarn workspaces foreach --exclude @aztec/aztec3-packages --exclude @aztec/end-to-end --exclude private-token -p -j unlimited -v run test", "build": "yarn workspace @aztec/l1-artifacts build && tsc -b tsconfig.json", "build:dev": "yarn workspace @aztec/l1-artifacts build && tsc -b tsconfig.json --watch", "clean": "yarn workspaces foreach -p -v run clean" @@ -26,7 +26,6 @@ "boxes/blank", "boxes/blank-react", "boxes/token", - "canary", "circuits.js", "cli", "docs", diff --git a/yarn-project/tsconfig.json b/yarn-project/tsconfig.json index 9910d1379ca..7ca6f4322c1 100644 --- a/yarn-project/tsconfig.json +++ b/yarn-project/tsconfig.json @@ -25,7 +25,6 @@ { "path": "aztec-node/tsconfig.json" }, { "path": "pxe/tsconfig.json" }, { "path": "aztec-sandbox/tsconfig.json" }, - { "path": "canary/tsconfig.json" }, { "path": "circuits.js/tsconfig.json" }, { "path": "cli/tsconfig.json" }, { "path": "end-to-end/tsconfig.json" }, diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 935cf87829a..06a076f1cfe 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -290,32 +290,6 @@ __metadata: languageName: node linkType: soft -"@aztec/canary@workspace:canary": - version: 0.0.0-use.local - resolution: "@aztec/canary@workspace:canary" - dependencies: - "@aztec/aztec.js": "workspace:^" - "@aztec/cli": "workspace:^" - "@aztec/end-to-end": "workspace:^" - "@aztec/ethereum": "workspace:^" - "@aztec/l1-artifacts": "workspace:^" - "@aztec/noir-contracts": "workspace:^" - "@jest/globals": ^29.5.0 - "@types/jest": ^29.5.0 - "@types/koa-static": ^4.0.2 - "@types/node": ^18.7.23 - abitype: ^0.9.8 - jest: ^29.5.0 - koa: ^2.14.2 - koa-static: ^5.0.0 - ts-jest: ^29.1.0 - ts-node: ^10.9.1 - tslib: ^2.4.0 - typescript: ^5.0.4 - viem: ^1.2.5 - languageName: unknown - linkType: soft - "@aztec/circuits.js@workspace:^, @aztec/circuits.js@workspace:circuits.js": version: 0.0.0-use.local resolution: "@aztec/circuits.js@workspace:circuits.js" @@ -382,7 +356,7 @@ __metadata: languageName: unknown linkType: soft -"@aztec/end-to-end@workspace:^, @aztec/end-to-end@workspace:end-to-end": +"@aztec/end-to-end@workspace:end-to-end": version: 0.0.0-use.local resolution: "@aztec/end-to-end@workspace:end-to-end" dependencies: @@ -6470,21 +6444,6 @@ __metadata: languageName: node linkType: hard -"abitype@npm:^0.9.8": - version: 0.9.8 - resolution: "abitype@npm:0.9.8" - peerDependencies: - typescript: ">=5.0.4" - zod: ^3 >=3.19.1 - peerDependenciesMeta: - typescript: - optional: true - zod: - optional: true - checksum: d7d887f29d6821e3f7a400de9620511b80ead3f85c5c87308aaec97965d3493e6687ed816e88722b4f512249bd66dee9e69231b49af0e1db8f69400a62c87cf6 - languageName: node - linkType: hard - "abortable-iterator@npm:^5.0.1": version: 5.0.1 resolution: "abortable-iterator@npm:5.0.1"