feat: add battle tests #44
Workflow file for this run
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: PR CI and Merge Restrictions | |
on: | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
- 'LICENSE' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code_quality_and_tests: | |
name: Code Quality & Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check Source Branch | |
if: "!startsWith(github.head_ref, 'feature/') && !startsWith(github.head_ref, 'release-please--')" | |
run: | | |
echo "❌ Pull requests to main must come from feature/* or release-please-- branches." | |
exit 1 | |
- name: Lint Commit Messages | |
uses: wagoid/commitlint-github-action@v6 | |
- name: Cache Rust Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Code Quality Checks | |
run: | | |
cargo fmt -- --check | |
cargo clippy --all-targets --all-features -- -D warnings | |
- name: Install cargo-tarpaulin | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-tarpaulin | |
- name: Run Tests | |
run: | | |
cargo tarpaulin --out Xml --output-dir coverage.xml | |
- name: Run Battle Tests | |
run: | | |
chmod +x tests/battle_test/battle_testing.sh | |
./tests/battle_test/battle_testing.sh | |
- name: Upload Format Error Logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: format-error-logs | |
path: tests/battle_test/format_errors.log | |
- name: Upload Coverage Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage.xml | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
audit: | |
name: Security Audit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Cache Rust Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-audit | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-audit | |
- name: Install cargo-deny | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-deny | |
- name: Audit & Deny Checks | |
run: | | |
cargo audit --stale | |
cargo deny check | |