Skip to content

Commit

Permalink
Merge pull request #52 from CosmWasm/ci-build-release
Browse files Browse the repository at this point in the history
Add a release step to the ci
  • Loading branch information
webmaster128 authored Mar 11, 2020
2 parents e84678f + 0907a78 commit a3309c2
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 19 deletions.
27 changes: 27 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
root: ./api
paths:
- libgo_cosmwasm.so

test:
working_directory: /go/src/github.com/confio/go-cosmwasm
docker:
Expand All @@ -27,6 +28,23 @@ jobs:
- run: make test
- run: make build-go

release:
machine:
image: ubuntu-1604:201903-01
steps:
- add_ssh_keys:
fingerprints:
- "31:de:e5:84:1b:12:81:94:aa:06:50:c0:cb:bd:79:f0"
- checkout
- run: echo $CIRCLE_BRANCH
- run: make release
- run: ls -l ./api
- run: git config user.email "[email protected]"
- run: git config user.name "CircleCI Bot"
- run: git add .
- run: git commit --allow-empty -m '[skip ci] Built release libraries'
- run: git push origin $CIRCLE_BRANCH

workflows:
version: 2
build_and_test:
Expand All @@ -35,3 +53,12 @@ workflows:
- test:
requires:
- build
# release only on master, not on tags (auto-build on merge PR)
- release:
filters:
tags:
ignore:
- /.*/
branches:
only:
- master
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.7.0"
authors = ["Ethan Frey <[email protected]>"]
edition = "2018"
description = "Go bindings for cosmwasm contracts"
repository = "https://github.com/confio/go-cosmwasm"
repository = "https://github.com/CosmWasm/go-cosmwasm"
license = "Apache-2.0"
readme = "README.md"
exclude = [".circleci/*", ".gitignore"]
Expand All @@ -14,7 +14,7 @@ crate-type = ["cdylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[badges]
circle-ci = { repository = "confio/go-cosmwasm", branch = "master" }
circle-ci = { repository = "CosmWasm/go-cosmwasm", branch = "master" }
maintenance = { status = "actively-developed" }

[features]
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ ENV RUSTUP_HOME=/usr/local/rustup \
RUN url="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init"; \
wget "$url"; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --default-toolchain nightly; \
./rustup-init -y --no-modify-path --default-toolchain nightly-2020-03-05; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;


# PRE-FETCH MANY DEPS
WORKDIR /scratch
COPY Cargo.toml /scratch/
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ ENV LLVM_SYS_80_PREFIX=/usr/lib/llvm-8

WORKDIR /opt

# Add macOS Rust target
# Pin to proper nightly and add macOS Rust target
RUN rustup toolchain install nightly-2020-03-05
RUN rustup default nightly-2020-03-05
RUN rustup target add x86_64-apple-darwin

# Build osxcross
Expand Down Expand Up @@ -46,11 +48,11 @@ RUN chmod -R 777 /usr/local/cargo
WORKDIR /code
RUN rm -rf /scratch

COPY build/build_osx.sh /opt
RUN chmod +x /opt/build*
COPY build/*.sh /opt/
RUN chmod +x /opt/*.sh

RUN mkdir /.cargo
RUN chmod +rx /.cargo
COPY build/cargo-config /.cargo/config

CMD ["/opt/build_osx.sh"]
CMD ["/opt/build.sh"]
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: all build build-rust build-go test docker-image docker-build docker-image-centos7

DOCKER_TAG := 0.6.3
DOCKER_TAG := 0.7.0
USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)

Expand Down Expand Up @@ -51,12 +51,21 @@ build-go:
test:
RUST_BACKTRACE=1 go test -v ./api .

# we should build all the docker images locally ONCE and publish them
docker-image-centos7:
docker build . -t go-cosmwasm:$(DOCKER_TAG)-centos7 -f ./Dockerfile.centos7
docker build . -t cosmwasm/go-ext-builder:$(DOCKER_TAG)-centos7 -f ./Dockerfile.centos7

docker-image-cross:
docker build . -t go-cosmwasm:$(DOCKER_TAG)-cross -f ./Dockerfile.cross
docker build . -t cosmwasm/go-ext-builder:$(DOCKER_TAG)-cross -f ./Dockerfile.cross

release: docker-image-cross docker-image-centos7
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code go-cosmwasm:$(DOCKER_TAG)-cross
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code go-cosmwasm:$(DOCKER_TAG)-centos7
# docker-images: docker-image-centos7 docker-image-cross
docker-images: docker-image-cross

docker-publish: docker-images
docker push cosmwasm/go-ext-builder:$(DOCKER_TAG)-cross
# docker push cosmwasm/go-ext-builder:$(DOCKER_TAG)-centos7

# and use them to compile release builds
release:
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code cosmwasm/go-ext-builder:$(DOCKER_TAG)-cross
# docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code cosmwasm/go-ext-builder:$(DOCKER_TAG)-centos7
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Go-CosmWasm

This provides go bindings to the [cosmwasm](https://github.com/confio/cosmwasm) smart
This provides go bindings to the [CosmWasm](https://github.com/CosmWasm/cosmwasm) smart
contract framework. In particular, it allows you to easily compile, initialize,
and execute these contracts from Go.

As of the 0.6.0 release, we support [cosmwasm](https://github.com/confio/cosmwasm) 0.6.3
As of the 0.7.0 release, we support [CosmWasm](https://github.com/CosmWasm/cosmwasm) 0.7.0
and any compatible smart contracts.

## Structure
Expand All @@ -23,8 +23,12 @@ but need to be on a system that works with an existing dll. Currently this is Li
but it is not supported by the wasmer singlepass backend which we rely upon for gas
metering.

*Note: CentOS support is currently disabled due to work on CD tooling. We require Linux with glibc 2.18+*

*Note: Windows is not supported currently*

*Note: We only currently support i686/amd64 architectures, although AMD support is an open issue*

## Design

Please read the [Documentation](./spec/Index.md) to understand both the general
Expand All @@ -46,5 +50,5 @@ with a PR (on your fork). We will set up a proper CI system for building these b
but we are not there yet.

To build the rust side, try `make build-rust` and wait for it to compile. This depends on
`cargo` being installed with `rustc` version 1.37+. Generally, you can just use `rustup` to
`cargo` being installed with `rustc` version 1.39+. Generally, you can just use `rustup` to
install all this with no problems.
4 changes: 2 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ can do the cross-compilation.

## Usage

`make docker-image` will create a local docker image, capable of cross-compling linux and macos dynamic libs.
`make docker-images` will create a local docker image, capable of cross-compling linux and macos dynamic libs.

`make docker-build` will use the above docker image and copy the generated `{so,dylib}` files into `api` directory to be linked.
`make release` will use the above docker image and copy the generated `{so,dylib}` files into `api` directory to be linked.

## Future Work

Expand Down

0 comments on commit a3309c2

Please sign in to comment.