Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Commit 2a22790

Browse files
author
Jorge Aparicio
committed
add CI
1 parent 2b10860 commit 2a22790

File tree

14 files changed

+427
-0
lines changed

14 files changed

+427
-0
lines changed

.travis.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
cache: cargo
2+
dist: trusty
3+
language: generic
4+
language: rust
5+
rust: stable
6+
services: docker
7+
sudo: required
8+
9+
env:
10+
global:
11+
- CRATE_NAME=itm
12+
- DEPLOY_VERSION=stable
13+
- TARGET=x86_64-unknown-linux-gnu
14+
15+
matrix:
16+
include:
17+
# OSX
18+
- env: TARGET=i686-apple-darwin
19+
os: osx
20+
- env: TARGET=x86_64-apple-darwin
21+
os: osx
22+
23+
# Linux
24+
- env: TARGET=i686-unknown-linux-gnu
25+
- env: TARGET=i686-unknown-linux-musl
26+
# This target is handled by the default build job
27+
# - env: TARGET=x86_64-unknown-linux-gnu
28+
- env: TARGET=x86_64-unknown-linux-musl
29+
30+
install:
31+
# curl: cargo + rustc
32+
# case: rust-std
33+
- if [ -z $TRAVIS_TAG ] || [ $TRAVIS_RUST_VERSION = $DEPLOY_VERSION ]; then
34+
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=$TRAVIS_RUST_VERSION -y;
35+
source ~/.cargo/env;
36+
case $TARGET in
37+
x86_64-apple-darwin | x86_64-unknown-linux-gnu) ;;
38+
*) rustup target add $TARGET ;;
39+
esac;
40+
fi
41+
42+
script:
43+
# chmod: Travis can't cache files that are not readable by "others"
44+
- if [ -z $TRAVIS_TAG ] || [ $TRAVIS_RUST_VERSION = $DEPLOY_VERSION ]; then
45+
cargo generate-lockfile;
46+
47+
if [[ $TRAVIS_OS_NAME = linux ]]; then
48+
sh ci/run-docker.sh $TARGET || exit 1;
49+
else
50+
sh ci/run.sh || exit 1;
51+
fi;
52+
53+
chmod -R a+r $HOME/.cargo;
54+
fi
55+
56+
before_deploy:
57+
- sh ci/package.sh $TARGET
58+
59+
deploy:
60+
provider: releases
61+
api_key:
62+
secure: Muel87WKuZAv4Fc1QRc4LF2OQpbfdCkvZupA1ik/mBEHxbr8qpBJDLbq1BgNo6XB6RFjOglPEsf1yhxMwMdaNVymQOTTEbMZ29FAsthoH5F/PPpuMWTRB1DXqvwT9AzTaQhKmT1u4ZSxPpLqAOV0tT5Tdm3grSRt9UVlvSBjYo8A+KLWjPVOX88o7MLdbqHWQ8IbeS7nmrhO4eOXk4wgemDLdUPENhrHQb52oetMsaW+W3CZLkyNIYkQAZGpz2Vug1YrZMe+8heGDBuSAPBi0hI5Z9qYNN2Zpcp24XzVrr5KerKNwElPBbx5VyzX2bG1lkyKujRrt3Xl24xf4q0hZLYisTS2Cq5wNbIUvrVGc/y1UQ2sS2NRyVylMi5jryHBmqTc7TLvLrrXP/0SmxO6PeWoKMwcfLIbGmHWqtmp9Qo7hIqruSK6v+myNgUFmbyVsJlsB1Upo3eQ69B4XcG3uOD5kwvzo57lyzLxXDnvQk/v1Ygab8lFBeNr8dBiA3+RTaVblXSFKY1cQlPdg/AzkEXcz6xKda7y3gz530cgxL9f2Kx0YRwi6Bh9jBEA52CHFUF7UDiyPmGE+6rcYhpqIwvZ2nDQwLnxu+pV620ttYoXqK5FYDxPAVWuSe3A/F4KZzgAse0FFg0moOZTcurcrRSQfPT3EVqTO8xZi+Ou+kw=
63+
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
64+
# don't delete the target directory
65+
skip_cleanup: true
66+
on:
67+
condition: $TRAVIS_RUST_VERSION = $DEPLOY_VERSION
68+
tags: true
69+
70+
cache:
71+
directories:
72+
- $HOME/.cargo
73+
- target
74+
75+
branches:
76+
only:
77+
# Release tags
78+
- /^v\d+\.\d+\.\d+.*$/
79+
- auto
80+
- try
81+
82+
notifications:
83+
email:
84+
on_success: never
85+
webhooks: https://homu.herokuapp.com/travis

Cargo.lock

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ clap = "2.14.0"
1313
error-chain = "0.5.0"
1414
libc = "0.2.17"
1515
ref_slice = "1.1.0"
16+
17+
[dev-dependencies]
18+
tempdir = "0.3.5"

appveyor.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
environment:
2+
global:
3+
CRATE_NAME: itm
4+
DEPLOY_VERSION: stable
5+
RUST_VERSION: stable
6+
matrix:
7+
- TARGET: i686-pc-windows-gnu
8+
- TARGET: i686-pc-windows-msvc
9+
- TARGET: x86_64-pc-windows-gnu
10+
- TARGET: x86_64-pc-windows-msvc
11+
12+
install:
13+
- ps: ci\install.ps1
14+
15+
build: false
16+
17+
test_script:
18+
- if [%APPVEYOR_REPO_TAG%]==[false] (
19+
cargo build --target %TARGET% &&
20+
cargo build --target %TARGET% --release &&
21+
cargo test --target %TARGET% &&
22+
cargo test --target %TARGET% --release
23+
) else (
24+
if [%RUST_VERSION%]==[%DEPLOY_VERSION%] (
25+
cargo rustc --target %TARGET% --release --bin itmdump -- -C lto
26+
)
27+
)
28+
29+
before_deploy:
30+
- ps: ci\package.ps1
31+
32+
deploy:
33+
description: 'Windows release'
34+
artifact: /.*\.zip/
35+
auth_token:
36+
secure: bQ29dEXeNG5VP2hQcWiZ1xsfmkGosteCDNeYu/cXTX4lOeghOp0qANpQXmGfal29
37+
provider: GitHub
38+
on:
39+
# NOTE this "version" must match %DEPLOY_VERSION% (see top)
40+
RUST_VERSION: stable
41+
appveyor_repo_tag: true
42+
43+
cache:
44+
- C:\Users\appveyor\.cargo\registry
45+
- target
46+
47+
branches:
48+
only:
49+
# Release tags
50+
- /^v\d+\.\d+\.\d+.*$/
51+
- auto
52+
- try
53+
54+
notifications:
55+
- provider: Email
56+
on_build_success: false
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ubuntu:12.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
gcc-multilib \
6+
git
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
gcc-multilib \
6+
git \
7+
musl-tools
8+
ENV CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
9+
CC_i686_unknown_linux_musl=musl-gcc
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM ubuntu:12.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
gcc \
6+
git \
7+
libc6-dev
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
gcc \
6+
git \
7+
libc6-dev \
8+
musl-tools

ci/install.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
If ($Env:APPVEYOR_REPO_TAG -eq 'false' -Or $Env:RUST_VERSION -eq $Env:DEPLOY_VERSION) {
2+
If ($Env:TARGET -Match 'gnu') {
3+
if ($Env:TARGET -Match 'x86_64') {
4+
$Env:PATH += ';C:\msys64\mingw64\bin'
5+
} else {
6+
$Env:PATH += ';C:\msys64\mingw32\bin'
7+
}
8+
}
9+
10+
[Net.ServicePointManager]::SecurityProtocol = 'Ssl3, Tls, Tls12'
11+
Start-FileDownload 'https://win.rustup.rs' 'rustup-init.exe'
12+
13+
.\rustup-init --default-host $Env:TARGET --default-toolchain $Env:RUST_VERSION -y
14+
15+
$Env:PATH = 'C:\Users\appveyor\.cargo\bin;' + $Env:PATH
16+
17+
rustup component add rust-src
18+
19+
rustc -Vv
20+
21+
cargo -V
22+
}

ci/package.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$SRC_DIR = $PWD.Path
2+
$STAGE = [System.Guid]::NewGuid().ToString()
3+
4+
Set-Location $ENV:Temp
5+
New-Item -Type Directory -Name $STAGE
6+
Set-Location $STAGE
7+
8+
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
9+
Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\itmdump.exe" '.\'
10+
7z a "$ZIP" *
11+
12+
Push-AppveyorArtifact "$ZIP"
13+
14+
Remove-Item *.* -Force
15+
Set-Location ..
16+
Remove-Item $STAGE
17+
Set-Location $SRC_DIR

0 commit comments

Comments
 (0)