Merge pull request #972 from OLAK6828/fix/issues-883-884-885-886 #603
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 5s | |
| --health-timeout 3s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Secret scanning (Gitleaks) | |
| uses: gitleaks/gitleaks-action@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for disabled test modules | |
| run: ./scripts/check-disabled-tests.sh | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Check for stale merge-conflict FIXMEs (#884) | |
| # #884: This step enforces the tracked checklist of disabled test modules. | |
| # | |
| # Two-part check: | |
| # 1. Known-allowlisted files (benchmarks.rs, invariant_tests.rs in | |
| # ip_registry) are excluded from the "must be zero" rule — they carry | |
| # legitimate long-term FIXMEs tracked by their own issues. | |
| # 2. Everything else across *both* contracts must have zero | |
| # "FIXME.*merge conflict" markers next to a commented-out mod. | |
| # The count is checked against a stored baseline so the gate fails | |
| # if new disabled modules are added, but passes while the existing | |
| # known-disabled debt is being worked down. | |
| # | |
| # Allowlisted files (extend this list when a new issue is opened to | |
| # re-enable the module — remove the entry when the module is re-enabled): | |
| # contracts/ip_registry/src/benchmarks.rs — #817 re-enable | |
| # contracts/ip_registry/src/invariant_tests.rs — open issue | |
| run: | | |
| ALLOWED='benchmarks\.rs\|invariant_tests\.rs' | |
| # Count FIXMEs outside the allowlist | |
| COUNT=$(grep -rn "FIXME.*merge conflict" --include='*.rs' contracts/ \ | |
| | grep -v "$ALLOWED" \ | |
| | wc -l) | |
| # Baseline: the number of known-disabled modules NOT yet covered by | |
| # their own re-enable issue. Adjust this number downward as modules | |
| # are fixed; never increase it. | |
| BASELINE=0 | |
| if [ "$COUNT" -gt "$BASELINE" ]; then | |
| echo "::error::Found $COUNT FIXME merge-conflict comment(s) outside the allowlist (baseline $BASELINE)." >&2 | |
| echo "Matches:" >&2 | |
| grep -rn "FIXME.*merge conflict" --include='*.rs' contracts/ | grep -v "$ALLOWED" >&2 | |
| echo "Resolve the merge conflict FIXMEs or add the file to the allowlist with a tracking issue." >&2 | |
| exit 1 | |
| fi | |
| echo "FIXME merge-conflict gate: $COUNT/$BASELINE — OK" | |
| - name: Lint (JS) | |
| run: npm run lint | |
| - name: Format Check (JS) | |
| run: npm run format:check | |
| - name: Build | |
| run: cargo build --workspace --verbose | |
| - name: Test (Rust) | |
| run: cargo test --workspace --verbose | |
| env: | |
| REDIS_URL: redis://localhost:6379 | |
| - name: Test (JS) | |
| run: npm test -- --coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: javascript | |
| fail_ci_if_error: false |