Skip to content

Commit d73507e

Browse files
authored
Merge pull request #846 from UK992/appveyor
Setup Appveyor
2 parents bb62ad6 + b109a41 commit d73507e

File tree

4 files changed

+126
-9
lines changed

4 files changed

+126
-9
lines changed

appveyor.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
environment:
2+
RUST_BACKTRACE: 1
3+
RUST_CHANNEL: "%Configuration%"
4+
matrix:
5+
- TARGET: gnu
6+
LLVM_VERSION: 3.9.0-2
7+
BINDGEN_FEATURES: testing_only_libclang_3_9
8+
- TARGET: gnu
9+
LLVM_VERSION: 4.0.0-1
10+
BINDGEN_FEATURES: testing_only_libclang_4
11+
- TARGET: msvc
12+
LLVM_VERSION: 3.9.0
13+
BINDGEN_FEATURES: testing_only_libclang_3_9
14+
- TARGET: msvc
15+
LLVM_VERSION: 4.0.0
16+
BINDGEN_FEATURES: testing_only_libclang_4
17+
18+
configuration:
19+
- stable
20+
- nightly
21+
22+
platform:
23+
- x64
24+
- x86
25+
26+
branches:
27+
only:
28+
- master
29+
30+
install:
31+
- if %PLATFORM% == x86 (set RUST_PLATFORM=i686&set MINGW_BITS=32) else (set RUST_PLATFORM=x86_64&set MINGW_BITS=64)
32+
- echo %RUST_CHANNEL%
33+
- echo %RUST_PLATFORM%
34+
- echo %MINGW_BITS%
35+
- echo %RUST_PLATFORM%-pc-windows-%TARGET%
36+
# install Rust
37+
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
38+
- rustup-init.exe -y --default-host %RUST_PLATFORM%-pc-windows-%TARGET% --default-toolchain %RUST_CHANNEL%
39+
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
40+
# install LLVM for GNU
41+
- if %TARGET%==gnu set PATH=C:\msys64\mingw%MINGW_BITS%\bin;C:\msys64\usr\bin\;%PATH%
42+
- if %TARGET%==gnu set "MINGW_URL=http://repo.msys2.org/mingw/%RUST_PLATFORM%/mingw-w64-%RUST_PLATFORM%"
43+
- if %TARGET%==gnu set "URL_VER=%LLVM_VERSION%-any.pkg.tar.xz"
44+
- if %TARGET%==gnu bash -lc "pacman -U --noconfirm $MINGW_URL-clang-$URL_VER $MINGW_URL-llvm-$URL_VER"
45+
- if %TARGET%==gnu bash -lc "clang --version"
46+
# install LLVM for MSVC
47+
- if %TARGET%==msvc appveyor-retry appveyor DownloadFile http://releases.llvm.org/%LLVM_VERSION%/LLVM-%LLVM_VERSION%-win64.exe -FileName llvm-installer.exe
48+
- if %TARGET%==msvc 7z x llvm-installer.exe -oc:\llvm-binary
49+
- if %TARGET%==msvc set PATH=C:\llvm-binary\bin;%PATH%
50+
- if %TARGET%==msvc where clang
51+
- if %TARGET%==msvc clang --version
52+
53+
build_script:
54+
- if %TARGET%==msvc .\ci\test.bat
55+
- if %TARGET%==gnu bash -lc "export BINDGEN_FEATURES=$BINDGEN_FEATURES; cd $APPVEYOR_BUILD_FOLDER; ./ci/test.sh"
56+
57+
test: off

ci/assert-no-diff.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
3+
cd "%~dp0.."
4+
5+
git add -u
6+
git diff @
7+
git diff-index --quiet HEAD

ci/test.bat

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@echo off
2+
3+
cd "%~dp0.."
4+
5+
set RUST_BACKTRACE=1
6+
7+
if not defined BINDGEN_FEATURES (
8+
echo Environment variable BINDGEN_FEATURES must be defined.
9+
exit /B 1
10+
)
11+
12+
findstr /r /c:"#include *<.*>" tests\headers\* >nul 2>&1 && (
13+
echo Found a test with an #include directive of a system header file!
14+
echo.
15+
echo There is no guarantee that the system running the tests has the header
16+
echo file, let alone the same version of it that you have. Any test with such an
17+
echo include directive won't reliably produce the consistent bindings across systems.
18+
exit /B 1
19+
) || (
20+
echo Found none. OK!
21+
set ERRORLEVEL=0
22+
)
23+
24+
@echo on
25+
26+
::Regenerate the test headers' bindings in debug and release modes, and assert
27+
::that we always get the expected generated bindings.
28+
29+
cargo test --features "%BINDGEN_FEATURES%" || exit /b 1
30+
call .\ci\assert-no-diff.bat
31+
32+
cargo test --features "%BINDGEN_FEATURES% testing_only_extra_assertions" || exit /b 1
33+
call .\ci\assert-no-diff.bat
34+
35+
cargo test --release --features "%BINDGEN_FEATURES% testing_only_extra_assertions" || exit /b 1
36+
call .\ci\assert-no-diff.bat
37+
38+
::Now test the expectations' size and alignment tests.
39+
40+
pushd tests\expectations
41+
cargo test || exit /b 1
42+
cargo test --release || exit /b 1
43+
popd
44+
45+
::And finally, test our example bindgen + build.rs integration template project.
46+
47+
cd bindgen-integration
48+
cargo test --features "%BINDGEN_FEATURES%" || exit /b 1
49+
cargo test --release --features "%BINDGEN_FEATURES%" || exit /b 1

ci/test.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ cargo test --features "$BINDGEN_FEATURES testing_only_extra_assertions"
2020
cargo test --release --features "$BINDGEN_FEATURES testing_only_extra_assertions"
2121
./ci/assert-no-diff.sh
2222

23-
# Now test the expectations' size and alignment tests.
23+
if [ -v "${TRAVIS_OS_NAME}" ]; then
2424

25-
pushd tests/expectations
26-
cargo test
27-
cargo test --release
28-
popd
25+
# Now test the expectations' size and alignment tests.
2926

30-
# And finally, test our example bindgen + build.rs integration template project.
27+
pushd tests/expectations
28+
cargo test
29+
cargo test --release
30+
popd
3131

32-
cd bindgen-integration
33-
cargo test --features "$BINDGEN_FEATURES"
34-
cargo test --release --features "$BINDGEN_FEATURES"
32+
# And finally, test our example bindgen + build.rs integration template project.
33+
34+
cd bindgen-integration
35+
cargo test --features "$BINDGEN_FEATURES"
36+
cargo test --release --features "$BINDGEN_FEATURES"
37+
38+
fi

0 commit comments

Comments
 (0)