Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): combine deploy / release jobs + canary update #3610

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 22 additions & 60 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -904,77 +904,54 @@ 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
steps:
- *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: |
Expand Down Expand Up @@ -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
28 changes: 20 additions & 8 deletions build-system/scripts/deploy_npm
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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)

Expand All @@ -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

Expand All @@ -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
6 changes: 5 additions & 1 deletion build-system/scripts/deploy_terraform
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 0 additions & 13 deletions build_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
1 change: 0 additions & 1 deletion yarn-project/canary/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion yarn-project/canary/.gitignore

This file was deleted.

37 changes: 0 additions & 37 deletions yarn-project/canary/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions yarn-project/canary/Dockerfile.build

This file was deleted.

15 changes: 0 additions & 15 deletions yarn-project/canary/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions yarn-project/canary/jest.integration.config.json

This file was deleted.

50 changes: 0 additions & 50 deletions yarn-project/canary/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions yarn-project/canary/scripts/docker-compose-browser.yml

This file was deleted.

Loading