From d8faca70c6b3c5c8cfd93bcd592d0fc646dd4a33 Mon Sep 17 00:00:00 2001 From: samueldple <44178347+samueldple@users.noreply.github.com> Date: Thu, 29 Aug 2019 20:04:27 +0100 Subject: [PATCH 1/2] Add GitHub Action workflow --- .github/workflows/rust.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..b127475 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,17 @@ +name: Rust + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Check Formatting + run: cargo fmt --check + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose From 7be9d6e40d310b57f9b4f527151f55b0c536b1a8 Mon Sep 17 00:00:00 2001 From: samueldple Date: Thu, 29 Aug 2019 20:19:58 +0100 Subject: [PATCH 2/2] Add format check to action --- .github/workflows/rust.yml | 15 +++++++-------- CONTRIBUTING.md | 1 + bors.toml | 2 +- src/date_tuple.rs | 13 +++++++------ src/month_tuple.rs | 1 - src/time_tuple.rs | 1 - 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b127475..e1051e9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,14 +4,13 @@ on: [push] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Check Formatting - run: cargo fmt --check - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v1 + - name: Check Formatting + run: cargo fmt -- --check + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6287813..1392632 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,7 @@ Code in this repository is held to a high standard, but don't let that put you o These good practices are enforced by the following procedures: +- Continuous Integration is used to check that code is formatted correctly and all works as expected. - All PRs will be reviewed by a maintainer. Here, suggestions will be made on how to improve the code until it is agreed that it is of the required standard. - Bors will be used to merge all PRs. This ensures that the `master` branch is always green. - Dependabot will ensure dependencies are kept up to date. diff --git a/bors.toml b/bors.toml index c0e21cc..b70bff8 100644 --- a/bors.toml +++ b/bors.toml @@ -1,3 +1,3 @@ -status = ["continuous-integration/travis-ci/push"] +status = ["Build"] pr-status = ["License Compliance", "WIP"] delete-merged-branches = true diff --git a/src/date_tuple.rs b/src/date_tuple.rs index e514196..1697152 100644 --- a/src/date_tuple.rs +++ b/src/date_tuple.rs @@ -241,11 +241,13 @@ impl DateTuple { pub fn from_days(mut total_days: u32) -> Result { let mut years = 0u16; let mut months = 1u8; - while total_days > if date_utils::is_leap_year(years) { - DAYS_IN_A_LEAP_YEAR - } else { - DAYS_IN_A_COMMON_YEAR - } { + while total_days + > if date_utils::is_leap_year(years) { + DAYS_IN_A_LEAP_YEAR + } else { + DAYS_IN_A_COMMON_YEAR + } + { total_days -= if date_utils::is_leap_year(years) { DAYS_IN_A_LEAP_YEAR } else { @@ -398,5 +400,4 @@ mod tests { tuple4.previous_date() ); } - } diff --git a/src/month_tuple.rs b/src/month_tuple.rs index c03a1c7..3a0e3ab 100644 --- a/src/month_tuple.rs +++ b/src/month_tuple.rs @@ -248,5 +248,4 @@ mod tests { let date = DateTuple::new(2000, 5, 10).unwrap(); assert_eq!(MonthTuple { y: 2000, m: 5 }, MonthTuple::from(date)); } - } diff --git a/src/time_tuple.rs b/src/time_tuple.rs index 3f0536d..521ca22 100644 --- a/src/time_tuple.rs +++ b/src/time_tuple.rs @@ -493,5 +493,4 @@ mod tests { assert_eq!(58, tuple.m); assert_eq!(59, tuple.s); } - }