|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + CARGO_TERM_COLOR: always |
| 12 | + RUST_BACKTRACE: 1 |
| 13 | + |
| 14 | +jobs: |
| 15 | + fmt: |
| 16 | + name: Format Check |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Rust |
| 23 | + uses: dtolnay/rust-toolchain@stable |
| 24 | + with: |
| 25 | + components: rustfmt |
| 26 | + |
| 27 | + - name: Check formatting |
| 28 | + run: cargo fmt --all -- --check |
| 29 | + |
| 30 | + clippy: |
| 31 | + name: Clippy Lints |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Install Rust |
| 38 | + uses: dtolnay/rust-toolchain@stable |
| 39 | + with: |
| 40 | + components: clippy |
| 41 | + |
| 42 | + - name: Cache cargo registry |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: ~/.cargo/registry |
| 46 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 47 | + |
| 48 | + - name: Cache cargo index |
| 49 | + uses: actions/cache@v4 |
| 50 | + with: |
| 51 | + path: ~/.cargo/git |
| 52 | + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
| 53 | + |
| 54 | + - name: Cache cargo build |
| 55 | + uses: actions/cache@v4 |
| 56 | + with: |
| 57 | + path: target |
| 58 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 59 | + |
| 60 | + - name: Run clippy |
| 61 | + run: cargo clippy --all-targets --all-features -- -D warnings |
| 62 | + |
| 63 | + test: |
| 64 | + name: Test Suite |
| 65 | + runs-on: ${{ matrix.os }} |
| 66 | + strategy: |
| 67 | + fail-fast: false |
| 68 | + matrix: |
| 69 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 70 | + rust: [stable, beta] |
| 71 | + steps: |
| 72 | + - name: Checkout code |
| 73 | + uses: actions/checkout@v4 |
| 74 | + |
| 75 | + - name: Install Rust |
| 76 | + uses: dtolnay/rust-toolchain@master |
| 77 | + with: |
| 78 | + toolchain: ${{ matrix.rust }} |
| 79 | + |
| 80 | + - name: Cache cargo registry |
| 81 | + uses: actions/cache@v4 |
| 82 | + with: |
| 83 | + path: ~/.cargo/registry |
| 84 | + key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 85 | + |
| 86 | + - name: Cache cargo index |
| 87 | + uses: actions/cache@v4 |
| 88 | + with: |
| 89 | + path: ~/.cargo/git |
| 90 | + key: ${{ runner.os }}-${{ matrix.rust }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
| 91 | + |
| 92 | + - name: Cache cargo build |
| 93 | + uses: actions/cache@v4 |
| 94 | + with: |
| 95 | + path: target |
| 96 | + key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 97 | + |
| 98 | + - name: Run tests |
| 99 | + run: cargo test --workspace --all-features |
| 100 | + |
| 101 | + - name: Run doc tests |
| 102 | + run: cargo test --workspace --doc |
| 103 | + |
| 104 | + build: |
| 105 | + name: Build Check |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - name: Checkout code |
| 109 | + uses: actions/checkout@v4 |
| 110 | + |
| 111 | + - name: Install Rust |
| 112 | + uses: dtolnay/rust-toolchain@stable |
| 113 | + |
| 114 | + - name: Cache cargo registry |
| 115 | + uses: actions/cache@v4 |
| 116 | + with: |
| 117 | + path: ~/.cargo/registry |
| 118 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 119 | + |
| 120 | + - name: Cache cargo index |
| 121 | + uses: actions/cache@v4 |
| 122 | + with: |
| 123 | + path: ~/.cargo/git |
| 124 | + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
| 125 | + |
| 126 | + - name: Cache cargo build |
| 127 | + uses: actions/cache@v4 |
| 128 | + with: |
| 129 | + path: target |
| 130 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 131 | + |
| 132 | + - name: Build all crates |
| 133 | + run: cargo build --workspace --all-features |
| 134 | + |
| 135 | + - name: Build release |
| 136 | + run: cargo build --workspace --release |
| 137 | + |
| 138 | + coverage: |
| 139 | + name: Code Coverage |
| 140 | + runs-on: ubuntu-latest |
| 141 | + steps: |
| 142 | + - name: Checkout code |
| 143 | + uses: actions/checkout@v4 |
| 144 | + |
| 145 | + - name: Install Rust |
| 146 | + uses: dtolnay/rust-toolchain@stable |
| 147 | + |
| 148 | + - name: Install cargo-tarpaulin |
| 149 | + run: cargo install cargo-tarpaulin |
| 150 | + |
| 151 | + - name: Generate coverage |
| 152 | + run: cargo tarpaulin --workspace --all-features --out xml --timeout 300 |
| 153 | + |
| 154 | + - name: Upload coverage to Codecov |
| 155 | + uses: codecov/codecov-action@v4 |
| 156 | + with: |
| 157 | + files: ./cobertura.xml |
| 158 | + fail_ci_if_error: false |
| 159 | + continue-on-error: true |
| 160 | + |
| 161 | + docs: |
| 162 | + name: Documentation Check |
| 163 | + runs-on: ubuntu-latest |
| 164 | + steps: |
| 165 | + - name: Checkout code |
| 166 | + uses: actions/checkout@v4 |
| 167 | + |
| 168 | + - name: Install Rust |
| 169 | + uses: dtolnay/rust-toolchain@stable |
| 170 | + |
| 171 | + - name: Check documentation |
| 172 | + run: cargo doc --workspace --all-features --no-deps |
| 173 | + env: |
| 174 | + RUSTDOCFLAGS: -D warnings |
| 175 | + |
| 176 | + - name: Verify docs structure |
| 177 | + run: | |
| 178 | + # Check that required documentation files exist |
| 179 | + test -f docs/STRUCTURE.md || (echo "Missing docs/STRUCTURE.md" && exit 1) |
| 180 | + test -f docs/ARCHITECTURE.md || (echo "Missing docs/ARCHITECTURE.md" && exit 1) |
| 181 | + test -f docs/INTERFACES.md || (echo "Missing docs/INTERFACES.md" && exit 1) |
| 182 | + test -f docs/ROADMAP.md || (echo "Missing docs/ROADMAP.md" && exit 1) |
| 183 | + test -f docs/NEXT_STEPS.md || (echo "Missing docs/NEXT_STEPS.md" && exit 1) |
| 184 | + test -f CHANGELOG.md || echo "Warning: Missing CHANGELOG.md" |
| 185 | + echo "Documentation structure verified" |
| 186 | +
|
| 187 | + security: |
| 188 | + name: Security Audit |
| 189 | + runs-on: ubuntu-latest |
| 190 | + steps: |
| 191 | + - name: Checkout code |
| 192 | + uses: actions/checkout@v4 |
| 193 | + |
| 194 | + - name: Install Rust |
| 195 | + uses: dtolnay/rust-toolchain@stable |
| 196 | + |
| 197 | + - name: Run cargo-audit |
| 198 | + run: | |
| 199 | + cargo install cargo-audit |
| 200 | + cargo audit |
| 201 | + continue-on-error: true |
| 202 | + |
| 203 | + # Placeholder for future Phage policy check |
| 204 | + # Uncomment when Phage is available and policy pack is defined |
| 205 | + # phage-check: |
| 206 | + # name: Phage Policy Check |
| 207 | + # runs-on: ubuntu-latest |
| 208 | + # steps: |
| 209 | + # - name: Checkout code |
| 210 | + # uses: actions/checkout@v4 |
| 211 | + # |
| 212 | + # - name: Install Phage |
| 213 | + # run: | |
| 214 | + # # Install phage CLI |
| 215 | + # cargo install phage-cli |
| 216 | + # |
| 217 | + # - name: Run policy checks |
| 218 | + # run: phage check --ci |
0 commit comments