Skip to content

Commit

Permalink
Refactor and improve
Browse files Browse the repository at this point in the history
  • Loading branch information
orkunkl committed Oct 24, 2022
1 parent 5b6c0a6 commit 591bd52
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 401 deletions.
6 changes: 4 additions & 2 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm = "build --release --lib --target wasm32-unknown-unknown"
wasm-debug = "build --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
integration-test = "test --test integration"
schema = "run --bin schema"
92 changes: 40 additions & 52 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,49 @@
version: 2.1

executors:
builder:
docker:
- image: buildpack-deps:trusty

jobs:
docker-image:
executor: builder
build:
docker:
- image: rust:1.64.0
steps:
- checkout
- setup_remote_docker
docker_layer_caching: true
- run:
name: Build Docker artifact
command: docker build --pull -t "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" .
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Push application Docker image to docker hub
command: |
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
docker-tagged:
executor: builder
steps:
- checkout
- setup_remote_docker
docker_layer_caching: true
name: Add wasm32 target
command: rustup target add wasm32-unknown-unknown
- 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
- run:
name: Push application Docker image to docker hub
name: Build and run schema generator
command: cargo schema --locked
- run:
name: Ensure checked-in source code and schemas are up-to-date
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
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
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" }}
Loading

0 comments on commit 591bd52

Please sign in to comment.