Skip to content

Commit 3291ed9

Browse files
committed
Move CI to trust
These changes configure the trust template to use the correct credentials and project name. The rest was left as is. There seems to be an issue with rustup at the moment rust-lang/rustup#1092. As suggested in rust-lang/rustup#1092 (comment) I've enabled the `allow_failures` feature for nightly builds.
1 parent fd37e94 commit 3291ed9

File tree

7 files changed

+220
-354
lines changed

7 files changed

+220
-354
lines changed

.travis.yml

Lines changed: 71 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,106 @@
1+
# Based on the "trust" template v0.1.1
2+
# https://github.com/japaric/trust/tree/v0.1.1
3+
4+
dist: trusty
15
language: rust
2-
cache: cargo
6+
services: docker
7+
sudo: required
8+
9+
# TODO Rust builds on stable by default, this can be
10+
# overridden on a case by case basis down below.
311

412
env:
513
global:
6-
- PROJECT_NAME=tokei
14+
- CRATE_NAME=tokei
715
- MAKE_DEB=yes
816
- DEB_MAINTAINER="Aaron Power <[email protected]>"
917
- DEB_DESCRIPTION="A utility that allows you to count code, quickly."
1018

11-
# AFAICT There are a few ways to set up the build jobs. This one is not the
12-
# DRYest but I feel is the easiest to reason about.
13-
# TODO Feel free to remove the channels/targets you don't need
14-
# NOTE Make *sure* you don't remove a reference (&foo) if you are going to dereference it (*foo)
1519
matrix:
20+
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
21+
# don't need
1622
include:
17-
# Stable channel
18-
- os: osx
19-
rust: stable
20-
env: TARGET=i686-apple-darwin
21-
- os: linux
22-
rust: stable
23-
env: TARGET=i686-unknown-linux-gnu
24-
addons:
25-
apt:
26-
packages: &i686_unknown_linux_gnu
27-
# Cross compiler and cross compiled C libraries
28-
- gcc-multilib
29-
- os: linux
30-
rust: stable
31-
env: TARGET=i686-unknown-linux-musl
32-
dist: trusty
33-
sudo: required
34-
addons:
35-
apt:
36-
packages: &musl_packages
37-
- musl
38-
- musl-dev
39-
- musl-tools
40-
- os: osx
41-
rust: stable
42-
env: TARGET=x86_64-apple-darwin
43-
- os: linux
44-
rust: stable
45-
env: TARGET=x86_64-unknown-linux-gnu
46-
- os: linux
47-
rust: stable
48-
env: TARGET=x86_64-unknown-linux-musl
49-
dist: trusty
50-
sudo: required
51-
addons:
52-
apt:
53-
packages: *musl_packages
54-
# Beta channel
55-
- os: osx
56-
rust: beta
57-
env: TARGET=i686-apple-darwin
58-
- os: linux
59-
rust: beta
60-
env: TARGET=i686-unknown-linux-gnu
61-
addons:
62-
apt:
63-
packages: *i686_unknown_linux_gnu
64-
- os: linux
65-
rust: beta
66-
env: TARGET=i686-unknown-linux-musl
67-
dist: trusty
68-
sudo: required
69-
addons:
70-
apt:
71-
packages: *musl_packages
72-
- os: osx
73-
rust: beta
74-
env: TARGET=x86_64-apple-darwin
75-
- os: linux
76-
rust: beta
77-
env: TARGET=x86_64-unknown-linux-gnu
78-
- os: linux
79-
rust: beta
80-
env: TARGET=x86_64-unknown-linux-musl
81-
dist: trusty
82-
sudo: required
83-
addons:
84-
apt:
85-
packages: *musl_packages
86-
# Nightly channel
87-
- os: osx
88-
rust: nightly
89-
env: TARGET=i686-apple-darwin
90-
- os: linux
91-
rust: nightly
92-
env: TARGET=i686-unknown-linux-gnu
93-
addons:
94-
apt:
95-
packages: *i686_unknown_linux_gnu
96-
- os: linux
97-
rust: nightly
98-
env: TARGET=i686-unknown-linux-musl
99-
dist: trusty
100-
sudo: required
101-
addons:
102-
apt:
103-
packages: *musl_packages
104-
- os: osx
105-
rust: nightly
106-
env: TARGET=x86_64-apple-darwin
107-
- os: linux
23+
# Linux
24+
- env: TARGET=i686-unknown-linux-gnu
25+
- env: TARGET=i686-unknown-linux-musl
26+
- env: TARGET=x86_64-unknown-linux-gnu
27+
- env: TARGET=x86_64-unknown-linux-musl
28+
29+
# OSX
30+
- env: TARGET=i686-apple-darwin
31+
os: osx
32+
- env: TARGET=x86_64-apple-darwin
33+
os: osx
34+
35+
# *BSD
36+
- env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
37+
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
38+
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
39+
40+
# Other architectures
41+
- env: TARGET=aarch64-unknown-linux-gnu
42+
- env: TARGET=armv7-unknown-linux-gnueabihf
43+
- env: TARGET=mips-unknown-linux-gnu
44+
- env: TARGET=mips64-unknown-linux-gnuabi64
45+
- env: TARGET=mips64el-unknown-linux-gnuabi64
46+
- env: TARGET=mipsel-unknown-linux-gnu
47+
- env: TARGET=powerpc-unknown-linux-gnu
48+
- env: TARGET=powerpc64-unknown-linux-gnu
49+
- env: TARGET=powerpc64le-unknown-linux-gnu
50+
- env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1
51+
52+
# Testing other channels
53+
- env: TARGET=x86_64-unknown-linux-gnu
10854
rust: nightly
109-
env: TARGET=x86_64-unknown-linux-gnu
110-
- os: linux
55+
- env: TARGET=x86_64-apple-darwin
56+
os: osx
11157
rust: nightly
112-
env: TARGET=x86_64-unknown-linux-musl
113-
dist: trusty
114-
sudo: required
115-
addons:
116-
apt:
117-
packages: *musl_packages
11858
allow_failures:
119-
- rust: nightly
120-
before_install:
121-
- export PATH="$PATH:$HOME/.cargo/bin"
59+
- rust: nightly
60+
61+
before_install: set -e
12262

12363
install:
124-
- bash ci/install.sh
64+
- sh ci/install.sh
65+
- source ~/.cargo/env || true
12566

12667
script:
12768
- bash ci/script.sh
12869

70+
after_script: set +e
71+
12972
before_deploy:
130-
- bash ci/before_deploy.sh
73+
- sh ci/before_deploy.sh
13174

13275
deploy:
133-
provider: releases
76+
# TODO update `api_key.secure`
77+
# - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new
78+
# - Encrypt it: `travis encrypt 0123456789012345678901234567890123456789
79+
# - Paste the output down here
13480
api_key:
13581
secure: JAWZDa7izxqh/013aqxwSxhu4wndJfvQWngA/DMutC5J5ZTUEmA0UJG+VGCVcMVZOBu/IUy6tRmz3IgEqgW74FLc4UuBRH3RdInp+dpjUc2yTuUltOuT+skn5LGQXi+m8VeIxRS0PXCsN5twpOfSi0uuKu+UzMN9ZOX9wEy1svRlAUJdcT37LfvlS/lnxHoF+WuakZfFsP0QCrgI7uBY83X+wT6YAixiywzadKMqXDSNlJ7m0t9pJ1FsR0BgnoYiTI/L/3P3FDJCDzShujlU9P3xLvirV4/HB9NPG+IhuhTSCpBE8UIzCourAi6AgG3wdQGiR9S9QdwEuF3Y5Ya5l2tkJpqrk8FkBMVkH57m9iGV0j4mHDOvaRzMiPyYeuTTPKgbSWAvLOGouVRDP0SrZGjjcCvKSN4LVgO83uLjsg2XtdFoA89s/pNLsY2e07trT6jVm12P9uKdLWqkHdLJdGG4448aL8cIXntlCIHujpSmSikGtlGZZB6cvfkZQn/ZLhBxiGyk8n2V5hpqFml/tk6QDxyY04gSd1t/9aebOZmAGFYP0aufJpQe1GW13PQSdIQL6MZPtsk88OgP6EqUOSBCIAWuBd0cLds1SE+TELPyAPHWx5Z/y+mUEx4NoxRWWzNbQxOaMfXtLhE+xp7gdJYH7QtldagYz79UX/8wYbo=
13682
file_glob: true
137-
file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.*
138-
# don't delete the artifacts from previous phases
139-
skip_cleanup: true
140-
# deploy when a new tag is pushed
83+
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
14184
on:
85+
# TODO Here you can pick which targets will generate binary releases
86+
# In this example, there are some targets that are tested using the stable
87+
# and nightly channels. This condition makes sure there is only one release
88+
# for such targets and that's generated using the stable channel
14289
condition: $TRAVIS_RUST_VERSION = stable
14390
tags: true
91+
provider: releases
92+
skip_cleanup: true
93+
94+
cache: cargo
95+
before_cache:
96+
# Travis can't cache files that are not readable by "others"
97+
- chmod -R a+r $HOME/.cargo
14498

14599
branches:
146100
only:
147-
# Pushes and PR to the master branch
148-
- master
149-
# IMPORTANT Ruby regex to match tags. Required, or travis won't trigger deploys when a new tag
150-
# is pushed. This regex matches semantic versions like v1.2.3-rc4+2016.02.22
101+
# release tags
151102
- /^v\d+\.\d+\.\d+.*$/
103+
- master
152104

153105
notifications:
154106
email:

appveyor.yml

Lines changed: 70 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,97 @@
1+
# Based on the "trust" template v0.1.1
2+
# https://github.com/japaric/trust/tree/v0.1.1
3+
14
environment:
25
global:
3-
PROJECT_NAME: tokei
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: tokei
12+
13+
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
14+
# don't need
415
matrix:
5-
# Stable channel
16+
# MinGW
617
- TARGET: i686-pc-windows-gnu
7-
CHANNEL: stable
18+
- TARGET: x86_64-pc-windows-gnu
19+
20+
# MSVC
821
- TARGET: i686-pc-windows-msvc
9-
CHANNEL: stable
22+
- TARGET: x86_64-pc-windows-msvc
23+
24+
# Testing other channels
1025
- TARGET: x86_64-pc-windows-gnu
11-
CHANNEL: stable
26+
RUST_VERSION: nightly
1227
- TARGET: x86_64-pc-windows-msvc
13-
CHANNEL: stable
28+
RUST_VERSION: nightly
29+
30+
matrix:
31+
allow_failures:
32+
- RUST_VERSION: nightly
1433

15-
# Install Rust and Cargo
16-
# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml)
1734
install:
18-
- curl -sSf -o rustup-init.exe https://win.rustup.rs
19-
- rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y
35+
- ps: >-
36+
If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
37+
$Env:PATH += ';C:\msys64\mingw64\bin'
38+
} ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') {
39+
$Env:PATH += ';C:\msys64\mingw32\bin'
40+
}
41+
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
42+
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
2043
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
2144
- rustc -Vv
2245
- cargo -V
2346

24-
# 'cargo test' takes care of building for us, so disable Appveyor's build stage.
25-
# This prevents
26-
# the "directory does not contain a project or solution file" error.
27-
# source: https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml#L113
28-
build: false
29-
30-
# Equivalent to Travis' `script` phase
47+
# TODO This is the "test phase", tweak it as you see fit
3148
test_script:
32-
- cargo build --verbose
33-
- cargo test
34-
- cargo build --verbose --features=all
35-
- cargo test --features=all
49+
# we don't run the "test phase" when doing deploys
50+
- if [%APPVEYOR_REPO_TAG%]==[false] (
51+
cargo build --target %TARGET% &&
52+
cargo build --target %TARGET% --release &&
53+
cargo test --target %TARGET% &&
54+
cargo test --target %TARGET% --release &&
55+
cargo run --target %TARGET% &&
56+
cargo run --target %TARGET% --release
57+
)
3658

3759
before_deploy:
38-
# Generate artifacts for release
39-
- cargo build --release --features=all
40-
- mkdir staging
41-
- copy target\release\tokei.exe staging
42-
- cd staging
43-
# release zipfile will look like 'rust-everywhere-v1.2.3-x86_64-pc-windows-msvc'
44-
- 7z a ../%PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip *
45-
- appveyor PushArtifact ../%PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip
60+
# TODO Update this to build the artifacts that matter to you
61+
- cargo rustc --target %TARGET% --release --bin tokei -- -C lto
62+
- ps: ci\before_deploy.ps1
4663

4764
deploy:
48-
description: 'Automatically deployed release'
49-
# All the zipped artifacts will be deployed
5065
artifact: /.*\.zip/
66+
# TODO update `auth_token.secure`
67+
# - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new
68+
# - Encrypt it. Go to https://ci.appveyor.com/tools/encrypt
69+
# - Paste the output down here
5170
auth_token:
5271
secure: BFuC1XGTw6ZIBQijzOLnKcYQPUdRuB+OfumTR9Hkosc5XOw1TvIYxlbR0hIS58RK
53-
provider: GitHub
54-
# deploy when a new tag is pushed and only on the stable channel
72+
description: ''
5573
on:
56-
# channel to use to produce the release artifacts
57-
# NOTE make sure you only release *once* per target
58-
CHANNEL: stable
74+
# TODO Here you can pick which targets will generate binary releases
75+
# In this example, there are some targets that are tested using the stable
76+
# and nightly channels. This condition makes sure there is only one release
77+
# for such targets and that's generated using the stable channel
78+
RUST_VERSION: stable
5979
appveyor_repo_tag: true
80+
provider: GitHub
81+
82+
cache:
83+
- C:\Users\appveyor\.cargo\registry
84+
- target
6085

6186
branches:
6287
only:
63-
- master
64-
# IMPORTANT Regex to match tags. Required, or appveyor may not trigger deploys when a new tag
65-
# is pushed. This regex matches semantic versions like v1.2.3-rc4+2016.02.22
88+
# Release tags
6689
- /^v\d+\.\d+\.\d+.*$/
90+
- master
91+
92+
notifications:
93+
- provider: Email
94+
on_build_success: false
95+
96+
# Building is done in the test phase, so we disable Appveyor's build phase.
97+
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\tokei.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

0 commit comments

Comments
 (0)