|
| 1 | +name: MsgID Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "src/cfs_msgid_sentinel/**" |
| 7 | + - "action.yml" |
| 8 | + - "scripts/generate_collision_lab_apps.py" |
| 9 | + - "scripts/verify_expected_collisions.py" |
| 10 | + - "expected_collisions.json" |
| 11 | + - "pyproject.toml" |
| 12 | + - ".github/workflows/msgtestci.yml" |
| 13 | + push: |
| 14 | + branches: [main] |
| 15 | + paths: |
| 16 | + - "src/cfs_msgid_sentinel/**" |
| 17 | + - "action.yml" |
| 18 | + - "scripts/generate_collision_lab_apps.py" |
| 19 | + - "scripts/verify_expected_collisions.py" |
| 20 | + - "expected_collisions.json" |
| 21 | + - "pyproject.toml" |
| 22 | + - ".github/workflows/msgtestci.yml" |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +jobs: |
| 26 | + dogfood: |
| 27 | + name: Dogfood (Action fixtures) |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Run sentinel against real fixtures (clean bundle) |
| 33 | + uses: ./ |
| 34 | + id: clean-check |
| 35 | + with: |
| 36 | + scan-paths: tests/fixtures |
| 37 | + topicid-pattern: "**/real/*_topicids.h" |
| 38 | + msgid-pattern: "**/*_msgids.h" |
| 39 | + fail-on-collision: "true" |
| 40 | + near-miss-gap: "0" |
| 41 | + report-format: "both" |
| 42 | + |
| 43 | + - name: Verify clean bundle produced 0 collisions |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + echo "Collision count: ${{ steps.clean-check.outputs.collision-count }}" |
| 47 | + echo "Has collisions: ${{ steps.clean-check.outputs.has-collisions }}" |
| 48 | + if [ "${{ steps.clean-check.outputs.has-collisions }}" = "true" ]; then |
| 49 | + echo "::error::Expected 0 collisions on real cFS fixtures" |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | +
|
| 53 | + - name: Run sentinel against collision fixtures |
| 54 | + uses: ./ |
| 55 | + id: collision-check |
| 56 | + with: |
| 57 | + scan-paths: tests/fixtures |
| 58 | + topicid-pattern: "**/collision_app_*_topicids.h" |
| 59 | + msgid-pattern: "**/*_msgids.h" |
| 60 | + fail-on-collision: "false" |
| 61 | + report-format: "both" |
| 62 | + |
| 63 | + - name: Verify collision fixtures produce collisions |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + echo "Collision count: ${{ steps.collision-check.outputs.collision-count }}" |
| 67 | + if [ "${{ steps.collision-check.outputs.has-collisions }}" != "true" ]; then |
| 68 | + echo "::error::Expected collisions on collision fixtures but found none" |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | + if [ "${{ steps.collision-check.outputs.collision-count }}" = "0" ]; then |
| 72 | + echo "::error::Expected collision-count > 0 but got 0" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | +
|
| 76 | + collision-lab: |
| 77 | + name: Collision lab (clone cFS + strict verify) |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + |
| 82 | + - uses: actions/setup-python@v5 |
| 83 | + with: |
| 84 | + python-version: "3.12" |
| 85 | + |
| 86 | + - name: Install dependencies |
| 87 | + run: pip install -e ".[dev]" |
| 88 | + |
| 89 | + - name: Generate collision lab apps (auto-clone cFS) |
| 90 | + run: python scripts/generate_collision_lab_apps.py --cfs-root cFS --clone-if-missing --count 10 --prefix msgid_collision |
| 91 | + |
| 92 | + - name: Verify expected collisions (strict) |
| 93 | + run: python scripts/verify_expected_collisions.py --expected expected_collisions.json --scan-root cFS/apps |
| 94 | + |
| 95 | + - name: Smoke scan upstream cFS apps (JSON parses) |
| 96 | + shell: bash |
| 97 | + run: | |
| 98 | + cfs-msgid-sentinel --scan-path cFS/apps --topicid-pattern "**/*_topicids.h" --format json --no-color --no-fail-on-collision > /tmp/cfs_apps.json |
| 99 | + python -c "import json; json.load(open('/tmp/cfs_apps.json','r',encoding='utf-8'))" |
| 100 | +
|
0 commit comments