Skip to content

Commit

Permalink
initial work on git2 stuff (#34)
Browse files Browse the repository at this point in the history
* initial work on git2 stuff

* tracking down error

* fixed detached head issue with branch

* clippy lints

* fix broken tests with git feature disabled

* fix clippy lint that's only in nightly

* testing

* feature coverage

* enum iterator

* error test coverage

* error test coverage

* error test coverage

* restructure impl Config for features

* add submodule repo for testing

* removed submodule to re-add from github

* Updated to use submodule from github

* refactored gen back to toplevel

* checkout master in submodule to cover regular branch name

* typo in .travis.yml

* another bug in .travis.yml

* added another repo for 'git describe' testing

* fixed shadowing bug in vergen::Error

* convert_err introduced

* initial gen output, some error refactoring

* feature snafu

* another feature snafu

* refactor for better coverage

* better semver

* fetch tags in submodules for testing

* remove old output

* fixed feature snafus

* feature test, formatting

* removed unused constants, added rustc commit has

* Added remaining rustc meta

* docs, constant normalization

* fixed feature snafus

* clippy lints, windows test fix

* testing

* README.md

* Removed un-needed extern crate from doc example

* more extensive testing for git instructions

* added some feature fun to lib.rs

* cargo fmt

* cargo fmt

* Check that removed key returns empty string

* initial actions

* actions, moar actions

* Update README.md

* trying the tarpaulin

* tarpaulin only on linux

* tarpaulin only on linux

* codecov

* Update README.md

* Update README.md

* more actions work

* added detached head test

* stupid stuff

* cache ~/.cargo/bin dir

* remove travis and gitlab config

* allow to continue if install fails, likely because already exists

* added support for cargo-all-features

* added clippy

* cargo-all-features in all of matrix

* updated caching

* Chaged hashfile for cache for library

* cache key update, reordered so Cargo.toml exists for cache

* additional instruction testing

* tweaking cache again, causing failed builds

* added rustversion to support testing diffs between nightly and beta/stable

* added single toggle check.  todo to make macro to check more toggles

* cargo fmt

Co-authored-by: Jason Ozias <jason.ozias@kroger.com>
Co-authored-by: Jason Ozias <jason.ozias@gmail.com>
  • Loading branch information
3 people committed Feb 13, 2021
1 parent 43a767d commit 8e54d0c
Show file tree
Hide file tree
Showing 25 changed files with 1,747 additions and 873 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,104 @@
on: [push]

name: CI

jobs:
test:
name: vergen
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
rust: stable
other: i686-unknown-linux-gnu
- os: ubuntu-latest
rust: beta
other: i686-unknown-linux-gnu
- os: ubuntu-latest
rust: nightly
other: i686-unknown-linux-gnu
- os: macos-latest
rust: stable
other: x86_64-apple-ios
- os: macos-latest
rust: beta
other: x86_64-apple-ios
- os: macos-latest
rust: nightly
other: x86_64-apple-ios
- os: windows-latest
rust: stable-msvc
other: i686-pc-windows-msvc
- os: windows-latest
rust: beta-msvc
other: i686-pc-windows-msvc
- os: windows-latest
rust: nightly-msvc
other: i686-pc-windows-msvc
- os: windows-latest
rust: stable-gnu
other: i686-pc-windows-gnu
- os: windows-latest
rust: beta-gnu
other: i686-pc-windows-gnu
- os: windows-latest
rust: nightly-gnu
other: i686-pc-windows-gnu
steps:
- name: ✔️ Checkout ✔️
uses: actions/checkout@v2
with:
submodules: recursive
- name: 💵 Cache 💵
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/cargo-tarpaulin*
~/.cargo/bin/cargo-*-all-features*
key: ${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
- name: ✔️ Checkout (notagsrepo master) ✔️
run: cd testdata/notagsrepo && git checkout master && cd ..
- name: ✔️ Checkout (tagsrepo master) ✔️
run: cd testdata/tagsrepo && git checkout master && cd ..
- name: ✔️ Checkout (detachedhead v0.0.1) ✔️
run: cd testdata/detachedhead && git checkout v0.0.1 && cd ..
- name: 🐕 Fetch 🐕
run: git submodule foreach --recursive 'git fetch --tags'
- name: 💾 Install (cargo-tarpaulin) 💾
uses: actions-rs/install@v0.1
if: matrix.os == 'ubuntu-latest'
with:
crate: cargo-tarpaulin
version: latest
use-tool-cache: true
continue-on-error: true
- name: 💾 Install (cargo-all-features) 💾
uses: actions-rs/install@v0.1
with:
crate: cargo-all-features
version: latest
use-tool-cache: true
continue-on-error: true
- name: 📅 Update 📅
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: ➕ Add ➕
run: rustup component add rustfmt || echo "rustfmt not available"
- name: ➕ Add ➕
run: rustup component add clippy || echo "clippy not available"
- name: ☢️ Formatting ☢️
run: cargo fmt --all -- --check
- name: 🕳️ Lints 🕳️
run: cargo clippy --all -- -D warnings
- name: 🏗️ Build 🏗️
run: cargo build-all-features
- name: 🧪 Test 🧪
run: cargo test-all-features
- name: 🙊 Code Coverage 🙊
if: matrix.os == 'ubuntu-latest'
run: cargo tarpaulin --out Xml
- name: 🙊 Upload Code Coverage 🙊
uses: codecov/codecov-action@v1
if: matrix.os == 'ubuntu-latest'
with:
files: ./cobertura.xml
33 changes: 0 additions & 33 deletions .gitlab-ci.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .gitmodules
@@ -0,0 +1,9 @@
[submodule "testdata/notagsrepo"]
path = testdata/notagsrepo
url = https://github.com/rustyhorde/notagsrepo.git
[submodule "testdata/tagsrepo"]
path = testdata/tagsrepo
url = https://github.com/rustyhorde/tagsrepo.git
[submodule "testdata/detachedhead"]
path = testdata/detachedhead
url = https://github.com/rustyhorde/detachedhead.git
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

25 changes: 22 additions & 3 deletions Cargo.toml
Expand Up @@ -12,10 +12,29 @@ readme = "README.md"
repository = "https://github.com/rustyhorde/vergen"
version = "3.2.0"

[features]
default = ["build", "git", "rustc"]
build = ["chrono"]
git = ["chrono", "git2"]
rustc = ["rustc_version"]

[dependencies]
bitflags = "1"
chrono = "0"
rustc_version = "0"
chrono = { version = "0", optional = true }
getset = "0"
git2 = { version = "0", optional = true }
rustc_version = { version = "0", optional = true }
serde = "1"
serde_derive = "1"
enum-iterator = "0.6.0"

[build-dependencies]
chrono = "0"
chrono = "0"

[dev-dependencies]
lazy_static = "1"
regex = "1"
rustversion = "1"

[package.metadata.cargo-all-features]
skip_optional_dependencies = true
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -7,15 +7,15 @@
## Build Status
| | |
---------------|-----------------------------------------------------------------------------------|
| Github | ![CI](https://github.com/rustyhorde/vergen/workflows/CI/badge.svg) |
| Travis | [![Build Status](https://travis-ci.com/rustyhorde/vergen.svg?branch=master)](https://travis-ci.com/rustyhorde/vergen)|
| GitLab CI/CD | [![pipeline status](https://gitlab.com/rustyhorde/vergen/badges/master/pipeline.svg)](https://gitlab.com/rustyhorde/vergen/commits/master)|
| Appveyor | [![Build status](https://ci.appveyor.com/api/projects/status/fjliwvxqayyecl1j?svg=true)](https://ci.appveyor.com/project/CraZySacX/vergen)|

## Code Coverage
[![codecov](https://codecov.io/gh/rustyhorde/vergen/branch/master/graph/badge.svg?token=cBXro7o2UN)](https://codecov.io/gh/rustyhorde/vergen)
[![Coverage Status](https://coveralls.io/repos/github/rustyhorde/vergen/badge.svg?branch=master)](https://coveralls.io/github/rustyhorde/vergen?branch=master)

## Documentation
[Documentation](https://docs.rs/vergen)
[Documentation](https://docs.rs/vergen) can be found on [docs.rs](https://docs.rs/vergen)

## Example Usage
See the documentation at [docs.rs](https://docs.rs/vergen/3.2.0/vergen/#cargo-key-build-script-output) for example usage
Expand Down
129 changes: 0 additions & 129 deletions appveyor.yml

This file was deleted.

5 changes: 4 additions & 1 deletion build.rs
@@ -1,7 +1,10 @@
use chrono::Utc;

pub fn main() {
let now = chrono::Utc::now();
let now = Utc::now();
println!(
"cargo:rustc-env=VERGEN_BUILD_TIMESTAMP={}",
now.to_rfc3339()
);
println!("cargo:rustc-env=VERGEN_GIT_SEMVER=v3.2.0-86-g95fc0f5");
}

0 comments on commit 8e54d0c

Please sign in to comment.