Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
try shared target dir
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed May 15, 2018
1 parent a5b3355 commit 6d00624
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 28 deletions.
64 changes: 42 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,42 @@ jobs:
- checkout

# Install Ekiden binaries.
- run: cargo install --git https://github.com/oasislabs/ekiden --branch master ekiden-tools
- run: cargo install --git https://github.com/oasislabs/ekiden --branch master ekiden-compute
- run:
environment:
CARGO_TARGET_DIR: target
command: >-
cargo install
--git https://github.com/oasislabs/ekiden
--branch master
--debug
ekiden-tools
- run:
environment:
CARGO_TARGET_DIR: target
command: >-
cargo install
--git https://github.com/oasislabs/ekiden
--branch master
--debug
ekiden-compute
# Build key manager contract.
- run: |
cargo ekiden build-contract \
--git https://github.com/oasislabs/ekiden \
--branch master \
--output target/contract \
ekiden-key-manager
- run: >-
cargo ekiden build-contract
--git https://github.com/oasislabs/ekiden
--branch master
--output target/contract
--target-dir "$PWD/target"
ekiden-key-manager
# Build the contract.
- run: cargo ekiden build-contract --output-identity
# Run the contract tests.
- run: cargo test
# Build the client.
- run:
command: cargo build
environment:
CARGO_BUILD_TARGET_DIR: ../target
working_directory: client
command: cargo build
# Check style. This needs to be after everything is built.
- run: cargo fmt -- --write-mode=diff

Expand All @@ -45,7 +64,6 @@ jobs:
# Start web3 proxy.
- run:
command: ./target/debug/web3-client --mr-enclave $(cat ../target/contract/evm.mrenclave)
working_directory: client
background: true
# TODO: Run a test script.
# - run:
Expand All @@ -67,17 +85,18 @@ jobs:
- run: |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
BUILD_IMAGES_NO_ENTER=1 ./docker/deployment/build-images.sh
# Push deployment image.
- run: docker push oasislabs/ekiden-contract-evm:latest
# Update testnet.
# https://stackoverflow.com/a/33511811/1864688
- run: |
REPO_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' oasislabs/ekiden-contract-evm:latest)
mkdir -p ~/.kube
echo "$KUBECONFIG_CONTENT_BASE64" | base64 -di >~/.kube/config
kubectl set image deployments/evm-key-manager ekiden-compute=$REPO_DIGEST
kubectl set image deployments/evm ekiden-compute=$REPO_DIGEST
kubectl set image deployments/web3-client web3-client=$REPO_DIGEST
# %%% don't push. uncomment below
# # Push deployment image.
# - run: docker push oasislabs/ekiden-contract-evm:latest
# # Update testnet.
# # https://stackoverflow.com/a/33511811/1864688
# - run: |
# REPO_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' oasislabs/ekiden-contract-evm:latest)
# mkdir -p ~/.kube
# echo "$KUBECONFIG_CONTENT_BASE64" | base64 -di >~/.kube/config
# kubectl set image deployments/evm-key-manager ekiden-compute=$REPO_DIGEST
# kubectl set image deployments/evm ekiden-compute=$REPO_DIGEST
# kubectl set image deployments/web3-client web3-client=$REPO_DIGEST

workflows:
version: 2
Expand All @@ -87,7 +106,8 @@ workflows:
- deploy:
filters:
branches:
only: master
# %%% change back to master
only: targetpath
requires:
- build
experimental:
Expand Down
10 changes: 4 additions & 6 deletions docker/deployment/build-images-inner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ EOF
fi

# Build all Ekiden binaries and resources.
# TODO: Check if we can save any compilation by setting CARGO_TARGET_DIR.
cargo install --force --git https://github.com/oasislabs/ekiden --tag 0.1.0-alpha.3 ekiden-tools
# TODO: Let this share our target path to reduce duplicated compilation.
cargo ekiden build-contract --git https://github.com/oasislabs/ekiden --tag 0.1.0-alpha.3 --output target/contract --release ekiden-key-manager
CARGO_TARGET_DIR=target cargo install --force --git https://github.com/oasislabs/ekiden --branch master ekiden-tools
cargo ekiden build-contract --git https://github.com/oasislabs/ekiden --branch master --output target/contract --target-dir target --release ekiden-key-manager
cargo ekiden build-contract --release --output-identity
(cd client && cargo build --release)
(cd client && CARGO_BUILD_TARGET_DIR=../target cargo build --release)

# Package all binaries and resources.
mkdir -p target/docker-deployment/context/bin target/docker-deployment/context/lib target/docker-deployment/context/res
ln target/contract/ekiden-key-manager.so target/docker-deployment/context/lib/evm-key-manager.so
ln target/contract/evm.so target/docker-deployment/context/lib
ln target/contract/evm.mrenclave target/docker-deployment/context/res
ln client/target/release/web3-client target/docker-deployment/context/bin
ln target/release/web3-client target/docker-deployment/context/bin
ln docker/deployment/Dockerfile target/docker-deployment/context/Dockerfile
tar cvzhf target/docker-deployment/context.tar.gz -C target/docker-deployment/context .
rm -rf target/docker-deployment/context

0 comments on commit 6d00624

Please sign in to comment.