Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d350f78
build(c): C runtime: arenas with out-of-memory scopes, strings, runes…
4matic Nov 14, 2026
73f283a
build(c): codegen for data and Unicode tables, and the R0 primitives
4matic Nov 14, 2026
433aac9
test(c): fixture runner, matcher, JSON reader, dump tool, CMake build…
4matic Nov 14, 2026
af9ac13
build(c): internal header with every type and prototype, and porting …
4matic Nov 14, 2026
5723e11
build(c): single-track pipeline (R1 to R12), translated from the Go port
4matic Nov 15, 2026
87e73bc
build(c): tracklists and edits (R13)
4matic Nov 15, 2026
d50930f
feat(c): the C library: parse, parse_artists, format, normalize, pars…
4matic Nov 15, 2026
0298de4
ci(c): release the C library with the linked versions: c-vX.Y.Z tag, …
4matic Nov 15, 2026
a67df6f
build(c): amalgamation, the installed library (static or shared) with…
4matic Nov 15, 2026
971caab
feat(c): header-only C++17 wrapper, trackparse.hpp
4matic Nov 15, 2026
596a76f
docs: the C port on every site page, in the playground code panels an…
4matic Nov 15, 2026
dcb0002
test(c): SPEC invariants and time ceilings, 16 threads against a sequ…
4matic Nov 15, 2026
36d84f6
ci(c): c workflow: GCC, Clang, ARM64, shared, macOS, MSVC, 32-bit, GC…
4matic Nov 15, 2026
744c9fc
refactor(c): clang-format, enum counts, C++ needed only for tests, sa…
4matic Nov 15, 2026
1eb585f
docs(site): count the version types with TRACKPARSE_VERSION_TYPE_COUNT
4matic Nov 15, 2026
429bb53
docs: AGENTS.md, the testing and ports pages and the C README describ…
4matic Nov 15, 2026
a15e930
perf(c): give the known-artist search's candidate keys back at once (…
4matic Nov 15, 2026
fc6ea41
fix(c): review fixes: C++20 test includes, MSVC C4132 in the amalgama…
4matic Nov 15, 2026
56dc593
fix(c): warnings newer compilers raise: MSVC C4324 on tp_scope, GCC 1…
4matic Nov 15, 2026
16b0372
fix(c): Windows consumer checks find the DLL, the exports check ignor…
4matic Nov 15, 2026
ae8672d
refactor(c): clang-format test_num.c
4matic Nov 15, 2026
0ad9c20
fix(c): the exports check ignores the i386 PIC thunks
4matic Nov 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 237 additions & 0 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
name: c

on:
push:
branches: [main]
# The fuzz job: weekly, or by hand.
schedule:
- cron: "41 3 * * 1"
workflow_dispatch:
pull_request:
paths:
- "c/**"
- "spec/**"
# test_primitives reads the R0 primitives dumped from JS there.
- "rust/tests/data/**"
# The compare job diffs the library against the built JS package.
- "js/src/**"
- "scripts/compare-ports.mjs"
- "scripts/fuzz-ports.mjs"
- "scripts/lib/ports.mjs"
- ".github/workflows/c.yml"

permissions:
contents: read

env:
CI: "true"

jobs:
lint:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
- name: Codegen is up to date
run: |
node c/scripts/gen_data.mjs --check
node c/scripts/gen_unicode.mjs --check
# The Unicode tables come from the same derivation as Go's: the committed samples must agree.
- name: Unicode sample matches the Go port's
run: cmp c/tests/data/unicode/cases.jsonl go/testdata/unicode/cases.jsonl
# R0 hazards: locale-dependent and unstable calls are banned from the library.
- name: No locale-dependent or unstable calls in src/
run: |
bad=$(grep -nE '#include <ctype\.h>|\b(qsort|strtod|strtof|strtold|atof|strtol|strtoul|atoi|setlocale|localeconv|sprintf|snprintf|printf|fprintf|isalpha|isdigit|isspace|isupper|islower|tolower|toupper)\s*\(' c/src/*.c c/src/*.h \
| grep -vE '^[^:]+:[0-9]+:[[:space:]]*(/\*|\*|//)' || true)
if [ -n "$bad" ]; then echo "$bad"; exit 1; fi
# Generated files (data_gen.*, unicode_gen.*) are left as the generators write them.
- name: clang-format
run: |
pipx install clang-format==19.1.7
git ls-files 'c/*.c' 'c/*.h' 'c/*.cpp' 'c/*.hpp' | grep -vE '_gen\.(c|h)$' \
| xargs clang-format --dry-run --Werror
- name: Amalgamation (duplicate file-local names fail here)
run: node c/scripts/amalgamate.mjs --out "$RUNNER_TEMP/amal"

test:
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- { name: linux-gcc, os: ubuntu-latest, cc: gcc, cxx: g++ }
- { name: linux-clang, os: ubuntu-latest, cc: clang, cxx: clang++ }
- { name: linux-arm64, os: ubuntu-24.04-arm, cc: gcc, cxx: g++ }
- { name: linux-shared, os: ubuntu-latest, cc: gcc, cxx: g++, shared: "ON" }
- { name: macos, os: macos-latest, cc: clang, cxx: clang++ }
- { name: windows-msvc, os: windows-latest }
# The DLL: dllexport, the import library, and the examples and C++ tests linking it.
- { name: windows-msvc-shared, os: windows-latest, shared: "ON" }
name: test (${{ matrix.name }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: pnpm
# The schema test validates every fixture output with the ajv the JS package has.
- run: pnpm install --frozen-lockfile
- name: Configure
shell: bash
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
cmake -S c -B build -DCMAKE_BUILD_TYPE=Release -DTRACKPARSE_WERROR=ON \
-DTRACKPARSE_SHARED=${{ matrix.shared || 'OFF' }}
- run: cmake --build build --config Release -j4
- name: Test
run: ctest --test-dir build -C Release --output-on-failure -j2
- name: Conformance report
shell: bash
run: |
bin=build/trackparse-fixtures
[ -x "$bin" ] || bin=build/Release/trackparse-fixtures.exe
TRACKPARSE_REPORT=1 "$bin" spec/fixtures/handwritten/*.json spec/fixtures/generated/*.json | tail -5

# 32-bit x86 (SSE2 math, FLT_EVAL_METHOD 0) and the oldest supported toolchain.
old-and-32bit:
if: github.event_name != 'schedule'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- { name: m32, cc: gcc, flags: "-m32", pkgs: "gcc-multilib g++-multilib" }
- { name: gcc-9-cmake-3.16, cc: gcc-9, cxx: g++-9, pkgs: "gcc-9 g++-9", cmake: "3.16.8" }
name: test (${{ matrix.name }})
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- run: sudo apt-get update && sudo apt-get install -y ${{ matrix.pkgs }}
- name: CMake ${{ matrix.cmake || 'default' }}
if: matrix.cmake
run: pipx install "cmake==${{ matrix.cmake }}" && cmake --version
- name: Configure, build, test
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx || 'g++' }}
CFLAGS: ${{ matrix.flags }}
CXXFLAGS: ${{ matrix.flags }}
LDFLAGS: ${{ matrix.flags }}
run: |
cmake -S c -B build -DCMAKE_BUILD_TYPE=Release -DTRACKPARSE_WERROR=ON
cmake --build build -j4
# ctest --test-dir needs CTest 3.20; 3.16 would ignore it and find no tests.
cd build && ctest --output-on-failure -j2 -LE consumer

sanitize:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { name: asan-ubsan-gcc, cc: gcc, cxx: g++, opt: "-DTRACKPARSE_SANITIZE=ON" }
- { name: asan-ubsan-clang, cc: clang, cxx: clang++, opt: "-DTRACKPARSE_SANITIZE=ON" }
- { name: tsan, cc: clang, cxx: clang++, opt: "-DTRACKPARSE_SANITIZE_THREAD=ON" }
# MemorySanitizer with an uninstrumented libc++ would report false positives in the C++
# tests, so they are left out (-LE cpp is not enough: they would not even build).
- { name: msan, cc: clang, cxx: clang++, opt: "-DTRACKPARSE_SANITIZE_MEMORY=ON", target: "--target trackparse-fixtures test_api test_properties test_oom test_rt test_num" , tests: "-R '^(fixtures|api|properties|oom|rt|num)$'" }
name: sanitize (${{ matrix.name }})
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Configure, build, test
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
cmake -S c -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACKPARSE_WERROR=ON ${{ matrix.opt }}
cmake --build build -j4 ${{ matrix.target }}
ctest --test-dir build --output-on-failure -j2 -LE consumer ${{ matrix.tests }}

valgrind-and-locale:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Install valgrind and the test locales
run: |
sudo apt-get update && sudo apt-get install -y valgrind locales
sudo locale-gen de_DE.UTF-8 tr_TR.UTF-8
- name: Build
run: |
cmake -S c -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACKPARSE_WERROR=ON
cmake --build build -j4
- name: Locale (German decimal comma, Turkish dotless i)
run: |
for loc in de_DE.UTF-8 tr_TR.UTF-8; do
LC_ALL=$loc ctest --test-dir build --output-on-failure -R 'locale|fixtures|api'
done
- name: Valgrind (handwritten fixtures, API tests, properties in short mode)
env:
TRACKPARSE_SHORT: "1"
TRACKPARSE_SLOWDOWN: "40"
run: |
valgrind --error-exitcode=1 --leak-check=full --errors-for-leak-kinds=definite,indirect \
build/trackparse-fixtures spec/fixtures/handwritten/*.json
(cd c && valgrind --error-exitcode=1 --leak-check=full --errors-for-leak-kinds=definite,indirect \
../build/test_api)
(cd c && valgrind --error-exitcode=1 --leak-check=full --errors-for-leak-kinds=definite,indirect \
../build/test_properties)

compare:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm --filter trackparse build
- name: Every fixture, full output, C against JS
run: node scripts/compare-ports.mjs --only=c
- name: Random differential run, C against JS
run: node scripts/fuzz-ports.mjs --only=c --n=50000 --lists=10000

fuzz:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [parse, parse_artists, format, parse_tracklist, apply_edits, wire]
name: fuzz (${{ matrix.target }})
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
- name: Build the fuzz target
env:
CC: clang
CXX: clang++
run: |
cmake -S c -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACKPARSE_FUZZ=ON -DTRACKPARSE_BUILD_TESTS=OFF
cmake --build build -j4 --target fuzz_${{ matrix.target }}
- name: Seed corpus from the fixtures
run: node c/scripts/fuzz_corpus.mjs "$RUNNER_TEMP/corpus"
- name: Fuzz for 10 minutes
run: |
mkdir -p crashes
corpus="$RUNNER_TEMP/corpus/${{ matrix.target }}"
mkdir -p "$corpus"
build/fuzz_${{ matrix.target }} -max_total_time=600 -timeout=30 -artifact_prefix=crashes/ "$corpus"
- if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: crashes-${{ matrix.target }}
path: crashes/
1 change: 1 addition & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
python
rust
go
c
site
ci
deps
Expand Down
Loading
Loading