Skip to content

Commit 1222d37

Browse files
committed
Set up CI with Azure Pipelines
1 parent 6cdcf1e commit 1222d37

File tree

8 files changed

+93
-73
lines changed

8 files changed

+93
-73
lines changed

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# git2-rs
22

3+
[![Build Status](https://dev.azure.com/rust-lang/git2-rs/_apis/build/status/rust-lang.git2-rs?branchName=master)](https://dev.azure.com/rust-lang/git2-rs/_build/latest?definitionId=9&branchName=master)
4+
35
[Documentation](https://docs.rs/git2)
46

57
libgit2 bindings for Rust

appveyor.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
trigger:
2+
- master
3+
4+
jobs:
5+
- job: MSRV
6+
pool:
7+
vmImage: ubuntu-16.04
8+
steps:
9+
- template: ci/azure-install-rust.yml
10+
- script: cargo build
11+
displayName: "Build crate"
12+
variables:
13+
TOOLCHAIN: 1.32.0
14+
15+
- job: Linux
16+
pool:
17+
vmImage: ubuntu-16.04
18+
steps:
19+
- template: ci/azure-test-all.yml
20+
strategy:
21+
matrix:
22+
stable:
23+
TOOLCHAIN: stable
24+
beta:
25+
TOOLCHAIN: beta
26+
nightly:
27+
TOOLCHAIN: nightly
28+
29+
- job: macOS
30+
pool:
31+
vmImage: macos-10.13
32+
steps:
33+
- template: ci/azure-test-all.yml
34+
strategy:
35+
matrix:
36+
x86_64:
37+
TARGET: x86_64-apple-darwin
38+
39+
- job: Windows
40+
pool:
41+
vmImage: vs2017-win2016
42+
steps:
43+
- template: ci/azure-test-all.yml
44+
strategy:
45+
matrix:
46+
x86_64-msvc:
47+
TARGET: x86_64-pc-windows-msvc
48+
i686-msvc:
49+
TARGET: i686-pc-windows-msvc

ci/azure-install-rust.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
steps:
2+
- bash: |
3+
set -e
4+
toolchain=$TOOLCHAIN
5+
if [ "$toolchain" = "" ]; then
6+
toolchain=stable
7+
fi
8+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain
9+
echo "##vso[task.prependpath]$HOME/.cargo/bin"
10+
displayName: Install rust (unix)
11+
condition: ne( variables['Agent.OS'], 'Windows_NT' )
12+
13+
- script: |
14+
curl -sSf -o rustup-init.exe https://win.rustup.rs
15+
rustup-init.exe -y --default-toolchain stable-%TARGET%
16+
echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin
17+
displayName: Install rust (windows)
18+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
19+
20+
- script: |
21+
rustc -Vv
22+
cargo -V
23+
displayName: Query rust and cargo versions

ci/azure-test-all.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
steps:
2+
- template: azure-install-rust.yml
3+
4+
- bash: cargo test --no-default-features
5+
displayName: "cargo test --no-default-features"
6+
- bash: cargo test
7+
displayName: "cargo test"
8+
- bash: cargo run --manifest-path systest/Cargo.toml
9+
displayName: "run systest"
10+
- bash: cargo test --manifest-path git2-curl/Cargo.toml
11+
displayName: "test git2-curl"

src/cred.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl CredentialHelper {
408408
}
409409
}
410410

411-
#[cfg(all(test, feature = "unstable"))]
411+
#[cfg(test)]
412412
mod test {
413413
use std::env;
414414
use std::fs::File;
@@ -467,6 +467,8 @@ mod test {
467467

468468
#[test]
469469
fn credential_helper4() {
470+
if cfg!(windows) { return } // shell scripts don't work on Windows
471+
470472
let td = TempDir::new("git2-rs").unwrap();
471473
let path = td.path().join("script");
472474
File::create(&path).unwrap().write(br"\
@@ -488,6 +490,7 @@ echo username=c
488490

489491
#[test]
490492
fn credential_helper5() {
493+
if cfg!(windows) { return } // shell scripts don't work on Windows
491494
let td = TempDir::new("git2-rs").unwrap();
492495
let path = td.path().join("git-credential-script");
493496
File::create(&path).unwrap().write(br"\
@@ -524,6 +527,7 @@ echo username=c
524527

525528
#[test]
526529
fn credential_helper7() {
530+
if cfg!(windows) { return } // shell scripts don't work on Windows
527531
let td = TempDir::new("git2-rs").unwrap();
528532
let path = td.path().join("script");
529533
File::create(&path).unwrap().write(br"\
@@ -543,6 +547,7 @@ echo password=$2
543547
}
544548

545549
#[test]
550+
#[cfg(feature = "ssh")]
546551
fn ssh_key_from_memory() {
547552
let cred = Cred::ssh_key_from_memory(
548553
"test",
@@ -551,7 +556,7 @@ echo password=$2
551556
-----BEGIN RSA PRIVATE KEY-----
552557
Proc-Type: 4,ENCRYPTED
553558
DEK-Info: AES-128-CBC,818C7722D3B01F2161C2ACF6A5BBAAE8
554-
559+
555560
3Cht4QB3PcoQ0I55j1B3m2ZzIC/mrh+K5nQeA1Vy2GBTMyM7yqGHqTOv7qLhJscd
556561
H+cB0Pm6yCr3lYuNrcKWOCUto+91P7ikyARruHVwyIxKdNx15uNulOzQJHQWNbA4
557562
RQHlhjON4atVo2FyJ6n+ujK6QiBg2PR5Vbbw/AtV6zBCFW3PhzDn+qqmHjpBFqj2
@@ -582,7 +587,7 @@ echo password=$2
582587
Some("test123"));
583588
assert!(cred.is_ok());
584589
}
585-
590+
586591

587592
#[cfg(unix)]
588593
fn chmod(path: &Path) {

src/panic.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ thread_local!(static LAST_ERROR: RefCell<Option<Box<Any + Send>>> = {
55
RefCell::new(None)
66
});
77

8-
#[cfg(feature = "unstable")]
98
pub fn wrap<T, F: FnOnce() -> T + ::std::panic::UnwindSafe>(f: F) -> Option<T> {
109
use std::panic;
1110
if LAST_ERROR.with(|slot| slot.borrow().is_some()) {
@@ -22,27 +21,6 @@ pub fn wrap<T, F: FnOnce() -> T + ::std::panic::UnwindSafe>(f: F) -> Option<T> {
2221
}
2322
}
2423

25-
#[cfg(not(feature = "unstable"))]
26-
pub fn wrap<T, F: FnOnce() -> T>(f: F) -> Option<T> {
27-
struct Bomb {
28-
enabled: bool,
29-
}
30-
impl Drop for Bomb {
31-
fn drop(&mut self) {
32-
if !self.enabled {
33-
return
34-
}
35-
panic!("callback has panicked, and continuing to unwind into C \
36-
is not safe, so aborting the process");
37-
38-
}
39-
}
40-
let mut bomb = Bomb { enabled: true };
41-
let ret = Some(f());
42-
bomb.enabled = false;
43-
ret
44-
}
45-
4624
pub fn check() {
4725
let err = LAST_ERROR.with(|slot| slot.borrow_mut().take());
4826
if let Some(err) = err {

0 commit comments

Comments
 (0)