ffsend/.travis.yml
Tim Visée 7eb44a9780
Configure Linux & macOS multi-arch releases using Travis CI (#3)
* Test multi arch Travis CI build configuration

* Enable Docker as required for cross compilation

* Use even more arhitecture targets when building

* Disable BSD builds, install ARM cross compiler dependencies

* Fix invalid ARM target tuple

* Use regular cargo commands for x86_64 Linux

* Fix invalid ARM target tuples

* Configure multi-platform releases using Travis CI, move from test builds

* Enable caching for all Linux x86_64 stable builds on Travis CI

* Merge Linux x86_64, macOS and other build arch logic with an if-statement

* Add missing arch architecture release configuration

* Enable cache on all CI jobs, with platform/arch/version cache separation

* Don't explicitly set cache name, it's automatically inferred
2018-05-30 10:34:45 -05:00

142 lines
3.9 KiB
YAML

# Configuration for Travis CI
language: rust
sudo: required
services:
- docker
addons:
apt:
packages:
- libssl-dev
stages:
- build
- test
- name: release
if: tag =~ ^v(\d+\.)*\d+$
jobs:
include:
################################
# Build stage #
################################
# Linux with Rust stable/beta/nightly
- stage: build
rust: stable
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
script: &build-script
- cargo build --verbose --all
- cargo build --no-default-features --verbose --all
- cargo build --features no-color --verbose --all
- stage: build
rust: beta
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
script: *build-script
- stage: build
rust: nightly
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
script: *build-script
# macOS with Rust stable
- stage: build
rust: stable
os: osx
env: TARGET=x86_64-apple-darwin
cache: cargo
script: *build-script
################################
# Test stage #
################################
- stage: test
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
script: cargo test --verbose --all
################################
# Release stage #
################################
# Cargo crate release
- stage: release
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
script:
- echo $CARGO_TOKEN | cargo login
- cargo publish --verbose
# GitHub binary release for Linux on x86/x86_64
- stage: release
rust: stable
env: TARGET=x86_64-unknown-linux-gnu
cache: cargo
script: &script-github-release
- |
if [ $TARGET == "x86_64-unknown-linux-gnu" ] || [ $TARGET == "x86_64-apple-darwin" ]; then
cargo build --release --verbose --all
else
echo 'Starting build using cross for cross compilation...'
cross build --target $TARGET --release --verbose --all
fi
- cd target/release
- tar -czvf $TRAVIS_BUILD_DIR/ffsend-$TARGET.tar.gz ffsend
- cd $TRAVIS_BUILD_DIR
deploy: &deploy-github-release
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
skip_cleanup: true
overwrite: false
file: ffsend-$TARGET.tar.gz
on:
tags: true
branch: master
- stage: release
rust: stable
env: TARGET=i686-unknown-linux-gnu
cache: cargo
install: &install-github-release-cross
- cargo install cross
script: *script-github-release
deploy: *deploy-github-release
# GitHub binary release for Linux on arch
- stage: release
rust: stable
env: TARGET=aarch64-unknown-linux-gnu
cache: cargo
install: *install-github-release-cross
script: *script-github-release
deploy: *deploy-github-release
- stage: release
rust: stable
env: TARGET=arm-unknown-linux-gnueabi
cache: cargo
install: *install-github-release-cross
script: *script-github-release
deploy: *deploy-github-release
- stage: release
rust: stable
env: TARGET=armv7-unknown-linux-gnueabihf
cache: cargo
install: *install-github-release-cross
script: *script-github-release
deploy: *deploy-github-release
# GitHub binary release for macOX
- stage: release
rust: stable
os: osx
env: TARGET=x86_64-apple-darwin
cache: cargo
script: *script-github-release
deploy: *deploy-github-release
# TODO: add (Free)BSD architecture
# TODO: use regular cargo commands for x86_64 linux
# TODO: release a build for each architecture
# TODO: enfore the git tag/crate version equality for releases
# TODO: disable addons/rust installation for GitHub release job