Create Cargo.toml #5
This file contains 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: Rust CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build Project | |
run: cargo build --release | |
- name: Run Tests | |
run: cargo test --verbose | |
security_check: | |
name: Security Audit | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install Cargo Audit | |
run: cargo install cargo-audit | |
- name: Run Security Audit | |
run: cargo audit | |
deploy: | |
name: Deploy Binary | |
runs-on: ubuntu-latest | |
needs: [build, security_check] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: yoga-chain-binaries | |
path: target/release/ |