Skip to content

Commit

Permalink
Setup cw-gitpod-base docker hub CI push (#80)
Browse files Browse the repository at this point in the history
* 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 fe0ecd2.
  • Loading branch information
orkunkl authored Aug 31, 2021
1 parent 4283fcc commit caee82a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 46 deletions.
95 changes: 52 additions & 43 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
image:
file: .gitpod.Dockerfile
image: cosmwasm/cw-gitpod-base:v0.16

vscode:
extensions:
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit caee82a

Please sign in to comment.