From caee82a762e2c77f0738906f5eb72556c60a2af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orkun=20K=C3=BCl=C3=A7e?= Date: Tue, 31 Aug 2021 17:38:37 +0300 Subject: [PATCH] Setup cw-gitpod-base docker hub CI push (#80) * Setup cw-gitpod-base docker hub ci push * Change gitpod docker image * Add readme details * Reformat circle yaml * Fix cw-gitpod-base version * Make gitpod version v0.16 * Setup testnet environment variable * Revert "Setup testnet environment variable" This reverts commit fe0ecd2dcba4238605ba41a5a39a04c4124d99c7. --- .circleci/config.yml | 95 ++++++++++++++++++++++++-------------------- .gitpod.yml | 3 +- README.md | 9 ++++- 3 files changed, 61 insertions(+), 46 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 41b177a..9b07669 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,52 +1,61 @@ version: 2.1 -jobs: - build: +executors: + builder: docker: - - image: rust:1.53.0 + - image: buildpack-deps:trusty + +jobs: + docker-image: + executor: builder steps: - checkout + - setup_remote_docker + docker_layer_caching: true - run: - name: Version information - command: rustc --version; cargo --version; rustup --version - - restore_cache: - keys: - - v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} - - run: - name: Add wasm32 target - command: rustup target add wasm32-unknown-unknown - - run: - name: Add cargo fmt - command: rustup component add rustfmt - - run: - name: Unit tests - env: RUST_BACKTRACE=1 - command: cargo unit-test --locked - - run: - name: Build - command: cargo wasm --locked - - run: - name: Format source code - command: cargo fmt + name: Build Docker artifact + command: docker build --pull -t "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" . - run: - name: Build and run schema generator - command: cargo schema --locked - - run: - name: Ensure checked-in source code and schemas are up-to-date + name: Push application Docker image to docker hub command: | - CHANGES_IN_REPO=$(git status --porcelain) - if [[ -n "$CHANGES_IN_REPO" ]]; then - echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" - git status && git --no-pager diff - exit 1 + if [ "${CIRCLE_BRANCH}" = "master" ]; then + docker tag "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" cosmwasm/cw-gitpod-base:latest + docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS" + docker push cosmwasm/cw-gitpod-base:latest + docker logout fi - - save_cache: - paths: - - /usr/local/cargo/registry - - target/debug/.fingerprint - - target/debug/build - - target/debug/deps - - target/wasm32-unknown-unknown/release/.fingerprint - - target/wasm32-unknown-unknown/release/build - - target/wasm32-unknown-unknown/release/deps - key: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} + + docker-tagged: + executor: builder + steps: + - checkout + - setup_remote_docker + docker_layer_caching: true + - run: + name: Push application Docker image to docker hub + command: | + docker tag "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" "cosmwasm/cw-gitpod-base:${CIRCLE_TAG}" + docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS" + docker push + docker logout + +workflows: + version: 2 + test-suite: + jobs: + # this is now a slow process... let's only run on master + - docker-image: + filters: + branches: + only: + - master + - docker-tagged: + filters: + tags: + only: + - /^v.*/ + branches: + ignore: + - /.*/ + requires: + - docker-image diff --git a/.gitpod.yml b/.gitpod.yml index 0d9d4d0..d03610c 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,4 @@ -image: - file: .gitpod.Dockerfile +image: cosmwasm/cw-gitpod-base:v0.16 vscode: extensions: diff --git a/README.md b/README.md index 8aedec2..4baf6d9 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,11 @@ proper description in the README. ## Gitpod integration [Gitpod](https://www.gitpod.io/) container-based development platform will be enabled on your project by default. -Follow [Gitpod Getting Started](https://www.gitpod.io/docs/getting-started) launch your workspace. + +Workspace contains: + - **rust**: for builds + - [wasmd](https://github.com/CosmWasm/wasmd): for local node setup and client + - **jq**: shell JSON manipulation tool + +Follow [Gitpod Getting Started](https://www.gitpod.io/docs/getting-started) and launch your workspace. +