Commit 81e3e4b7 authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot

Merge topic 'add-gitlab-ci'

b3ebaf76 gitlab-ci: add port of buildbot as gitlab-ci
afdc70cc rust: fix compilation on 1.32.0
9cd548bd prepare: silence clippy
a7e7b39d rustfmt: remove stray trailing comma
18ce92ed cargo: update itertools to 0.8
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !64
parents c3161bb6 b3ebaf76
before_script:
- apt-get update -yqq
- export CARGO_HOME=.cargo-cache
- rustc --version
- cargo --version
.rust_tags: &rust_tags
- rust
- docker
- ghostflow
- linux
.cargo_update: &cargo_update
- cargo generate-lockfile $GENERATE_LOCKFILE_ARGS
- cargo fetch --locked
.cargo_build: &cargo_build
- cargo build $CARGO_BUILD_FROZEN --all --verbose
- cargo test --frozen --all --no-run --verbose
.cargo_test: &cargo_test
- apt-get install -yqq --no-install-recommends git
- git config --global user.name "Ghostflow Testing"
- git config --global user.email "ghostflow@example.invalid"
- cargo test --frozen --all --verbose
.rust_minimum: &rust_minimum
image: "rust:1.32.0"
variables:
# Not supported yet here? If updating to a version where this works,
# remove this variable.
#CARGO_BUILD_FROZEN: --frozen
CARGO_UPDATE_POLICY: newest
.rust_stable: &rust_stable
image: "rust:latest"
variables:
CARGO_BUILD_FROZEN: --frozen
CARGO_UPDATE_POLICY: newest
.rust_nightly: &rust_nightly
extends: .rust_stable
image: "rustlang/rust:nightly"
.cargo_fetch_job: &cargo_fetch_job
stage: prepare
tags: *rust_tags
script: *cargo_update
artifacts:
expire_in: 60m
paths:
- .cargo-cache
- Cargo.lock
cache:
key: cargo-cache-$CARGO_UPDATE_POLICY
paths:
- .cargo-cache
interruptible: true
.cargo_build_job: &cargo_build_job
stage: build
tags: *rust_tags
script: *cargo_build
artifacts:
expire_in: 60m
paths:
- .cargo-cache
- Cargo.lock
- target
cache:
key: build-cache-$CI_JOB_NAME
paths:
- target
interruptible: true
.cargo_test_job: &cargo_test_job
stage: test
tags: *rust_tags
script: *cargo_test
interruptible: true
stages:
- prepare
- build
- test
prepare:cargo-cache-newest:
<<:
- *cargo_fetch_job
- *rust_stable
prepare:cargo-cache-mindeps:
<<:
- *cargo_fetch_job
- *rust_nightly
variables:
GENERATE_LOCKFILE_ARGS: "-Z minimal-versions"
CARGO_UPDATE_POLICY: mindeps
.cargo_cache_newest: &cargo_cache_newest
dependencies:
- prepare:cargo-cache-newest
needs:
- prepare:cargo-cache-newest
build:cargo-clippy:
<<:
- *cargo_build_job
- *rust_stable
- *cargo_cache_newest
script:
- rustup component add clippy
- cargo clippy --frozen --tests --all --verbose -- -D warnings
build:cargo-minimum:
<<:
- *cargo_build_job
- *rust_minimum
- *cargo_cache_newest
test:cargo-minimum:
<<:
- *cargo_test_job
- *rust_minimum
dependencies:
- build:cargo-minimum
needs:
- build:cargo-minimum
build:cargo-stable:
<<:
- *cargo_build_job
- *rust_stable
- *cargo_cache_newest
test:cargo-stable:
<<:
- *cargo_test_job
- *rust_stable
dependencies:
- build:cargo-stable
needs:
- build:cargo-stable
build:cargo-nightly:
<<:
- *cargo_build_job
- *rust_nightly
- *cargo_cache_newest
test:cargo-nightly:
<<:
- *cargo_test_job
- *rust_nightly
dependencies:
- build:cargo-nightly
needs:
- build:cargo-nightly
build:cargo-mindeps:
<<:
- *cargo_build_job
- *rust_minimum
dependencies:
- prepare:cargo-cache-mindeps
needs:
- prepare:cargo-cache-mindeps
test:cargo-mindeps:
<<:
- *cargo_test_job
- *rust_minimum
dependencies:
- build:cargo-mindeps
needs:
- build:cargo-mindeps
prepare:git:
image: "rust:latest"
stage: prepare
tags: *rust_tags
script:
- export GIT_ROOT=$PWD/git/root
- "[ -d git ] || git clone https://github.com/git/git.git git/src"
- pushd git/src
- git reset --hard
- git pull
- make prefix=$GIT_ROOT NO_GETTEXT=1 NO_TCLTK=1 NO_INSTALL_HARDLINKS=1 -j`nproc` install
- popd
variables:
GIT_STRATEGY: none
artifacts:
expire_in: 60m
paths:
- git/root
cache:
key: git-master
paths:
- git/src
interruptible: true
test:git-master:
<<:
- *cargo_test_job
- *rust_stable
script:
- git config --global user.name "Ghostflow Testing"
- git config --global user.email "ghostflow@example.invalid"
- PATH=$PWD/git/root/bin:$PATH cargo test --frozen --all --verbose
dependencies:
- prepare:git
- build:cargo-stable
needs:
- prepare:git
- build:cargo-stable
......@@ -13,7 +13,7 @@ readme = "README.md"
keywords = ["git", "utility"]
[dev-dependencies]
itertools = "~0.7"
itertools = "~0.8"
[dependencies]
lazy_static = "^1.1"
......
......@@ -151,7 +151,8 @@ impl Identity {
impl Clone for Identity {
fn clone(&self) -> Self {
Self::new(&self.name, &self.email)
// XXX(1.36.0): These can be `&self.<field>` in 1.36.0.
Self::new(self.name.clone(), self.email.clone())
}
}
......
......@@ -407,7 +407,7 @@ impl PreparingGitWorkArea {
.map_err(WorkAreaError::temp_directory)?;
let workarea = Self {
context: context,
context,
dir: tempdir,
};
......@@ -613,7 +613,7 @@ impl GitWorkArea {
let mut gitfile = File::create(gitfiledir.join(".git")).map_err(|err| {
WorkAreaError::submodule(SubmoduleIntent::CreateGitFile, name as &str, err)
})?;
write!(gitfile, "gitdir: {}\n", gitdir.display()).map_err(|err| {
writeln!(gitfile, "gitdir: {}", gitdir.display()).map_err(|err| {
WorkAreaError::submodule(SubmoduleIntent::WriteGitFile, name as &str, err)
})?;
}
......
......@@ -425,10 +425,12 @@ fn test_work_area_setup_submodule() {
config
.iter()
.map(|(key, value)| (key.as_str(), value.as_str()))
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0)),
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0))
.collect::<Vec<_>>(),
)
})
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0));
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0))
.collect::<Vec<_>>();
assert_eq!(
submodule_config,
......@@ -438,7 +440,7 @@ fn test_work_area_setup_submodule() {
("path", "submodule"),
("url", "https://gitlab.kitware.com/utils/test-repo.git"),
]
),],
)],
);
}
......@@ -461,10 +463,12 @@ fn test_work_area_setup_submodule_custom_name() {
config
.iter()
.map(|(key, value)| (key.as_str(), value.as_str()))
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0)),
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0))
.collect::<Vec<_>>(),
)
})
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0));
.sorted_by(|ref a, ref b| Ord::cmp(&a.0, &b.0))
.collect::<Vec<_>>();
assert_eq!(
submodule_config,
......@@ -474,7 +478,7 @@ fn test_work_area_setup_submodule_custom_name() {
("path", "submodule"),
("url", "https://gitlab.kitware.com/utils/test-repo.git"),
]
),],
)],
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment