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

This commit is contained in:
timvisee 2018-05-25 17:01:10 +02:00
parent 965099bc2a
commit 64c3f2e23d
No known key found for this signature in database
GPG key ID: 109CBA0BF74036C2

View file

@ -21,90 +21,112 @@ stages:
jobs:
include:
################################
# Build stage #
################################
# Linux with Rust stable/beta/nightly
- stage: build
rust: stable
env: TARGET=x86_64-unknown-linux-gnu
script: &build-script
- cargo build --verbose --all
- cargo build --no-default-features --verbose --all
- cargo build --features no-color --verbose --all
cache: cargo
- stage: build
rust: stable
env: TARGET=i686-unknown-linux-gnu
script: &build-script-cross
- cargo install cross
- cross build --target $TARGET --verbose --all
- cross build --target $TARGET --no-default-features --verbose --all
- cross build --target $TARGET --features no-color --verbose --all
- stage: build
rust: stable
env: TARGET=aarch64-unknown-linux-gnu
script: *build-script-cross
- stage: build
rust: stable
env: TARGET=arm-unknown-linux-gnueabi
script: *build-script-cross
- stage: build
rust: stable
env: TARGET=armv7-unknown-linux-gnueabihf
script: *build-script-cross
# - stage: build
# rust: stable
# env: TARGET=i686-unknown-freebsd
# script: *build-script-cross
# - stage: build
# rust: stable
# env: TARGET=x86_64-unknown-freebsd
# script: *build-script-cross
# - stage: build
# rust: stable
# env: TARGET=x86_64-unknown-netbsd
# script: *build-script-cross
- stage: build
rust: beta
env: TARGET=x86_64-unknown-linux-gnu
script: *build-script-cross
script: *build-script
- stage: build
rust: nightly
env: TARGET=x86_64-unknown-linux-gnu
script: *build-script-cross
script: *build-script
# macOS with Rust stable
- stage: build
rust: stable
os: osx
env: TARGET=x86_64-unknown-linux-gnu
script:
- cargo build --verbose --all
- cargo build --no-default-features --verbose --all
- cargo build --features no-color --verbose --all
script: *build-script
################################
# Test stage #
################################
- stage: test
script: cargo test --verbose --all
cache: cargo
- stage: release
env: TARGET=x86_64-unknown-linux-gnu
script:
- cargo install cross
- cross build --target $TARGET --release --verbose --all
- cd target/release
- tar -czvf $TRAVIS_BUILD_DIR/ffsend-linux-x86_64.tar.gz ffsend
- cd $TRAVIS_BUILD_DIR
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
skip_cleanup: true
overwrite: false
file: ffsend-x86_64-linux.tar.gz
on:
tags: true
branch: master
cache: cargo
################################
# Release stage #
################################
# Cargo crate release
- stage: release
script:
- echo $CARGO_TOKEN | cargo login
- cargo publish --verbose
cache: cargo
# TODO: add BSD architecture
# GitHub binary release for Linux on x86/x86_64
- stage: release
rust: stable
env: TARGET=x86_64-unknown-linux-gnu
script:
- cargo build --release --verbose --all
- cd target/release
- tar -czvf $TRAVIS_BUILD_DIR/ffsend-$TARGET.tar.gz ffsend
- cd $TRAVIS_BUILD_DIR
deploy: &deploy-github-release-cross
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
install: &install-github-release-cross
- cargo install cross
script: &script-github-release-cross
- cross build --target $TARGET --release --verbose --all
- cd target/release
- tar -czvf $TRAVIS_BUILD_DIR/ffsend-$TARGET.tar.gz ffsend
- cd $TRAVIS_BUILD_DIR
deploy: *deploy-github-release-cross
# GitHub binary release for Linux on arch
- stage: release
rust: stable
env: TARGET=aarch64-unknown-linux-gnu
install: *install-github-release-cross
script: *script-github-release-cross
deploy: *deploy-github-release-cross
- stage: release
rust: stable
install: *install-github-release-cross
script: *script-github-release-cross
deploy: *deploy-github-release-cross
- stage: release
rust: stable
env: TARGET=armv7-unknown-linux-gnueabihf
install: *install-github-release-cross
script: *script-github-release-cross
deploy: *deploy-github-release-cross
# GitHub binary release for macOX
- stage: release
rust: stable
os: osx
env: TARGET=x86_64-apple-darwin
script:
- cargo build --release --verbose --all
- cd target/release
- tar -czvf $TRAVIS_BUILD_DIR/ffsend-$TARGET.tar.gz ffsend
- cd $TRAVIS_BUILD_DIR
deploy: *deploy-github-release-cross
# 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