diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml new file mode 100644 index 0000000..9863ccf --- /dev/null +++ b/.github/workflows/devskim.yml @@ -0,0 +1,34 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: DevSkim + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '22 22 * * 3' + +jobs: + lint: + name: DevSkim + runs-on: ubuntu-20.04 + permissions: + actions: read + contents: read + security-events: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run DevSkim scanner + uses: microsoft/DevSkim-Action@v1 + + - name: Upload DevSkim scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: devskim-results.sarif diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..d54fa2f --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,22 @@ +name: Rust + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/README.md b/README.md index c6e0e51..5a2eddf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Rust](https://github.com/prfiredragon/version/actions/workflows/rust.yml/badge.svg)](https://github.com/prfiredragon/version/actions/workflows/rust.yml) + # version `version` is a very simple library who's job is to return the version of your crate if you're building with Cargo. diff --git a/src/lib.rs b/src/lib.rs index 8063046..9ffe5a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,16 +147,16 @@ pub fn from_version(_a: &Version, test: Cmp, _b: &Version) -> bool{ #[test] fn string_test() { // Bad test is bad. - assert_eq!( version!(), "3.0.0" ); + assert_eq!( version!(), "3.3.0" ); } #[test] fn version_struct_test() { let ver = FromStr::from_str( &version!() ); - assert_eq!( ver, Ok( Version { major: 3, minor: 0, patch: 0 } ) ); + assert_eq!( ver, Ok( Version { major: 3, minor: 3, patch: 0 } ) ); } #[test] fn invalid_test() { - let invalids = [ "nope", "1.0", "1.0.x", "1.x.0", "x.0.1", "x.x.x" ]; + let invalids = [ "nope", "x.0", "1.0.x", "1.x.0", "x.0.1", "x.x.x" ]; for invalid in &invalids { let invv : Result = FromStr::from_str( invalid ); @@ -173,14 +173,14 @@ fn mayor_test() { #[test] fn minor_test() { let mut test_ret = false; - if version!() < "3.0.1" {test_ret = true;} + if version!() < "3.3.1" {test_ret = true;} assert_eq!( true, test_ret ); } #[test] fn equal_test() { let mut test_ret = false; - if version!() == "3.0.0" {test_ret = true;} + if version!() == "3.3.0" {test_ret = true;} assert_eq!( true, test_ret ); }