2018-06-04 23:06:12 +00:00
|
|
|
image: "rust:slim"
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- check
|
|
|
|
- test
|
|
|
|
- integration
|
|
|
|
- release
|
|
|
|
|
|
|
|
variables:
|
|
|
|
RUST_VERSION: stable
|
|
|
|
|
|
|
|
# Cargo artifacts caching per Rust version
|
|
|
|
cache:
|
|
|
|
key: "$RUST_VERSION"
|
|
|
|
paths:
|
2018-06-18 19:53:38 +02:00
|
|
|
- /usr/local/rustup/*
|
|
|
|
- /usr/local/cargo/*
|
2018-06-04 23:06:12 +00:00
|
|
|
- target/
|
|
|
|
|
|
|
|
# Install compiler and OpenSSL dependencies
|
|
|
|
before_script:
|
|
|
|
- apt-get update -y
|
|
|
|
- apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev
|
|
|
|
- rustup install $RUST_VERSION && rustup default $RUST_VERSION
|
|
|
|
- rustc --version && cargo --version
|
|
|
|
|
2018-06-18 19:20:55 +02:00
|
|
|
# Variable defaults
|
|
|
|
variables:
|
|
|
|
RUST_VERSION: stable
|
|
|
|
CI_COMMIT_TAG: 0.0.0
|
|
|
|
|
2018-06-04 23:06:12 +00:00
|
|
|
# Check on stable, beta and nightly
|
|
|
|
.check-base: &check-base
|
|
|
|
stage: check
|
|
|
|
script:
|
|
|
|
- cargo check --all --verbose
|
|
|
|
- cargo check --no-default-features --all --verbose
|
|
|
|
- cargo check --features no-color --all --verbose
|
|
|
|
check-stable:
|
|
|
|
<<: *check-base
|
|
|
|
check-beta:
|
|
|
|
<<: *check-base
|
|
|
|
variables:
|
|
|
|
RUST_VERSION: beta
|
|
|
|
check-nightly:
|
|
|
|
<<: *check-base
|
|
|
|
variables:
|
|
|
|
RUST_VERSION: nightly
|
|
|
|
|
2018-06-18 18:54:14 +02:00
|
|
|
# Run the unit tests through Cargo
|
|
|
|
test-cargo:
|
2018-06-04 23:06:12 +00:00
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- cargo test --all --verbose
|
|
|
|
|
|
|
|
# Run integration test with the public Send service
|
2018-06-18 18:54:14 +02:00
|
|
|
test-public-send:
|
2018-06-04 23:06:12 +00:00
|
|
|
stage: integration
|
|
|
|
script:
|
|
|
|
- cargo build
|
|
|
|
- head -c 1M </dev/urandom >testfile
|
|
|
|
- cargo run -- upload testfile -n testfile.bin -a -d 10 -p secret -I
|
|
|
|
# TODO: download this file, compare checksums
|
2018-06-18 19:20:55 +02:00
|
|
|
|
|
|
|
# TODO: only build releases when running CI for version tags
|
|
|
|
|
|
|
|
# Cargo crate release
|
2018-06-18 19:53:38 +02:00
|
|
|
crate:
|
2018-06-18 19:20:55 +02:00
|
|
|
stage: release
|
|
|
|
variables:
|
|
|
|
TARGET: x86_64-unknown-linux-gnu
|
|
|
|
script:
|
|
|
|
- echo "Creating release crate on crates.io..."
|
|
|
|
- echo $CARGO_TOKEN | cargo login
|
|
|
|
# TODO: enable after the test succeeds
|
|
|
|
# - cargo publish --verbose
|
|
|
|
|
|
|
|
# GitHub binary release for Linux on x86/x86_64
|
|
|
|
bin-linux-x64:
|
|
|
|
stage: release
|
2018-06-18 19:53:38 +02:00
|
|
|
image: docker:stable
|
2018-06-18 19:20:55 +02:00
|
|
|
variables:
|
|
|
|
TARGET: x86_64-unknown-linux-gnu
|
|
|
|
TARGET_SIMPLE: linux-x64
|
|
|
|
DEB: y
|
2018-06-18 19:53:38 +02:00
|
|
|
before_script: &release-bin-before-script
|
|
|
|
- apt-get update -y
|
|
|
|
- apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev curl
|
2018-06-18 19:59:02 +02:00
|
|
|
- curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain $RUST_VERSION
|
2018-06-18 19:53:38 +02:00
|
|
|
- export PATH=/usr/local/cargo/bin:$PATH
|
|
|
|
- export RUSTUP_HOME=/usr/local/rustup
|
|
|
|
- export CARGO_HOME=/usr/local/cargo
|
|
|
|
- rustc --version && cargo --version
|
2018-06-18 19:20:55 +02:00
|
|
|
script: &release-bin-script
|
|
|
|
- echo Install release dependencies
|
|
|
|
- |
|
|
|
|
if [ ! $TARGET == "x86_64-unknown-linux-gnu" ]; then
|
|
|
|
cargo install cross
|
|
|
|
fi
|
|
|
|
- |
|
|
|
|
if [ -n "$DEB" ]; then
|
|
|
|
cargo install cargo-deb
|
|
|
|
fi
|
|
|
|
- echo Build release
|
|
|
|
- |
|
|
|
|
if [ $TARGET == "x86_64-unknown-linux-gnu" ]; then
|
|
|
|
echo "Creating release binary on GitHub for $TARGET..."
|
|
|
|
cargo build --release --verbose --all
|
|
|
|
cp target/release/ffsend ./ffsend
|
|
|
|
else
|
|
|
|
echo "Creating release binary on GitHub for $TARGET (cross compiled)..."
|
|
|
|
cross build --target $TARGET --release --verbose --all
|
|
|
|
cp target/$TARGET/release/ffsend ./ffsend
|
|
|
|
fi
|
|
|
|
- tar -czvf ./ffsend-$CI_COMMIT_TAG-$TARGET_SIMPLE.tar.gz ffsend
|
|
|
|
- |
|
|
|
|
if [ -n "$DEB" ]; then
|
|
|
|
cargo deb --verbose
|
|
|
|
fi
|
|
|
|
- mv ./ffsend ./ffsend-$CI_COMMIT_TAG-$TARGET_SIMPLE
|
|
|
|
# TODO: this is in Travis CI style, convert this to GitLab CI
|
|
|
|
# deploy: &deploy-github-release
|
|
|
|
# provider: releases
|
|
|
|
# api_key: $GITHUB_OAUTH_TOKEN
|
|
|
|
# skip_cleanup: true
|
|
|
|
# overwrite: true
|
|
|
|
# file_glob: true
|
|
|
|
# file:
|
|
|
|
# - target/debian/ffsend_*.deb
|
|
|
|
# - ffsend-$CI_COMMIT_TAG-$TARGET_SIMPLE.tar.gz
|
|
|
|
# - ffsend-$CI_COMMIT_TAG-$TARGET_SIMPLE
|
|
|
|
# on:
|
|
|
|
# tags: true
|
|
|
|
# branch: master
|
|
|
|
|
|
|
|
bin-linux-i368:
|
|
|
|
stage: release
|
2018-06-18 19:53:38 +02:00
|
|
|
image: docker:stable
|
2018-06-18 19:20:55 +02:00
|
|
|
variables:
|
|
|
|
TARGET: i686-unknown-linux-gnu
|
|
|
|
TARGET_SIMPLE: linux-i386
|
|
|
|
DEB: y
|
2018-06-18 19:53:38 +02:00
|
|
|
before_script: *release-bin-before-script
|
2018-06-18 19:20:55 +02:00
|
|
|
script: *release-bin-script
|
|
|
|
# deploy: *deploy-github-release
|
|
|
|
|
|
|
|
# GitHub binary release for Linux on arch
|
|
|
|
bin-linux-aarch64:
|
|
|
|
stage: release
|
2018-06-18 19:53:38 +02:00
|
|
|
image: docker:stable
|
2018-06-18 19:20:55 +02:00
|
|
|
variables:
|
|
|
|
TARGET: aarch64-unknown-linux-gnu
|
|
|
|
TARGET_SIMPLE: linux-aarch64
|
2018-06-18 19:53:38 +02:00
|
|
|
before_script: *release-bin-before-script
|
2018-06-18 19:20:55 +02:00
|
|
|
script: *release-bin-script
|
|
|
|
# deploy: *deploy-github-release
|
|
|
|
|
|
|
|
bin-linux-arm:
|
|
|
|
stage: release
|
2018-06-18 19:53:38 +02:00
|
|
|
image: docker:stable
|
2018-06-18 19:20:55 +02:00
|
|
|
variables:
|
|
|
|
TARGET: arm-unknown-linux-gnueabi
|
|
|
|
TARGET_SIMPLE: linux-arm
|
2018-06-18 19:53:38 +02:00
|
|
|
before_script: *release-bin-before-script
|
2018-06-18 19:20:55 +02:00
|
|
|
script: *release-bin-script
|
|
|
|
# deploy: *deploy-github-release
|
|
|
|
|
|
|
|
bin-linux-armv7:
|
|
|
|
stage: release
|
2018-06-18 19:53:38 +02:00
|
|
|
image: docker:stable
|
2018-06-18 19:20:55 +02:00
|
|
|
variables:
|
|
|
|
TARGET: armv7-unknown-linux-gnueabihf
|
|
|
|
TARGET_SIMPLE: linux-armv7
|
2018-06-18 19:53:38 +02:00
|
|
|
before_script: *release-bin-before-script
|
2018-06-18 19:20:55 +02:00
|
|
|
script: *release-bin-script
|
|
|
|
# deploy: *deploy-github-release
|
|
|
|
|
|
|
|
# GitHub binary release for macOX
|
|
|
|
bin-osx-x64:
|
|
|
|
stage: release
|
2018-06-18 19:53:38 +02:00
|
|
|
image: docker:stable
|
2018-06-18 19:20:55 +02:00
|
|
|
variables:
|
|
|
|
TARGET: x86_64-apple-darwin
|
|
|
|
TARGET_SIMPLE: osx-x64
|
2018-06-18 19:53:38 +02:00
|
|
|
before_script: *release-bin-before-script
|
2018-06-18 19:20:55 +02:00
|
|
|
script: *release-bin-script
|
|
|
|
# deploy: *deploy-github-release
|