Skip to content

Set up CI with Azure Pipelines #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# git2-rs

[![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)

[Documentation](https://docs.rs/git2)

libgit2 bindings for Rust
Expand Down
19 changes: 0 additions & 19 deletions appveyor.yml

This file was deleted.

49 changes: 49 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
trigger:
- master

jobs:
- job: MSRV
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-install-rust.yml
- script: cargo build
displayName: "Build crate"
variables:
TOOLCHAIN: 1.32.0

- job: Linux
pool:
vmImage: ubuntu-16.04
steps:
- template: ci/azure-test-all.yml
strategy:
matrix:
stable:
TOOLCHAIN: stable
beta:
TOOLCHAIN: beta
nightly:
TOOLCHAIN: nightly

- job: macOS
pool:
vmImage: macos-10.13
steps:
- template: ci/azure-test-all.yml
strategy:
matrix:
x86_64:
TARGET: x86_64-apple-darwin

- job: Windows
pool:
vmImage: vs2017-win2016
steps:
- template: ci/azure-test-all.yml
strategy:
matrix:
x86_64-msvc:
TARGET: x86_64-pc-windows-msvc
i686-msvc:
TARGET: i686-pc-windows-msvc
23 changes: 23 additions & 0 deletions ci/azure-install-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
steps:
- bash: |
set -e
toolchain=$TOOLCHAIN
if [ "$toolchain" = "" ]; then
toolchain=stable
fi
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain
echo "##vso[task.prependpath]$HOME/.cargo/bin"
displayName: Install rust (unix)
condition: ne( variables['Agent.OS'], 'Windows_NT' )

- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain stable-%TARGET%
echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin
displayName: Install rust (windows)
condition: eq( variables['Agent.OS'], 'Windows_NT' )

- script: |
rustc -Vv
cargo -V
displayName: Query rust and cargo versions
11 changes: 11 additions & 0 deletions ci/azure-test-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
steps:
- template: azure-install-rust.yml

- bash: cargo test --no-default-features
displayName: "cargo test --no-default-features"
- bash: cargo test
displayName: "cargo test"
- bash: cargo run --manifest-path systest/Cargo.toml
displayName: "run systest"
- bash: cargo test --manifest-path git2-curl/Cargo.toml
displayName: "test git2-curl"
11 changes: 8 additions & 3 deletions src/cred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl CredentialHelper {
}
}

#[cfg(all(test, feature = "unstable"))]
#[cfg(test)]
mod test {
use std::env;
use std::fs::File;
Expand Down Expand Up @@ -467,6 +467,8 @@ mod test {

#[test]
fn credential_helper4() {
if cfg!(windows) { return } // shell scripts don't work on Windows

let td = TempDir::new("git2-rs").unwrap();
let path = td.path().join("script");
File::create(&path).unwrap().write(br"\
Expand All @@ -488,6 +490,7 @@ echo username=c

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

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

#[test]
#[cfg(feature = "ssh")]
fn ssh_key_from_memory() {
let cred = Cred::ssh_key_from_memory(
"test",
Expand All @@ -551,7 +556,7 @@ echo password=$2
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,818C7722D3B01F2161C2ACF6A5BBAAE8

3Cht4QB3PcoQ0I55j1B3m2ZzIC/mrh+K5nQeA1Vy2GBTMyM7yqGHqTOv7qLhJscd
H+cB0Pm6yCr3lYuNrcKWOCUto+91P7ikyARruHVwyIxKdNx15uNulOzQJHQWNbA4
RQHlhjON4atVo2FyJ6n+ujK6QiBg2PR5Vbbw/AtV6zBCFW3PhzDn+qqmHjpBFqj2
Expand Down Expand Up @@ -582,7 +587,7 @@ echo password=$2
Some("test123"));
assert!(cred.is_ok());
}


#[cfg(unix)]
fn chmod(path: &Path) {
Expand Down
22 changes: 0 additions & 22 deletions src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ thread_local!(static LAST_ERROR: RefCell<Option<Box<Any + Send>>> = {
RefCell::new(None)
});

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

#[cfg(not(feature = "unstable"))]
pub fn wrap<T, F: FnOnce() -> T>(f: F) -> Option<T> {
struct Bomb {
enabled: bool,
}
impl Drop for Bomb {
fn drop(&mut self) {
if !self.enabled {
return
}
panic!("callback has panicked, and continuing to unwind into C \
is not safe, so aborting the process");

}
}
let mut bomb = Bomb { enabled: true };
let ret = Some(f());
bomb.enabled = false;
ret
}

pub fn check() {
let err = LAST_ERROR.with(|slot| slot.borrow_mut().take());
if let Some(err) = err {
Expand Down