version: 2 jobs: # Job used for testing lint: docker: - image: circleci/rust:latest steps: - checkout - restore_cache: keys: - v5-lint-{{ arch }}-{{ checksum "Cargo.lock" }} - run: name: Install dependencies command: | sudo apt-get install -y cmake # sudo apt-get install texinfo # sudo apt-get install libclang-dev llvm-3.9-dev libclang-3.9-dev clang-3.9 - run: name: Install lint deps command: | rustup component add rustfmt rustup component add clippy - run: name: Execute lints command: make lint - save_cache: paths: - /usr/local/cargo/registry - target/debug/.fingerprint - target/debug/build - target/debug/deps key: v5-lint-{{ arch }}-{{ checksum "Cargo.lock" }} test: docker: - image: circleci/rust:latest steps: - checkout - restore_cache: keys: - v5-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} - run: name: Install dependencies command: | sudo apt-get install -y cmake # sudo apt-get install texinfo # sudo apt-get install libclang-dev llvm-3.9-dev libclang-3.9-dev clang-3.9 - run: make test - save_cache: paths: - /usr/local/cargo/registry - target/debug/.fingerprint - target/debug/build - target/debug/deps key: v5-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} test-macos: macos: xcode: "9.0" steps: - checkout - restore_cache: keys: - v5-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }} - v5-cargo-cache-darwin-{{ arch }}-brew - run: name: Update Brew command: brew update || true - run: name: Install crate dependencies command: | brew install cmake # brew install libtool || true # brew install autoconf cmake libffi || true - save_cache: paths: - /usr/local/Homebrew key: v5-cargo-cache-darwin-{{ arch }}-brew - run: name: Install Rust command: | curl https://sh.rustup.rs -sSf | sh -s -- -y export PATH="$HOME/.cargo/bin:$PATH" cargo --version - run: name: Execute tests command: | export PATH="$HOME/.cargo/bin:$PATH" # We increase the ulimit for fixing cargo unclosed files in mac ulimit -n 8000 sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680 make test - run: name: Execute integration tests command: | export PATH="$HOME/.cargo/bin:$PATH" make integration-tests - save_cache: paths: - /usr/local/cargo/registry - target/debug/.fingerprint - target/debug/build - target/debug/deps - target/release/.fingerprint - target/release/build - target/release/deps key: v5-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }} test-and-build: docker: - image: circleci/rust:latest steps: - checkout - restore_cache: keys: - v5-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} - run: name: Install dependencies command: | sudo apt-get install -y cmake # sudo apt-get install texinfo # sudo apt-get install libclang-dev llvm-3.9-dev libclang-3.9-dev clang-3.9 - run: name: Execute tests command: make test - run: name: Make release build command: | make release mkdir -p artifacts VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2) # GIT_VERSION=$(git describe --exact-match --tags) echo "${VERSION}" >> artifacts/version echo "${CIRCLE_TAG}" >> artifacts/git_version cp ./target/release/wasmer ./artifacts/$(./binary-name.sh) - persist_to_workspace: root: . paths: - artifacts - save_cache: paths: - /usr/local/cargo/registry - target/debug/.fingerprint - target/debug/build - target/debug/deps - target/release/.fingerprint - target/release/build - target/release/deps - /usr/local/Homebrew key: v5-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} test-and-build-macos: macos: xcode: "9.0" steps: - checkout - restore_cache: keys: - v5-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }} - v5-cargo-cache-darwin-{{ arch }}-brew - run: name: Update Brew command: brew update || true - run: name: Install crate dependencies command: | brew install cmake # brew install libtool || true # brew install autoconf cmake libffi || true - save_cache: paths: - /usr/local/Homebrew key: v5-cargo-cache-darwin-{{ arch }}-brew - run: name: Install Rust command: | curl https://sh.rustup.rs -sSf | sh -s -- -y export PATH="$HOME/.cargo/bin:$PATH" cargo --version - run: name: Execute tests command: | export PATH="$HOME/.cargo/bin:$PATH" # We increase the ulimit for fixing cargo unclosed files in mac ulimit -n 8000 sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680 make test - run: name: Make release build command: | export PATH="$HOME/.cargo/bin:$PATH" make release mkdir -p artifacts # VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2) # echo "${VERSION}" >> artifacts/version cp ./target/release/wasmer ./artifacts/$(./binary-name.sh) - persist_to_workspace: root: . paths: - artifacts - save_cache: paths: - /usr/local/cargo/registry - target/debug/.fingerprint - target/debug/build - target/debug/deps - target/release/.fingerprint - target/release/build - target/release/deps key: v5-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }} test-rust-nightly: docker: - image: circleci/rust:latest steps: - checkout - restore_cache: keys: - v5-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}-nightly - run: name: Install dependencies command: | sudo apt-get install -y cmake # sudo apt-get install texinfo # sudo apt-get install libclang-dev llvm-3.9-dev libclang-3.9-dev clang-3.9 - run: rustup default nightly - run: make test - save_cache: paths: - /usr/local/cargo/registry - target/debug/.fingerprint - target/debug/build - target/debug/deps key: v5-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}-nightly publish-github-release: docker: - image: cibuilds/github steps: - attach_workspace: at: . - run: name: "Publish Release on GitHub" command: | # go get github.com/tcnksm/ghr # VERSION=$(git log -1 --pretty=%B) # VERSION=$(./artifacts/ --version) VERSION=$(cat ./artifacts/version) # VERSION_TAG=${CIRCLE_TAG} VERSION_TAG=$(cat ./artifacts/git_version) rm ./artifacts/version rm ./artifacts/git_version # VERSION_TAG=$(git describe --exact-match --tags) #if [ "$VERSION" == "$VERSION_TAG" ]; then # echo "Versions match, publishing to Github" ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -soft ${VERSION} ./artifacts/ #else # echo "Versions don't match. Wasmer output version (wasmer --version) is ${VERSION} while Git tag is ${VERSION_TAG}" # exit 1 #fi workflows: version: 2 main: jobs: - lint - test: filters: branches: ignore: master - test-macos: filters: branches: ignore: master - test-and-build: filters: branches: only: master - test-and-build-macos: filters: branches: only: master - test-rust-nightly: filters: branches: only: master - publish-github-release: requires: - lint - test-and-build - test-and-build-macos filters: branches: only: master