Skip to content

Commit ee2bff1

Browse files
berkowskiSusurrus
authored andcommitted
Added ci templates from trust v0.1.1
1 parent 52963ab commit ee2bff1

File tree

6 files changed

+300
-0
lines changed

6 files changed

+300
-0
lines changed

.travis.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Based on the "trust" template v0.1.1
2+
# https://github.com/japaric/trust/tree/v0.1.1
3+
4+
dist: trusty
5+
language: rust
6+
services: docker
7+
sudo: required
8+
9+
# TODO This is the Rust channel that build jobs will use by default but can be
10+
# overridden on a case by case basis down below
11+
rust: stable
12+
13+
env:
14+
global:
15+
# TODO Update this to match the name of your project.
16+
- CRATE_NAME=trust
17+
18+
# default job
19+
- TARGET=x86_64-unknown-linux-gnu
20+
21+
matrix:
22+
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
23+
# don't need
24+
include:
25+
# Linux
26+
- env: TARGET=i686-unknown-linux-gnu
27+
- env: TARGET=i686-unknown-linux-musl
28+
# - env: TARGET=x86_64-unknown-linux-gnu # this is the default job
29+
- env: TARGET=x86_64-unknown-linux-musl
30+
31+
# OSX
32+
- env: TARGET=i686-apple-darwin
33+
os: osx
34+
- env: TARGET=x86_64-apple-darwin
35+
os: osx
36+
37+
# *BSD
38+
- env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
39+
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
40+
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
41+
42+
# Other architectures
43+
- env: TARGET=aarch64-unknown-linux-gnu
44+
- env: TARGET=armv7-unknown-linux-gnueabihf
45+
- env: TARGET=mips-unknown-linux-gnu
46+
- env: TARGET=mips64-unknown-linux-gnuabi64
47+
- env: TARGET=mips64el-unknown-linux-gnuabi64
48+
- env: TARGET=mipsel-unknown-linux-gnu
49+
- env: TARGET=powerpc-unknown-linux-gnu
50+
- env: TARGET=powerpc64-unknown-linux-gnu
51+
- env: TARGET=powerpc64le-unknown-linux-gnu
52+
- env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1
53+
54+
# Testing other channels
55+
- env: TARGET=x86_64-unknown-linux-gnu
56+
rust: nightly
57+
- env: TARGET=x86_64-apple-darwin
58+
os: osx
59+
rust: nightly
60+
61+
install:
62+
- sh ci/install.sh
63+
- source ~/.cargo/env || true
64+
65+
script:
66+
- bash ci/script.sh
67+
68+
before_deploy:
69+
- sh ci/before_deploy.sh
70+
71+
deploy:
72+
# TODO update `api_key.secure`
73+
# - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new
74+
# - Encrypt it: `travis encrypt GH_TOKEN=0123456789012345678901234567890123456789`
75+
# - Paste the output down here
76+
api_key:
77+
secure: A9v3PIzQQ4U08OHFmDPQzNXbNHEb7YHyLXCvMF+dXFuNSvhUNlmQYykxqUf3dvikhJL2/bsZ14umm7ni7fQh0tGwJ4+lPpNzYAcweGgNXnWvjTpY6ovuRbr3gs4/srkyxp/GBDmSW5L8wFN3hKCB+Lm0YnIPB9IA2afP8a30+8VTXT9nv7pNqGny4ilN41ycr4DZi3sQoXdbruy7ClN7gsWW/GUiudBccHVIjmTapOFKLwZHODaUl/1/RDWQzh+i+17e1ivXuJPktDSrqmHPTZ15OjklnHKd6t179ry6VkGRg4R/R/YukVIqGzeaXGWAwdAQ5gE8cjGZghJLVi2jkDBJ85z8MvT+zLZLyliiuhLc/X8y7mkE1n0FKFtXXzFVt0l7V1LaEKbIbiV6XX3jsir4qgkqWjPHBZqO5mkGNFS16Dmt30/ZtEPAzXiINFXbWuWrpQ/LZ4NSto8IMrRTcoyDbAga/KYxJiNIeVuCe1E9dbytDM7K0GLtxJTul/WnnSeI6r//EFyC4bxYjyHhCXaag4q14KM+ak4rB0QgxsYzyGuh2MqyCoVj8YJLjLdKnL/SV7W7LPD40xlxvI6VCYTVi2ILHwL6vCxpukXYteX0c5IAIWkISDKu6nNBEgmCHXXPSqYSrgE5g7/QoCQHI8++nR8iKe0s7TWxZRydby8=
78+
file_glob: true
79+
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
80+
on:
81+
# TODO Here you can pick which targets will generate binary releases
82+
# In this example, there are some targets that are tested using the stable
83+
# and nightly channels. This condition makes sure there is only one release
84+
# for such targets and that's generated using the stable channel
85+
condition: $TRAVIS_RUST_VERSION = stable
86+
tags: true
87+
provider: releases
88+
skip_cleanup: true
89+
90+
cache: cargo
91+
before_cache:
92+
# Travis can't cache files that are not readable by "others"
93+
- chmod -R a+r $HOME/.cargo
94+
95+
branches:
96+
only:
97+
# release tags
98+
- /^v\d+\.\d+\.\d+.*$/
99+
- master
100+
101+
notifications:
102+
email:
103+
on_success: never

appveyor.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Based on the "trust" template v0.1.1
2+
# https://github.com/japaric/trust/tree/v0.1.1
3+
4+
environment:
5+
global:
6+
# TODO This is the Rust channel that build jobs will use by default but can be
7+
# overridden on a case by case basis down below
8+
RUST_VERSION: stable
9+
10+
# TODO Update this to match the name of your project.
11+
CRATE_NAME: trust
12+
13+
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
14+
# don't need
15+
matrix:
16+
# MinGW
17+
- TARGET: i686-pc-windows-gnu
18+
- TARGET: x86_64-pc-windows-gnu
19+
20+
# MSVC
21+
- TARGET: i686-pc-windows-msvc
22+
- TARGET: x86_64-pc-windows-msvc
23+
24+
# Testing other channels
25+
- TARGET: x86_64-pc-windows-gnu
26+
RUST_VERSION: nightly
27+
- TARGET: x86_64-pc-windows-msvc
28+
RUST_VERSION: nightly
29+
30+
install:
31+
- ps: >-
32+
If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
33+
$Env:PATH += ';C:\msys64\mingw64\bin'
34+
} ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') {
35+
$Env:PATH += ';C:\msys64\mingw32\bin'
36+
}
37+
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
38+
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
39+
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
40+
- rustc -Vv
41+
- cargo -V
42+
43+
# TODO This is the "test phase", tweak it as you see fit
44+
test_script:
45+
# we don't run the "test phase" when doing deploys
46+
- if [%APPVEYOR_REPO_TAG%]==[false] (
47+
cargo build --target %TARGET% &&
48+
cargo build --target %TARGET% --release &&
49+
cargo test --target %TARGET% &&
50+
cargo test --target %TARGET% --release &&
51+
cargo run --target %TARGET% &&
52+
cargo run --target %TARGET% --release
53+
)
54+
55+
before_deploy:
56+
# TODO Update this to build the artifacts that matter to you
57+
- cargo rustc --target %TARGET% --release --bin hello -- -C lto
58+
- ps: ci\before_deploy.ps1
59+
60+
deploy:
61+
artifact: /.*\.zip/
62+
# TODO update `auth_token.secure`
63+
# - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new
64+
# - Encrypt it. Go to https://ci.appveyor.com/tools/encrypt
65+
# - Paste the output down here
66+
auth_token:
67+
secure: t3puM/2hOig26EHhAodcZBc61NywF7/PFEpimR6SwGaCiqS07KR5i7iAhSABmBp7
68+
description: ''
69+
on:
70+
# TODO Here you can pick which targets will generate binary releases
71+
# In this example, there are some targets that are tested using the stable
72+
# and nightly channels. This condition makes sure there is only one release
73+
# for such targets and that's generated using the stable channel
74+
RUST_VERSION: stable
75+
appveyor_repo_tag: true
76+
provider: GitHub
77+
78+
cache:
79+
- C:\Users\appveyor\.cargo\registry
80+
- target
81+
82+
branches:
83+
only:
84+
# Release tags
85+
- /^v\d+\.\d+\.\d+.*$/
86+
- master
87+
88+
notifications:
89+
- provider: Email
90+
on_build_success: false
91+
92+
# disable automatic builds
93+
build: false

ci/before_deploy.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This script takes care of packaging the build artifacts that will go in the
2+
# release zipfile
3+
4+
$SRC_DIR = $PWD.Path
5+
$STAGE = [System.Guid]::NewGuid().ToString()
6+
7+
Set-Location $ENV:Temp
8+
New-Item -Type Directory -Name $STAGE
9+
Set-Location $STAGE
10+
11+
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
12+
13+
# TODO Update this to package the right artifacts
14+
Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\hello.exe" '.\'
15+
16+
7z a "$ZIP" *
17+
18+
Push-AppveyorArtifact "$ZIP"
19+
20+
Remove-Item *.* -Force
21+
Set-Location ..
22+
Remove-Item $STAGE
23+
Set-Location $SRC_DIR

ci/before_deploy.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This script takes care of building your crate and packaging it for release
2+
3+
set -ex
4+
5+
main() {
6+
local src=$(pwd) \
7+
stage=
8+
9+
case $TRAVIS_OS_NAME in
10+
linux)
11+
stage=$(mktemp -d)
12+
;;
13+
osx)
14+
stage=$(mktemp -d -t tmp)
15+
;;
16+
esac
17+
18+
test -f Cargo.lock || cargo generate-lockfile
19+
20+
# TODO Update this to build the artifacts that matter to you
21+
cross rustc --bin hello --target $TARGET --release -- -C lto
22+
23+
# TODO Update this to package the right artifacts
24+
cp target/$TARGET/release/hello $stage/
25+
26+
cd $stage
27+
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
28+
cd $src
29+
30+
rm -rf $stage
31+
}
32+
33+
main

ci/install.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
set -ex
2+
3+
main() {
4+
curl https://sh.rustup.rs -sSf | \
5+
sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION
6+
7+
local target=
8+
if [ $TRAVIS_OS_NAME = linux ]; then
9+
target=x86_64-unknown-linux-gnu
10+
else
11+
target=x86_64-apple-darwin
12+
fi
13+
14+
# TODO At some point you'll probably want to use a newer release of `cross`,
15+
# simply change the argument to `--tag`.
16+
curl -LSfs https://japaric.github.io/trust/install.sh | \
17+
sh -s -- \
18+
--force \
19+
--git japaric/cross \
20+
--tag v0.1.4 \
21+
--target $target
22+
}
23+
24+
main

ci/script.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This script takes care of testing your crate
2+
3+
set -ex
4+
5+
# TODO This is the "test phase", tweak it as you see fit
6+
main() {
7+
cross build --target $TARGET
8+
cross build --target $TARGET --release
9+
10+
if [ -n $DISABLE_TESTS ]; then
11+
return
12+
fi
13+
14+
cross test --target $TARGET
15+
cross test --target $TARGET --release
16+
17+
cross run --target $TARGET
18+
cross run --target $TARGET --release
19+
}
20+
21+
# we don't run the "test phase" when doing deploys
22+
if [ -z $TRAVIS_TAG ]; then
23+
main
24+
fi

0 commit comments

Comments
 (0)