Skip to content

Commit

Permalink
Move to Cargo workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspustina committed Jan 4, 2019
1 parent 6c5a1b4 commit bdf96f8
Show file tree
Hide file tree
Showing 7 changed files with 2,340 additions and 84 deletions.
47 changes: 47 additions & 0 deletions .includes/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
DOCKER_BUILD_IMAGE = ekidd/rust-musl-builder:stable

all: local

local:
cargo check
cargo build
cargo test

todos:
rg --vimgrep -g '!Makefile' -i todo

RUN_DOCKER = docker run --rm -it -v "$$(pwd)/..":/home/rust/src -v "$$(pwd)/.cargo.cache/git":/home/rust/.cargo/git -v "$$(pwd)/.cargo.cache/registry":/home/rust/.cargo/registry $(DOCKER_BUILD_IMAGE)

.cargo.cache/git:
mkdir -p $@
#docker run --rm -it -v "$$(pwd)/..":/home/rust/src -v "$$(pwd)/.cargo.cache/git":/home/rust/.cargo/git $(DOCKER_BUILD_IMAGE) sudo chown -R rust:rust /home/rust/.cargo/git
$(RUN_DOCKER) sudo chown -R rust:rust /home/rust/.cargo/git

.cargo.cache/registry:
mkdir -p $@
$(RUN_DOCKER) sudo chown -R rust:rust /home/rust/.cargo/registry

cross_compile: ../target/x86_64-unknown-linux-musl/release/$(FUNC_NAME_BIN)
../target/x86_64-unknown-linux-musl/release/$(FUNC_NAME_BIN): .cargo.cache/git .cargo.cache/registry
$(RUN_DOCKER) cargo test --package $(FUNC_NAME) --release
$(RUN_DOCKER) cargo build --package $(FUNC_NAME) --release


upgrade: upgrade-docker-images

upgrade-docker-images:
docker pull $(DOCKER_BUILD_IMAGE)


clean: clean-local clean-cross
clean-local:
cargo clean

clean-cross:
$(RUN_DOCKER) cargo clean

clean-cross-me:
$(RUN_DOCKER) cargo clean --package $(FUNC_NAME)
rm target/x86_64-unknown-linux-musl/release/$(FUNC_NAME_BIN)


64 changes: 28 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,33 @@ before_install: |
echo "+++ Preparing Docker: done."
fi
script: |
BASE_DIR=$(pwd)
for function in $FUNCTIONS; do
cd $BASE_DIR/$function
echo "+++ Building with $TRAVIS_RUST_VERSION"
cargo test --verbose --all
echo "+++ Building with $TRAVIS_RUST_VERSION: done."
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "+++ Building static musl version with $TRAVIS_RUST_VERSION" &&
docker run --rm -it -v "$(pwd)":/home/rust/src -v "$BASE_DIR/.cargo.cache/git":/home/rust/.cargo/git -v "$BASE_DIR/.cargo.cache/registry":/home/rust/.cargo/registry ekidd/rust-musl-builder:$TRAVIS_RUST_VERSION sudo chown -R rust:rust /home/rust/src/target &&
docker run --rm -it -v "$(pwd)":/home/rust/src -v "$BASE_DIR/.cargo.cache/git":/home/rust/.cargo/git -v "$BASE_DIR/.cargo.cache/registry":/home/rust/.cargo/registry ekidd/rust-musl-builder:$TRAVIS_RUST_VERSION cargo test --verbose --all &&
echo "+++ Building static musl version with $TRAVIS_RUST_VERSION: done."
fi
done
cd $BASE_DIR
echo "+++ Building with $TRAVIS_RUST_VERSION"
cargo test --verbose --all
echo "+++ Building with $TRAVIS_RUST_VERSION: done."
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "+++ Building static musl versions with $TRAVIS_RUST_VERSION" &&
docker run --rm -it -v "$(pwd)":/home/rust/src -v "$BASE_DIR/.cargo.cache/git":/home/rust/.cargo/git -v "$BASE_DIR/.cargo.cache/registry":/home/rust/.cargo/registry ekidd/rust-musl-builder:$TRAVIS_RUST_VERSION sudo chown -R rust:rust /home/rust/src/target &&
docker run --rm -it -v "$(pwd)":/home/rust/src -v "$BASE_DIR/.cargo.cache/git":/home/rust/.cargo/git -v "$BASE_DIR/.cargo.cache/registry":/home/rust/.cargo/registry ekidd/rust-musl-builder:$TRAVIS_RUST_VERSION cargo test --verbose --all &&
echo "+++ Building static musl version with $TRAVIS_RUST_VERSION: done."
fi
after_success: |
BASE_DIR=$(pwd)
for function in $FUNCTIONS; do
cd $BASE_DIR/$function
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CODECOV" ]]; then
echo "+++ Checking code coverage" &&
wget https:/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz &&
cd kcov-master &&
mkdir build &&
cd build &&
cmake .. &&
make &&
make install DESTDIR=../../kcov-build &&
cd ../.. &&
rm -rf kcov-master &&
for file in target/debug/$(echo ${function} | sed '-' '_')-*[^\.d]; do mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done &&
bash <(curl -s https://codecov.io/bash) &&
echo "Uploaded code coverage." &&
echo "+++ Checking code coverage: done."
fi
done
cd $BASE_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CODECOV" ]]; then
echo "+++ Checking code coverage" &&
wget https:/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz &&
cd kcov-master &&
mkdir build &&
cd build &&
cmake .. &&
make &&
make install DESTDIR=../../kcov-build &&
cd ../.. &&
rm -rf kcov-master &&
for function in $FUNCTIONS; do
for file in target/debug/$(echo ${function} | sed '-' '_')-*[^\.d]; do mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done
done &&
bash <(curl -s https://codecov.io/bash) &&
echo "Uploaded code coverage." &&
echo "+++ Checking code coverage: done."
fi
Loading

0 comments on commit bdf96f8

Please sign in to comment.