Skip to content

Commit

Permalink
Merge pull request #43 from japaric/dev
Browse files Browse the repository at this point in the history
release v0.1.0
  • Loading branch information
Jorge Aparicio authored Jan 2, 2017
2 parents 78f8489 + 68a2d1c commit f8d6f58
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 41 deletions.
122 changes: 104 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,135 @@
# `trust`

## Targets
> Travis CI and AppVeyor template to test your Rust crate on 5 architectures
> and publish [binary releases] of it for Linux, macOS and Windows
[binary releases]: https://github.com/japaric/trust/releases

### Features

- CI test your crate (library or binary) on Linux, macOS and Windows and on more
than just the x86 architecture.

- Cargo artifacts are cached and reused between CI builds.

- "Deploys": Publish binary releases of your application by just pushing a new
(Git) tag.

## Requirements

- Your crate must be hosted on GitHub (free).

- A [Travis CI](https://travis-ci.org/) account (free).

- An [AppVeyor](https://www.appveyor.com/) account (free).

## How-to

### Use this template

Copy the `ci` directory, and the `.travis.yml` and `appveyor.yml` files into the
repository where you host your Rust crate.

You'll have to adjust those files to meet your needs. Just look inside those
files for comments that start with the word `TODO`; they'll tell you want needs
to be changed.

This is an overview of what must / can be changed:

- The GitHub token used for deploys.

- The list of test targets. Trim it down to reduce test times.

- The Rust channel used for testing / deploys.

- The "test phase". Tweak how your crate is tested.

- the "package phase". Tweak what goes into the release tarball / zipfile.

### Generate binary releases

You only need to push an **annotated** tag to kick off the build process.

```
# Optional: Publish a new version of your crate to crates.io
$ cargo publish
$ git tag -a $TAG
$ git push origin $TAG
```

### Use the binary releases on Travis CI

There's
an [`install.sh`](https://github.com/japaric/trust/blob/gh-pages/install.sh)
script that you can use to quickly install a binary release produced using this
CI template.

```
$ curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- --git japaric/cross
```

For more details about this installation script see `install.sh -h`

## Supported targets

### Linux

Using [`cross`](https://github.com/japaric/cross)
Courtesy of [`cross`](https://github.com/japaric/cross).

If you run into any problem with any of these targets, report them
to [`cross`'s issue tracker](https://github.com/japaric/cross/issues) but first
check if using a newer release (see `ci/install.sh`)
would
[fix your problem](https://github.com/japaric/cross/blob/master/CHANGELOG.md).

- `i686-unknown-linux-gnu`

- `i686-unknown-linux-musl`

- `x86_64-unknown-linux-gnu`

- `x86_64-unknown-linux-musl`

- `aarch64-unknown-linux-gnu`

- `armv7-unknown-linux-gnueabihf`
- `i686-unknown-linux-gnu`

- `mips-unknown-linux-gnu`

- `mips64-unknown-linux-gnuabi64`

- `mips64el-unknown-linux-gnuabi64`

- `mipsel-unknown-linux-gnu`

- `powerpc-unknown-linux-gnu`

- `powerpc64-unknown-linux-gnu`

- `powerpc64le-unknown-linux-gnu`

- `s390x-unknown-linux-gnu`
- `x86_64-unknown-linux-gnu`
- `x86_64-unknown-linux-musl`

### macOS

- `i686-apple-darwin`

- `x86_64-apple-darwin`

### Windows
### Windows (MinGW)

- `i586-pc-windows-msvc`
- `i686-pc-windows-gnu`
- `i686-pc-windows-msvc`
- `x86_64-pc-windows-gnu`
- `x86_64-pc-windows-msvc`

## Notes to self
- `x86_64-pc-windows-gnu`

- Deploy only works with annotated tags
### Windows (MSVC)

- Linux: If testing only, it makes sense to use the latest available QEMU i.e.
the latest Ubuntu version
- `i686-pc-windows-msvc`

- Linux: If building binaries, you want to use the oldest glibc possible for
maximum compatibility of your binaries; i.e. you want to use the oldest Ubuntu
- Linux: If QEMU is crashing while "cross" testing, the easiest fix is to use a
newer QEMU
- `x86_64-pc-windows-msvc`

## License

Expand Down
10 changes: 1 addition & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ environment:
- TARGET: x86_64-pc-windows-gnu

# MSVC
- TARGET: i586-pc-windows-msvc
- TARGET: i686-pc-windows-msvc
- TARGET: x86_64-pc-windows-msvc

Expand All @@ -33,15 +32,8 @@ install:
$Env:PATH += ';C:\msys64\mingw32\bin'
}
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- if [%TARGET%]==[i586-pc-windows-msvc] (
rustup-init.exe -y --default-host i686-pc-windows-msvc --default-toolchain %RUST_VERSION%
) else (
rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
)
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- if [%TARGET%]==[i586-pc-windows-msvc] (
rustup target add %TARGET%
)
- rustc -Vv
- cargo -V

Expand Down
5 changes: 5 additions & 0 deletions ci/before_deploy.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This script takes care of packaging the build artifacts that will go in the
# release zipfile

$SRC_DIR = $PWD.Path
$STAGE = [System.Guid]::NewGuid().ToString()

Expand All @@ -6,8 +9,10 @@ New-Item -Type Directory -Name $STAGE
Set-Location $STAGE

$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"

# TODO Update this to package the right artifacts
Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\hello.exe" '.\'

7z a "$ZIP" *

Push-AppveyorArtifact "$ZIP"
Expand Down
2 changes: 2 additions & 0 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This script takes care of building your crate and packaging it for release

set -ex

main() {
Expand Down
28 changes: 14 additions & 14 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
set -ex

main() {
local version=0.1.2

curl https://sh.rustup.rs -sSf | \
sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION

cargo install -f --git https://github.com/japaric/cross
local target=
if [ $TRAVIS_OS_NAME = linux ]; then
target=x86_64-unknown-linux-gnu
else
target=x86_64-apple-darwin
fi

# if [ $TRAVIS_OS_NAME = linux ]; then
# curl -LSfs http://japaric.github.io/trust/install.sh | \
# sh -s -- \
# --force \
# --git japaric/cross \
# --tag v$version \
# --target x86_64-unknown-linux-musl \
# --to ~/.cargo/bin
# else
# cargo install cross -f --vers $version
# fi
# TODO At some point you'll probably want to use a newer release of `cross`,
# simply change the argument to `--tag`.
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- \
--force \
--git japaric/cross \
--tag v0.1.3 \
--target $target
}

main
2 changes: 2 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This script takes care of testing your crate

set -ex

# TODO This is the "test phase", tweak it as you see fit
Expand Down

0 comments on commit f8d6f58

Please sign in to comment.