Skip to content

Rename cat::index to cat::basic_idx. #28

Rename cat::index to cat::basic_idx.

Rename cat::index to cat::basic_idx. #28

# This file is flagrantly "vibe-coded". It may not be up to the standards of most libCat code.
name: Arithmetic negative-compile
# `CAT_BUILD_ARITHMETIC_NEGATIVE_TESTS=ON` runs `-fsyntax-only` probes from
# `cmake/cat_arithmetic_negative.cmake` at **configure** time (no
# `cmake --build` / `ninja` required). A failed check means an ill-formed
# pattern compiled or a must-accept probe failed. No CTest, no `libcat` link.
#
# Triggers only when arithmetic or this file changes.
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'src/libraries/arithmetic/**'
- 'cmake/cat_arithmetic_negative.cmake'
- 'cmake/cat_arithmetic_neg_cases.cmake'
- 'cmake/cat_arithmetic_neg_matrix.cmake'
- '.github/workflows/arithmetic-negative.yml'
- '.github/actions/setup-toolchain/**'
pull_request:
paths:
- 'src/libraries/arithmetic/**'
- 'cmake/cat_arithmetic_negative.cmake'
- 'cmake/cat_arithmetic_neg_cases.cmake'
- 'cmake/cat_arithmetic_neg_matrix.cmake'
- '.github/workflows/arithmetic-negative.yml'
- '.github/actions/setup-toolchain/**'
jobs:
arithmetic-negative:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-toolchain
- name: Configure (negative -fsyntax-only probes)
# Probes run inside `cmake` (see STATUS lines). Sanitizers off, shared
# off, no need to `cmake --build`.
run: |
set -euxo pipefail
cmake -S . -B build-arith-negative -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCAT_USE_SANITIZERS=OFF \
-DCAT_BUILD_SHARED=OFF \
-DCAT_BUILD_UNIT_TESTS=OFF \
-DCAT_BUILD_ALL_EXAMPLES=OFF \
-DCAT_BUILD_ARITHMETIC_NEGATIVE_TESTS=ON
- name: Per-probe compiler output
if: always()
run: |
set -euxo pipefail
f=build-arith-negative/CMakeFiles/cat_arithmetic_neg/compile_diagnostics.log
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "==================================================================="
echo "compile_diagnostics.log (full stderr/stdout, entire file below, no truncation)"
echo "==================================================================="
echo
echo "This workflow run: $run_url"
echo
echo "A later step zips the same file to **Artifacts** as"
echo " \`arithmetic-negative-compile_diagnostics\` (see artifact link step)."
echo
if ! test -f "$f"; then
echo "Log not found: $f (configure may have failed before probes ran). See the Configure step log."
exit 0
fi
lines=$(wc -l < "$f" | tr -d ' ')
blks=$(grep -c '^====' "$f" || :)
size=$(du -h "$f" | cut -f1)
echo "Summary: $size, $lines lines, $blks '====' probe block(s)."
echo
echo "----- begin compile_diagnostics.log -----"
cat "$f"
echo "----- end compile_diagnostics.log -----"
- name: Upload compile_diagnostics.log (zip on run summary; link below)
if: always() && (success() || failure())
id: upload_compile_diagnostics
uses: actions/upload-artifact@v4
with:
name: arithmetic-negative-compile_diagnostics
path: build-arith-negative/CMakeFiles/cat_arithmetic_neg/compile_diagnostics.log
if-no-files-found: ignore
# Run summary: Artifacts. Optional step output: artifact url (upload-artifact v4.4+)
- name: Artifact download link
if: always() && (success() || failure())
run: |
url="${{ steps.upload_compile_diagnostics.outputs.artifact-url }}"
if [ -n "$url" ]; then
echo "Artifact URL: $url"
else
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "Open this run's **Artifacts** section: $run_url#artifacts (direct URL may be unavailable in this action version.)"
fi
- name: List generated probe TUs
run: |
d=build-arith-negative/CMakeFiles/cat_arithmetic_neg
test -d "$d"
echo "Probe count (expect match for CAT_BUILD_ARITHMETIC_NEGATIVE_TESTS line above):"
find "$d" -maxdepth 1 -name '*.cpp' -print | sort | wc -l
echo "Probe .cpp files (full list):"
find "$d" -maxdepth 1 -name '*.cpp' -print | sort