Added github actions #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, Clippy (Pedantic), Test, and Push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| build-clippy-test-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: actions/setup-rust@v1 | |
| with: | |
| rust-version: stable | |
| - name: Build (fail on warnings) | |
| run: cargo build --verbose | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| - name: Run Clippy (pedantic, fail on warnings) | |
| run: cargo clippy --all-targets --all-features -- -D warnings -W clippy::pedantic | |
| - name: Run tests | |
| run: cargo test --verbose | |
| - name: Push changes | |
| if: ${{ success() && github.ref == 'refs/heads/main' }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git push origin main |