wasmer/.circleci/config.yml

125 lines
3.7 KiB
YAML
Raw Normal View History

2018-11-05 17:03:09 +00:00
version: 2
jobs:
build:
docker:
- image: circleci/rust:latest
2018-11-05 17:03:09 +00:00
steps:
- checkout
- restore_cache:
keys:
2018-11-13 19:36:04 +00:00
- v4-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
2018-11-05 17:12:59 +00:00
- run: sudo apt-get install -y cmake
2018-11-06 11:20:08 +00:00
- run: make test
2018-11-13 18:28:50 +00:00
- run:
command: |
make release
mkdir -p artifacts
2018-11-13 18:51:04 +00:00
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "${VERSION}" >> artifacts/version
2018-11-13 18:28:50 +00:00
cp ./target/release/wasmer ./artifacts/$(./binary-name.sh)
- persist_to_workspace:
root: .
paths:
- artifacts
2018-11-05 17:03:09 +00:00
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
2018-11-13 19:36:04 +00:00
- target/release/.fingerprint
2018-11-13 18:28:50 +00:00
- target/release/build
- target/release/deps
2018-11-13 19:36:04 +00:00
key: v4-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
2018-11-13 18:28:50 +00:00
2018-11-13 19:36:04 +00:00
build-macos:
macos:
xcode: "9.0"
steps:
- checkout
- restore_cache:
keys:
- v4-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Install CMAKE
command: |
2018-11-13 19:48:34 +00:00
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Darwin-x86_64.tar.gz
2018-11-13 19:36:04 +00:00
tar xf cmake-3.4.1-Darwin-x86_64.tar.gz
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
- run:
2018-11-15 21:30:00 +00:00
name: Install Rust
command: |
2018-11-15 21:30:00 +00:00
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH="$HOME/.cargo/bin:$PATH"
cargo --version
2018-11-13 19:36:04 +00:00
- run:
name: Execute tests
2018-11-13 20:12:02 +00:00
command: |
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
make test
- run:
name: Make build
2018-11-13 19:36:04 +00:00
command: |
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
2018-11-13 19:36:04 +00:00
make release
mkdir -p artifacts
2018-11-13 20:12:02 +00:00
# VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
# echo "${VERSION}" >> artifacts/version
2018-11-13 19:36:04 +00:00
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: v4-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}
2018-11-13 18:28:50 +00:00
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)
2018-11-13 18:51:04 +00:00
VERSION=$(cat ./artifacts/version)
rm ./artifacts/version
2018-11-13 18:28:50 +00:00
# VERSION=${CIRCLE_TAG}
# VERSION=$(./artifacts/ --version)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/
workflows:
version: 2
main:
jobs:
- build
2018-11-13 19:36:04 +00:00
- build-macos
2018-11-13 18:28:50 +00:00
# :
# filters:
# tags:
# only: /^\d+\.\d+\.\d+$/
- publish-github-release:
requires:
- build
2018-11-13 19:36:04 +00:00
- build-macos
2018-11-13 18:28:50 +00:00
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /^\d+\.\d+\.\d+$/