cosmjs/.circleci/config.yml
2021-04-13 16:58:54 +02:00

662 lines
26 KiB
YAML

version: 2
workflows:
version: 2
workflow:
# Keep those job names in sync with .mergify.yml
jobs:
- build
- docs-build:
requires:
- build
- docs-deploy:
requires:
- docs-build
- build
- lint
filters:
branches:
only: main
- lint:
requires:
- build
- test:
requires:
- build
- test-node-v12:
requires:
- build
- test-chrome:
requires:
- build
- coverage:
requires:
- build
jobs:
build:
docker:
- image: circleci/node:10-buster
steps:
- run:
name: Install Git Large File Storage (LFS)
command: sudo apt-get install git-lfs
- checkout
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
command: sudo apt-get install libusb-1.0-0-dev
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
command: yarn build
- persist_to_workspace:
root: .
paths:
- packages/*/build/*
- run:
name: Check for clean workspace
command: |
SOURCE_CHANGES=$(git status --porcelain)
if [[ -n "$SOURCE_CHANGES" ]]; then
echo "Error: repository contains changes."
echo "Showing 'git status' and 'git diff' for debugging now:"
git status
git --no-pager diff
exit 1
fi
test:
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
# feature, as documented in https://circleci.com/docs/2.0/building-docker-images/#separation-of-environments
# As a consequence, we cannot use the circleci CLI for this job because "You cannot use the machine
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
#
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
image: ubuntu-2004:202010-01
steps:
- run:
name: Install Git Large File Storage (LFS)
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
sudo dpkg -i "$HOME/git-lfs.deb"
- checkout
- run: # start early for less wait time below
name: Start launchpad
command: ./scripts/launchpad/start.sh
background: true
- run: # start early for less wait time below
name: Start wasmd
command: ./scripts/wasmd/start.sh
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
command: ./scripts/tendermint/all_start.sh
background: true
- attach_workspace:
at: /tmp/builds
- run:
name: Merge build folders into project (merge with hardlinks)
command: cp --recursive --link /tmp/builds/* .
- run:
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
name: Uninstall nvm
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
- run:
name: Install nodejs
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_10.x/pool/main/n/nodejs/nodejs_10.23.0-deb-1nodesource1_amd64.deb
sudo dpkg -i "$HOME/nodejs.deb"
- run:
name: Install yarn
command: |
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
sudo dpkg -i "$HOME/yarn.deb"
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
# In the current image, `sudo apt install libusb-1.0-0-dev` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/libusb.deb" http://de.archive.ubuntu.com/ubuntu/pool/main/libu/libusb-1.0/libusb-1.0-0-dev_1.0.23-2build1_amd64.deb
sudo dpkg -i "$HOME/libusb.deb"
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Initialize launchpad (deploy contracts and friends)
command: ./scripts/launchpad/init.sh
- run:
name: Initialize wasmd (deploy contracts and friends)
command: ./scripts/wasmd/init.sh
- run:
name: Start socket server
command: ./scripts/socketserver/start.sh
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
WASMD_ENABLED: 1
command: yarn test --stream
- run:
name: Run CLI selftest
working_directory: packages/cli
environment:
SKIP_BUILD: 1
command: yarn selftest
- run:
name: Run CLI examples
working_directory: packages/cli
environment:
SKIP_BUILD: 1
command: |
./bin/cosmwasm-cli --init examples/coralnet.ts --code "process.exit(0)"
./bin/cosmwasm-cli --init examples/delegate.ts --code "process.exit(0)"
./bin/cosmwasm-cli --init examples/faucet_addresses.ts --code "process.exit(0)"
./bin/cosmwasm-cli --init examples/generate_address.ts --code "process.exit(0)"
./bin/cosmwasm-cli --init examples/helpers.ts --code "process.exit(0)"
./bin/cosmwasm-cli --init examples/local_faucet.ts --code "process.exit(0)"
./bin/cosmwasm-cli --init examples/mask.ts --code "process.exit(0)"
- run:
name: Stop chains
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
test-node-v12:
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
# feature, as documented in https://circleci.com/docs/2.0/building-docker-images/#separation-of-environments
# As a consequence, we cannot use the circleci CLI for this job because "You cannot use the machine
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
#
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
image: ubuntu-2004:202010-01
steps:
- run:
name: Install Git Large File Storage (LFS)
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
sudo dpkg -i "$HOME/git-lfs.deb"
- checkout
- run: # start early for less wait time below
name: Start launchpad
command: ./scripts/launchpad/start.sh
background: true
- run: # start early for less wait time below
name: Start wasmd
command: ./scripts/wasmd/start.sh
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
command: ./scripts/tendermint/all_start.sh
background: true
- attach_workspace:
at: /tmp/builds
- run:
name: Merge build folders into project (merge with hardlinks)
command: cp --recursive --link /tmp/builds/* .
- run:
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
name: Uninstall nvm
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
- run:
name: Install nodejs
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_12.x/pool/main/n/nodejs/nodejs_12.20.1-deb-1nodesource1_amd64.deb
sudo dpkg -i "$HOME/nodejs.deb"
- run:
name: Install yarn
command: |
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
sudo dpkg -i "$HOME/yarn.deb"
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
# In the current image, `sudo apt install libusb-1.0-0-dev` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/libusb.deb" http://de.archive.ubuntu.com/ubuntu/pool/main/libu/libusb-1.0/libusb-1.0-0-dev_1.0.23-2build1_amd64.deb
sudo dpkg -i "$HOME/libusb.deb"
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Initialize launchpad (deploy contracts and friends)
command: ./scripts/launchpad/init.sh
- run:
name: Initialize wasmd (deploy contracts and friends)
command: ./scripts/wasmd/init.sh
- run:
name: Start socket server
command: ./scripts/socketserver/start.sh
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
WASMD_ENABLED: 1
SES_ENABLED: 1
command: yarn test --stream
- run:
name: Run CLI selftest
working_directory: packages/cli
environment:
SKIP_BUILD: 1
command: yarn selftest
- run:
name: Run CLI examples
working_directory: packages/cli
environment:
SKIP_BUILD: 1
command: ./run_examples.sh
- run:
name: Stop chains
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
test-chrome:
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
# feature, as documented in https://circleci.com/docs/2.0/building-docker-images/#separation-of-environments
# As a consequence, we cannot use the circleci CLI for this job because "You cannot use the machine
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
#
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
image: ubuntu-2004:202010-01
steps:
- run:
name: Install Git Large File Storage (LFS)
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
sudo dpkg -i "$HOME/git-lfs.deb"
- checkout
- run: # start early for less wait time below
name: Start launchpad
command: ./scripts/launchpad/start.sh
background: true
- run: # start early for less wait time below
name: Start wasmd
command: ./scripts/wasmd/start.sh
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
command: ./scripts/tendermint/all_start.sh
background: true
- attach_workspace:
at: /tmp/builds
- run:
name: Merge build folders into project (merge with hardlinks)
command: cp --recursive --link /tmp/builds/* .
- run:
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
name: Uninstall nvm
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
- run:
name: Install nodejs
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_10.x/pool/main/n/nodejs/nodejs_10.23.0-deb-1nodesource1_amd64.deb
sudo dpkg -i "$HOME/nodejs.deb"
- run:
name: Install yarn
command: |
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
sudo dpkg -i "$HOME/yarn.deb"
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
# In the current image, `sudo apt install libusb-1.0-0-dev` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/libusb.deb" http://de.archive.ubuntu.com/ubuntu/pool/main/libu/libusb-1.0/libusb-1.0-0-dev_1.0.23-2build1_amd64.deb
sudo dpkg -i "$HOME/libusb.deb"
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Initialize launchpad (deploy contracts and friends)
command: ./scripts/launchpad/init.sh
- run:
name: Initialize wasmd (deploy contracts and friends)
command: ./scripts/wasmd/init.sh
- run:
name: Start socket server
command: ./scripts/socketserver/start.sh
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
WASMD_ENABLED: 1
command: yarn test-chrome
- run:
name: Stop chains
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
coverage:
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
# feature, as documented in https://circleci.com/docs/2.0/building-docker-images/#separation-of-environments
# As a consequence, we cannot use the circleci CLI for this job because "You cannot use the machine
# executor in local jobs." (https://circleci.com/docs/2.0/local-cli/#limitations-of-running-jobs-locally)
#
# Available images: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
image: ubuntu-2004:202010-01
steps:
- run:
name: Install Git Large File Storage (LFS)
# In the current image, `sudo apt install git-lfs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/git-lfs.deb" https://packagecloud.io/github/git-lfs/packages/ubuntu/focal/git-lfs_2.12.1_amd64.deb/download.deb
sudo dpkg -i "$HOME/git-lfs.deb"
- checkout
- run: # start early for less wait time below
name: Start launchpad
command: ./scripts/launchpad/start.sh
background: true
- run: # start early for less wait time below
name: Start wasmd
command: ./scripts/wasmd/start.sh
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
command: ./scripts/tendermint/all_start.sh
background: true
- attach_workspace:
at: /tmp/builds
- run:
name: Merge build folders into project (merge with hardlinks)
command: cp --recursive --link /tmp/builds/* .
- run:
# The images ubuntu-1604 comes with preinstalled nvm, which does not work well with non-login shells
name: Uninstall nvm
# Moving to trash is faster than deleting (gvfs-trash is not installed on this image)
command: mkdir -p ~/.local/share/Trash && mv "$NVM_DIR" ~/.npm ~/.local/share/Trash
- run:
name: Install nodejs
# In the current image, `sudo apt install nodejs` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/nodejs.deb" https://deb.nodesource.com/node_10.x/pool/main/n/nodejs/nodejs_10.23.0-deb-1nodesource1_amd64.deb
sudo dpkg -i "$HOME/nodejs.deb"
- run:
name: Install yarn
command: |
wget -O "$HOME/yarn.deb" https://dl.yarnpkg.com/debian/pool/main/y/yarn/yarn_1.22.4_all.deb
sudo dpkg -i "$HOME/yarn.deb"
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
# In the current image, `sudo apt install libusb-1.0-0-dev` requires `sudo apt update` which is too slow
command: |
wget -O "$HOME/libusb.deb" http://de.archive.ubuntu.com/ubuntu/pool/main/libu/libusb-1.0/libusb-1.0-0-dev_1.0.23-2build1_amd64.deb
sudo dpkg -i "$HOME/libusb.deb"
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Initialize launchpad (deploy contracts and friends)
command: ./scripts/launchpad/init.sh
- run:
name: Initialize wasmd (deploy contracts and friends)
command: ./scripts/wasmd/init.sh
- run:
name: Start socket server
command: ./scripts/socketserver/start.sh
- run:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
WASMD_ENABLED: 1
command: yarn coverage
- run:
name: Upload coverage report
command: npx codecov
- run:
name: Stop chains
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
docs-build:
docker:
- image: circleci/node:10-buster
steps:
- run:
name: Install Git Large File Storage (LFS)
command: sudo apt-get install git-lfs
- checkout
- attach_workspace:
at: /tmp/builds
- run:
name: Merge build folders into project (merge with hardlinks)
command: cp --recursive --link /tmp/builds/* .
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
command: sudo apt-get install libusb-1.0-0-dev
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Build package docs
command: yarn docs
- run:
name: Copy docs into deployment folder
command: ./scripts/docs/copy_docs.sh
- persist_to_workspace:
root: .
paths: docs_deployment
docs-deploy:
docker:
- image: circleci/node:10-buster
steps:
- attach_workspace:
at: .
- add_ssh_keys:
fingerprints:
- "a7:b3:94:4a:9e:e1:30:fa:ca:22:d1:db:a1:78:d6:e4"
- run:
name: Add GitHub to known hosts
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
- run:
name: Deploy to GitHub pages
# Version pinned to 3.0.0 because of https://github.com/tschaub/gh-pages/issues/354
command: npx gh-pages@3.0.0 --message "Update docs [skip ci]" --dist docs_deployment --user "CI deployment <ci@cosmwasm.com>" --repo "git@github.com:cosmos/cosmjs.git"
lint:
docker:
- image: circleci/node:10-buster
steps:
- checkout
- attach_workspace:
at: /tmp/builds
- run:
name: Merge build folders into project (merge with hardlinks)
command: cp --recursive --link /tmp/builds/* .
- run:
name: Install shfmt
command: |
sudo wget https://github.com/mvdan/sh/releases/download/v3.2.1/shfmt_v3.2.1_linux_amd64 -O /usr/local/bin/shfmt
sudo chmod +x /usr/local/bin/shfmt
shfmt --version
- run:
name: Version information
command: echo "node $(node --version)"; echo "yarn $(yarn --version)"
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install libusb
command: sudo apt-get install libusb-1.0-0-dev
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Lint
command: yarn lint
- run:
name: Format text
command: yarn format-text
- run:
name: Format shell scripts
command: yarn format-shell
- run:
name: Check for clean workspace
command: |
SOURCE_CHANGES=$(git status --porcelain)
if [[ -n "$SOURCE_CHANGES" ]]; then
echo "Error: repository contains changes."
echo "Showing 'git status' and 'git diff' for debugging now:"
git status
git --no-pager diff
exit 1
fi