|
| 1 | +# Appveyor configuration template for Rust using rustup for Rust installation |
| 2 | +# https://github.com/starkat99/appveyor-rust |
| 3 | + |
| 4 | +## Operating System (VM environment) ## |
| 5 | + |
| 6 | +# Rust needs at least Visual Studio 2013 Appveyor OS for MSVC targets. |
| 7 | +os: Visual Studio 2015 |
| 8 | + |
| 9 | +## Build Matrix ## |
| 10 | +environment: |
| 11 | + matrix: |
| 12 | + |
| 13 | +### MSVC Targets ### |
| 14 | + # Stable 64-bit MSVC |
| 15 | + # - channel: stable |
| 16 | + # toolchain: stable-x86_64-pc-windows-msvc |
| 17 | + # target: x86_64-pc-windows-msvc |
| 18 | + # target_env: msvc |
| 19 | + # mingw_subdir: mingw64 |
| 20 | + # mingw_target: x86_64-w64-mingw32 |
| 21 | + # mingw_package_prefix: mingw-w64-x86_64 |
| 22 | + # Stable 32-bit MSVC |
| 23 | + # - channel: stable |
| 24 | + # toolchain: stable-i686-pc-windows-msvc |
| 25 | + # target: i686-pc-windows-msvc |
| 26 | + # target_env: msvc |
| 27 | + # mingw_subdir: mingw32 |
| 28 | + # mingw_target: i686-w64-mingw32 |
| 29 | + # mingw_package_prefix: mingw-w64-i686 |
| 30 | + |
| 31 | +### GNU Targets ### |
| 32 | + # Stable 64-bit GNU |
| 33 | + - channel: stable |
| 34 | + toolchain: stable-x86_64-pc-windows-msvc |
| 35 | + target: x86_64-pc-windows-gnu |
| 36 | + target_env: gnu |
| 37 | + mingw_subdir: mingw64 |
| 38 | + mingw_target: x86_64-w64-mingw32 |
| 39 | + mingw_package_prefix: mingw-w64-x86_64 |
| 40 | + # Stable 32-bit GNU |
| 41 | + # - channel: stable |
| 42 | + # toolchain: stable-i686-pc-windows-msvc |
| 43 | + # target: i686-pc-windows-gnu |
| 44 | + # target_env: gnu |
| 45 | + # mingw_subdir: mingw32 |
| 46 | + # mingw_target: i686-w64-mingw32 |
| 47 | + # mingw_package_prefix: mingw-w64-i686 |
| 48 | + |
| 49 | +cache: |
| 50 | + - '%USERPROFILE%\.cargo\bin' |
| 51 | + - '%USERPROFILE%\.cargo\config' |
| 52 | + - '%USERPROFILE%\.cargo\env' |
| 53 | + - '%USERPROFILE%\.cargo\.crates.toml' |
| 54 | + - target |
| 55 | + |
| 56 | +## Install Script ## |
| 57 | + |
| 58 | +# This is the most important part of the Appveyor configuration. This installs the version of Rust |
| 59 | +# specified by the 'channel' and 'target' environment variables from the build matrix. This uses |
| 60 | +# rustup to install Rust. |
| 61 | +# |
| 62 | +# For simple configurations, instead of using the build matrix, you can simply set the |
| 63 | +# default-toolchain and default-host manually here. |
| 64 | +install: |
| 65 | + - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe |
| 66 | + - rustup-init -yv --default-toolchain %channel%-msvc --default-host %target% |
| 67 | + - set PATH=%PATH%;%USERPROFILE%\.cargo\bin |
| 68 | + - set PATH=C:\msys64\%mingw_subdir%\bin;C:\msys64\usr\bin;%PATH% |
| 69 | + - rustup target add %target% |
| 70 | + - rustup component add rust-src |
| 71 | + - pacman -S --noconfirm "%mingw_package_prefix%-fontconfig" "%mingw_package_prefix%-freetype" "%mingw_package_prefix%-icu" |
| 72 | + - rustc -vV |
| 73 | + - cargo -vV |
| 74 | + |
| 75 | +## Build Script ## |
| 76 | + |
| 77 | +# 'cargo test' takes care of building for us, so disable Appveyor's build stage. This prevents |
| 78 | +# the "directory does not contain a project or solution file" error. |
| 79 | +build: false |
| 80 | + |
| 81 | +before_test: |
| 82 | + - set RUST_BACKTRACE=1 |
| 83 | + # Building on msvc toolchain is seen as cross compilation. |
| 84 | + - set PKG_CONFIG_ALLOW_CROSS=1 |
| 85 | + # Workaround rust#53454 |
| 86 | + - if "%target_env%" == "gnu" copy /y "C:\msys64\%mingw_subdir%\%mingw_target%\lib\crt2.o" %USERPROFILE%\.rustup\toolchains\%toolchain%\lib\rustlib\%target%\lib\crt2.o" |
| 87 | + - if "%target_env%" == "gnu" copy /y "C:\msys64\%mingw_subdir%\%mingw_target%\lib\dllcrt2.o" %USERPROFILE%\.rustup\toolchains\%toolchain%\lib\rustlib\%target%\lib\dllcrt2.o" |
| 88 | + |
| 89 | +# Uses 'cargo test' to run tests and build. Alternatively, the project may call compiled programs |
| 90 | +# directly or perform other testing commands. Rust will automatically be placed in the PATH |
| 91 | +# environment variable. |
| 92 | +test_script: |
| 93 | + - cargo test --target %target% |
0 commit comments