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

Publish release with wasms #184

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
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
12 changes: 10 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,22 @@ save_logs: &save_logs
jobs:
wasm-linux-clang:
docker:
- image: aztecprotocol/alpine-build-image
- image: cimg/aws:2023.04
resource_class: small
steps:
- run:
name: Install deps
command: sudo apt update && sudo apt install golang-go && go install github.com/tcnksm/ghr@latest
- *checkout
- *setup_env
- run:
name: 'Build'
command: cond_spot_run_build aztec3-circuits-wasm-linux-clang 64
- setup_remote_docker:
docker_layer_caching: true
- run:
name: 'Publish'
command: ./scripts/publish_release aztec3-circuits-wasm-linux-clang

wasm-linux-clang-assert:
docker:
Expand All @@ -116,7 +124,7 @@ jobs:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
steps:
- *checkout
- *setup_env
- run:
Expand Down
47 changes: 47 additions & 0 deletions scripts/publish_release
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -euo pipefail

# Publishes a release to github (depends on build-system)

REPOSITORY=$1
PROJECT_DIR=$(query_manifest projectDir $REPOSITORY)
EXTRACT_DIR=../extracted/$REPOSITORY
ARTIFACTS_DIR=../artifacts

echo "publish_release: Repository: $REPOSITORY"
echo "publish_release: Project Dir: $PROJECT_DIR"
echo "publish_release: Working directory: $PWD"
echo "publish_release: Extract dir: $EXTRACT_DIR"
echo "publish_release: Artifacts dir: $ARTIFACTS_DIR"

# Get the contents of the build
# extract_repo $REPOSITORY /usr/src/$PROJECT_DIR $EXTRACT_DIR
IMAGE_COMMIT_URI=$ECR_DEPLOY_URL/$REPOSITORY:$COMMIT_HASH
EXTRACT_FROM=/usr/src/$PROJECT_DIR
EXTRACT_TO=$EXTRACT_DIR

echo "Pulling $IMAGE_COMMIT_URI..."
docker pull $IMAGE_COMMIT_URI
TEMP_CONTAINER=$(docker create $IMAGE_COMMIT_URI)

echo "Extracting $EXTRACT_FROM from $REPOSITORY to $EXTRACT_TO..."
mkdir -p $EXTRACT_TO
docker cp $TEMP_CONTAINER:$EXTRACT_FROM $EXTRACT_TO
docker rm -v $TEMP_CONTAINER > /dev/null

echo "Extracted contents:"
ls -al $EXTRACT_TO

# Prepare the artifacts to push
mkdir -p $ARTIFACTS_DIR
# TODO: Make these params of the script and not hardcode them here
cp $EXTRACT_DIR/build-wasm/bin/aztec3-circuits.wasm $EXTRACT_DIR/barretenberg/cpp/build-wasm/bin/primitives.wasm $ARTIFACTS_DIR/

# Version to use for the release
# TODO: if this is a tagged release, just use the tag and drop the commit hash
VERSION=$(cat VERSION)-$COMMIT_HASH

# Get ghr to make the release and create it
echo "publish_release: Publishing $VERSION"
echo "publish_release: $(ls $ARTIFACTS_DIR/)"
~/go/bin/ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${COMMIT_HASH} -delete ${VERSION} $ARTIFACTS_DIR/