diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..90d3857 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,75 @@ +name: Everything Rust +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +env: + CARGO_TERM_COLOR: always +jobs: + build_works: + name: Build Works + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: run cargo build --release + run: | + cargo build --release + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: run cargo test + run: | + cargo test + fmt: + name: fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: run cargo fmt --check + run: | + cargo fmt --check + clippy: + name: clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: run cargo clippy + run: | + cargo clippy + doc: + name: Doc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: run cargo doc + run: | + cargo doc + diff --git a/src/main.rs b/src/main.rs index e7a11a9..c37fcc1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,12 @@ fn main() { println!("Hello, world!"); } + +#[cfg(test)] +mod tests { + #[test] + fn test_addition() { + assert_eq!(2 + 2, 4); + } +} +