Skip to content

Commit

Permalink
[circleci] test docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
rustielin authored and aptos-bot committed Apr 8, 2022
1 parent e623f22 commit 36fd915
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 34 deletions.
111 changes: 79 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,31 @@ orbs:
aws-ecr: circleci/[email protected]
kubernetes: circleci/[email protected]

jobs:
build-benchmarks:
executors:
ubuntu-medium:
machine:
image: ubuntu-2004:current
resource_class: medium
ubuntu-xl:
machine:
image: ubuntu-2004:current
resource_class: xlarge
ubuntu-2xl:
machine:
image: ubuntu-2004:current
resource_class: 2xlarge
docker-typescript-builder:
docker:
- image: circleci/node:16.13.1-browsers

jobs:
build-benchmarks:
executor: ubuntu-xl
steps:
- dev-setup
- run: cargo x bench --no-run
lint:
docker:
- image: cimg/base:2020.01
resource_class: medium
executor: ubuntu-xl
steps:
- dev-setup
- run: sudo apt-get install shellcheck --assume-yes --no-install-recommends
Expand All @@ -30,24 +43,18 @@ jobs:
- run: cargo fmt
- run: cargo xfmt --check
e2e-test:
machine:
image: ubuntu-2004:current
resource_class: 2xlarge
executor: ubuntu-2xl
steps:
- dev-setup
- run: RUST_BACKTRACE=full cargo nextest --nextest-profile ci --partition hash:1/1 --test-threads 5 --package smoke-test
unit-test:
machine:
image: ubuntu-2004:current
resource_class: 2xlarge
executor: ubuntu-2xl
steps:
- dev-setup
- run: cargo xtest --doc --unit --changed-since "origin/main"
- run: cargo nextest --nextest-profile ci --partition hash:1/1 --unit --exclude backup-cli --changed-since "origin/main"
docker-build-push:
machine:
image: ubuntu-2004:current
resource_class: medium
executor: ubuntu-medium
parameters:
addl_tag:
description: Additional image tag
Expand Down Expand Up @@ -82,9 +89,7 @@ jobs:
exit $ret
fi
ecr-dockerhub-mirror:
machine:
image: ubuntu-2004:current
resource_class: medium
executor: ubuntu-medium
parameters:
addl_tag:
description: Additional image tag
Expand Down Expand Up @@ -134,10 +139,8 @@ jobs:
docker push "${org}/${img}:<<parameters.addl_tag>>" || ret=$?
done
exit $ret
forge-k8s:
docker:
- image: cimg/base:stable
resource_class: medium
forge-k8s-test:
executor: ubuntu-medium
steps:
- checkout
- aws-setup
Expand Down Expand Up @@ -175,9 +178,41 @@ jobs:
-X POST -d "{\"body\": \"${FORGE_COMMENT}\"}" \
"https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/issues/${PR_NUMBER}/comments"
exit 0
docker-compose-test:
executor: ubuntu-medium
steps:
- checkout
- aws-setup
- aws-ecr-setup
- local-deploy-setup
- run: echo "export IMAGE_TAG=dev_$(git rev-parse --short=8 HEAD)" >> $BASH_ENV
# since we're running with `--build-all`, assume that if it passes, we have all images required for Forge
- run: aws ecr describe-images --repository-name="aptos/validator" --image-ids=imageTag=$IMAGE_TAG
- run:
name: Start local testnet docker-compose
shell: /bin/bash
working_directory: docker/compose/validator-testnet
command: |
export VALIDATOR_IMAGE_REPO=${AWS_ECR_ACCOUNT_URL}/aptos/validator
export FAUCET_IMAGE_REPO=${AWS_ECR_ACCOUNT_URL}/aptos/faucet
docker-compose up -d
- run:
name: Verify testnet docker-compose up
shell: /bin/bash
command: |
for i in $(seq 60); do
curl -s -w "\n%{http_code}\n" localhost:8080 | tee >(tail -1 > validator_ret.txt)
curl -s -w "\n%{http_code}\n" -X POST 'localhost:8000/mint?pub_key=459c77a38803bd53f3adee52703810e3a74fd7c46952c497e75afb0a7932586d&amount=20000000' \
| tee >(tail -1 > faucet_ret.txt)
if [ "$(cat validator_ret.txt)" = "200" ] && [ "$(cat faucet_ret.txt)" = "200" ]; then
echo "Both validator and faucet healthy"
exit 0
fi
sleep 1
done
exit 1
sdk-typescript-test:
docker:
- image: circleci/node:16.13.1-browsers
executor: docker-typescript-builder
steps:
- checkout
# install packages for examples
Expand All @@ -198,25 +233,29 @@ workflows:
when:
condition:
or:
- equal: [ auto, << pipeline.git.branch >> ]
- equal: [ canary, << pipeline.git.branch >> ]
- equal: [auto, << pipeline.git.branch >>]
- equal: [canary, << pipeline.git.branch >>]
jobs:
# - build-benchmarks
# - build-benchmarks
- e2e-test
- lint
- unit-test
- sdk-typescript-test
- docker-build-push:
context: aws-dev
- forge-k8s:
- docker-compose-test:
context: aws-dev
requires:
- docker-build-push
- forge-k8s-test:
context: aws-dev
requires:
- docker-build-push
### on devnet branch update ###
# Ensure the latest is built on the "devnet" branch, and mirror from ECR to Dockerhub
devnet-branch-cut:
when:
equal: [ devnet, << pipeline.git.branch >> ]
equal: [devnet, << pipeline.git.branch >>]
jobs:
- docker-build-push:
context: aws-dev
Expand All @@ -233,8 +272,8 @@ workflows:
continuous-push:
when:
and:
- equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
- equal: [ "continuous_push", << pipeline.schedule.name >> ]
- equal: [scheduled_pipeline, << pipeline.trigger_source >>]
- equal: ["continuous_push", << pipeline.schedule.name >>]
jobs:
- docker-build-push:
context: aws-dev
Expand All @@ -244,8 +283,8 @@ workflows:
nightly:
when:
and:
- equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
- equal: [ "nightly", << pipeline.schedule.name >> ]
- equal: [scheduled_pipeline, << pipeline.trigger_source >>]
- equal: ["nightly", << pipeline.schedule.name >>]
jobs:
- docker-build-push:
context: aws-dev
Expand Down Expand Up @@ -277,6 +316,14 @@ commands:
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
local-deploy-setup:
steps:
- run:
name: Install Docker Compose
command: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
### Sets up the permissions required for accessing AWS resources
aws-setup:
steps:
Expand Down
4 changes: 2 additions & 2 deletions docker/compose/validator-testnet/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
validator:
# Note this image currently does not support this, will update to the appropriate minimum
# version shortly
image: "aptoslab/validator:${IMAGE_TAG:-devnet}"
image: "${VALIDATOR_IMAGE_REPO:-aptoslab/validator}:${IMAGE_TAG:-devnet}"
networks:
shared:
volumes:
Expand All @@ -43,7 +43,7 @@ services:
- 9101

faucet:
image: "aptoslab/faucet:${IMAGE_TAG:-devnet}"
image: "${FAUCET_IMAGE_REPO:-aptoslab/faucet}:${IMAGE_TAG:-devnet}"
depends_on:
- validator
networks:
Expand Down

0 comments on commit 36fd915

Please sign in to comment.