Skip to content

Commit

Permalink
Fixed CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pomettini committed May 29, 2019
1 parent a87db2c commit 10449b0
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 34 deletions.
Binary file modified .DS_Store
Binary file not shown.
93 changes: 66 additions & 27 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,73 @@
os: Visual Studio 2015
image: Visual Studio 2017
environment:
global:
PROJECT_NAME: stevia
RUSTUP_INIT_SKIP_MSVC_CHECK: 1
matrix:
- TARGET: x86_64-pc-windows-msvc
CHANNEL: stable
- TARGET: x86_64-pc-windows-msvc
CHANNEL: beta
- TARGET: x86_64-pc-windows-msvc
CHANNEL: nightly
RUSTFLAGS: -Ctarget-feature=+crt-static
matrix:
- TARGET: x86_64-pc-windows-msvc
ALLOW_PR: 1
- TARGET: i686-pc-windows-msvc
BUILD_MSI: 1
ALLOW_PR: 1
- TARGET: i686-pc-windows-gnu
MINGW_DIR: mingw32
ALLOW_PR: 1
- TARGET: x86_64-pc-windows-gnu
MINGW_DIR: mingw64
ALLOW_PR: 1
branches:
only:
- master
- auto

install:
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- rustc -Vv
- cargo -V
# If this is a PR and we're not allowed to test PRs, skip the whole build.
# Also if we're on the master branch no need to run the full test suite, so
# just do a smoke test.
- if defined APPVEYOR_PULL_REQUEST_NUMBER if NOT defined ALLOW_PR appveyor exit
- if "%APPVEYOR_REPO_BRANCH%" == "master" if NOT defined ALLOW_PR appveyor exit

test_script:
- cargo build
- cargo test
# Install MSYS2 and MINGW (32-bit & 64-bit)
- ps: |
# Check if MSYS2 was restored from cache
if($env:MINGW_DIR) {
if($env:MINGW_DIR -eq "mingw32") {
# Download and install MINGW (32-bit)
Write-Host "Installing MinGW (32-bit)..." -ForegroundColor Cyan
Write-Host "Downloading installation package..."
appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z -FileName mingw.7z
} elseif($env:MINGW_DIR -eq "mingw64") {
# Download and install MINGW (64-bit)
Write-Host "Installing MinGW (64-bit)..." -ForegroundColor Cyan
Write-Host "Downloading installation package..."
appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z -FileName mingw.7z
}
Write-Host "Extracting installation package..."
7z x -y mingw.7z -oC:\msys64 | Out-Null
del mingw.7z
} else {
Write-Host "MSYS2 not required" -ForegroundColor Green
}
# Install rust, x86_64-pc-windows-msvc host
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -y --default-host=x86_64-pc-windows-msvc
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin

# Install the target we're compiling for
- if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET%

# add mingw to PATH if necessary
- if defined MINGW_DIR set PATH=C:\msys64\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%

# set cargo features for MSI if requested (otherwise empty string)
- set FEATURES=
- if defined BUILD_MSI set FEATURES=--features msi-installed

# let's see what we got
- where gcc rustc cargo
- rustc -vV
- cargo -vV

# 'cargo test' takes care of building for us, so disable Appveyor's build stage. This prevents
# the "directory does not contain a project or solution file" error.
# source: https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml#L113
build: false

# For now disable the AppVeyor cache since it seems to be causing build problems
# but should eventually be re-enabled once the issues get resolved.
cache:
- C:\Users\appveyor\.cargo\registry
# - target
test_script:
- cargo build
- cargo test
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ matrix:
allow_failures:
- rust: nightly

before_install:
- sudo apt-get -qq update
- sudo apt-get install -y cmake
- sudo apt-get install -y libgtk-3-dev

before_cache: |
if [[ "$TRAVIS_RUST_VERSION" == nightly ]]; then
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin -f
fi
script:
- cargo clean
- cargo build
- cargo test

Expand Down
2 changes: 1 addition & 1 deletion src/bin/golden-frieza.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn main() {
));

// Initialize the UI
let ui = UI::init().unwrap();
let ui = UI::init().expect("Cannot initialize the UI");

let mut horizontal_box = HorizontalBox::new(&ui);

Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ impl Document {
pub fn from_website(url: &str) -> Document {
// TODO: Handle errors and exceptions

let mut request = reqwest::get(url).unwrap();
let page_content = request.text().unwrap();
let mut request = reqwest::get(url).expect("URL not valid");
let page_content = request.text().expect("Cannot parse page content");

#[cfg_attr(rustfmt, rustfmt_skip)]
let tags: HashSet<_> = [
Expand All @@ -115,7 +115,7 @@ impl Document {
.to_string();

// Remove newlines ecc
let re = Regex::new(r"\n|\r|\t").unwrap();
let re = Regex::new(r"\n|\r|\t").expect("Invalid regex");
let clean_text = re.replace_all(&clean_text, "").to_string();

println!("RESULT: {:?}", &clean_text);
Expand All @@ -131,10 +131,10 @@ impl Element for Color {
let mut dictionary = ReaderBuilder::new()
.delimiter(b';')
.from_path(path)
.unwrap();
.expect("Cannot build the dictionary");

for result in dictionary.deserialize() {
let record: (String, String) = result.unwrap();
let record: (String, String) = result.expect("Cannot deserialize the dictionary");

let color = record.0;
let words: Vec<String> = Vec::from_iter(record.1.split(", ").map(String::from));
Expand Down

0 comments on commit 10449b0

Please sign in to comment.