-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init cross compilation setup #6
Open
yoshuawuyts
wants to merge
1
commit into
withoutboats:master
Choose a base branch
from
yoshuawuyts:gen_bin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
dist: trusty | ||
language: rust | ||
services: docker | ||
sudo: required | ||
|
||
env: | ||
global: | ||
- CRATE_NAME=bpb | ||
- RUST_BACKTRACE=1 | ||
|
||
matrix: | ||
include: | ||
- env: TARGET=armv7-unknown-linux-gnueabihf | ||
rust: nightly | ||
- env: TARGET=x86_64-unknown-linux-musl | ||
rust: nightly | ||
- env: TARGET=x86_64-apple-darwin | ||
rust: nightly | ||
os: osx | ||
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 | ||
rust: nightly | ||
|
||
before_install: | ||
- set -e | ||
|
||
install: | ||
- sh scripts/install.sh | ||
- source ~/.cargo/env || true | ||
|
||
script: | ||
- bash scripts/script.sh | ||
|
||
after_script: set +e | ||
|
||
before_deploy: | ||
- sh scripts/before_deploy.sh | ||
|
||
deploy: | ||
provider: releases | ||
skip_cleanup: true | ||
file_glob: true | ||
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.* | ||
api_key: | ||
secure: "{{TOKEN}}" | ||
on: | ||
tags: true | ||
|
||
cache: cargo | ||
before_cache: | ||
- chmod -R a+r $HOME/.cargo | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This script takes care of packaging the build artifacts that will go in the | ||
# release zipfile. | ||
|
||
$PKG_NAME = "bpb" | ||
$SRC_DIR = $PWD.Path | ||
$STAGE = [System.Guid]::NewGuid().ToString() | ||
|
||
Set-Location $ENV:Temp | ||
New-Item -Type Directory -Name $STAGE | ||
Set-Location $STAGE | ||
|
||
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip" | ||
|
||
Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\$PKG_NAME.exe" '.\' | ||
|
||
7z a "$ZIP" * | ||
|
||
Push-AppveyorArtifact "$ZIP" | ||
|
||
Remove-Item *.* -Force | ||
Set-Location .. | ||
Remove-Item $STAGE | ||
Set-Location $SRC_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This script takes care of building the crate and packaging it for release. | ||
|
||
PKG_NAME="bpb" | ||
|
||
set -ex | ||
|
||
main() { | ||
local src=$(pwd) \ | ||
stage= | ||
|
||
case $TRAVIS_OS_NAME in | ||
linux) | ||
stage=$(mktemp -d) | ||
;; | ||
osx) | ||
stage=$(mktemp -d -t tmp) | ||
;; | ||
esac | ||
|
||
test -f Cargo.lock || cargo generate-lockfile | ||
|
||
cross rustc --bin $PKG_NAME --target $TARGET --release -- -C lto | ||
cp target/$TARGET/release/$PKG_NAME $stage/ | ||
|
||
cd $stage | ||
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz * | ||
cd $src | ||
|
||
rm -rf $stage | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
set -ex | ||
|
||
main() { | ||
local target= | ||
if [ $TRAVIS_OS_NAME = linux ]; then | ||
target=x86_64-unknown-linux-musl | ||
sort=sort | ||
else | ||
target=x86_64-apple-darwin | ||
sort=gsort # for `sort --sort-version`, from brew's coreutils. | ||
fi | ||
|
||
# Builds for iOS are done on OSX, but require the specific target to be | ||
# installed. | ||
case $TARGET in | ||
aarch64-apple-ios) | ||
rustup target install aarch64-apple-ios | ||
;; | ||
armv7-apple-ios) | ||
rustup target install armv7-apple-ios | ||
;; | ||
armv7s-apple-ios) | ||
rustup target install armv7s-apple-ios | ||
;; | ||
i386-apple-ios) | ||
rustup target install i386-apple-ios | ||
;; | ||
x86_64-apple-ios) | ||
rustup target install x86_64-apple-ios | ||
;; | ||
esac | ||
|
||
# This fetches latest stable release | ||
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ | ||
| cut -d/ -f3 \ | ||
| grep -E '^v[0.1.0-9.]+$' \ | ||
| $sort --version-sort \ | ||
| tail -n1) | ||
curl -LSfs https://japaric.github.io/trust/install.sh | \ | ||
sh -s -- \ | ||
--force \ | ||
--git japaric/cross \ | ||
--tag $tag \ | ||
--target $target | ||
|
||
# Install test dependencies | ||
rustup component add rustfmt-preview | ||
rustup component add clippy-preview | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This script takes care of testing the crate. | ||
|
||
set -ex | ||
|
||
main() { | ||
cross build --target $TARGET | ||
cross build --target $TARGET --release | ||
|
||
if [ ! -z $DISABLE_TESTS ]; then | ||
return | ||
fi | ||
|
||
cargo fmt -- --check | ||
cargo +nightly clippy | ||
|
||
cross test --target $TARGET | ||
cross test --target $TARGET --release | ||
} | ||
|
||
# we don't run the "test phase" when doing deploys | ||
if [ -z $TRAVIS_TAG ]; then | ||
main | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be replaced by an encrypted Travis key. This can be either done using the travis client using
travis encrypt
or see yoshuawuyts/crossgen#1 for alternatives.