Skip to content

feat: rewrite README with comprehensive language comparison tables an… #39

feat: rewrite README with comprehensive language comparison tables an…

feat: rewrite README with comprehensive language comparison tables an… #39

Workflow file for this run

name: CI
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
permissions:
contents: read
env:
BUILD_TYPE: Debug
jobs:
# Format check
format:
name: Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check C/C++ formatting
run: |
NEEDS_FORMAT=false
for file in $(find packages/compiler/src packages/compiler/runtime -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" 2>/dev/null); do
if ! clang-format --dry-run --Werror "$file" 2>/dev/null; then
echo "Needs formatting: $file"
NEEDS_FORMAT=true
fi
done
if [ "$NEEDS_FORMAT" = true ]; then
echo "Some files need formatting. Run ./scripts/format.sh locally."
exit 1
fi
echo "All files are properly formatted"
# Lint check - builds TML compiler and uses `tml lint`
lint:
name: Lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang llvm libssl-dev
- name: Build TML Compiler
run: |
chmod +x ./scripts/build.sh
./scripts/build.sh --no-tests
- name: Run TML Lint
run: |
TML_EXE=$(find build -name "tml" -type f | head -1)
chmod +x "$TML_EXE"
echo "Using TML compiler: $TML_EXE"
"$TML_EXE" lint packages examples
- name: Run clang-tidy (C++ lint)
continue-on-error: true
run: |
# Run on a subset of files to avoid timeout
# Include paths match CMakeLists.txt configuration
INCLUDE_ARGS="-I packages/compiler/include -I packages/compiler/src"
FILES=$(find packages/compiler/src -name "*.cpp" | head -10)
for file in $FILES; do
echo "Checking: $file"
clang-tidy "$file" -- -std=c++17 $INCLUDE_ARGS 2>/dev/null || true
done
# Build and test on multiple platforms
build-and-test:
name: Build & Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y ninja-build libssl-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: brew install ninja openssl
- name: Build with tests (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
chmod +x ./scripts/build.sh
./scripts/build.sh
- name: Build with tests (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: scripts\build.bat
- name: Run C++ Tests (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
TEST_EXE=$(find build -name "tml_tests" -type f | head -1)
if [ -n "$TEST_EXE" ]; then
chmod +x "$TEST_EXE"
"$TEST_EXE" --gtest_output=xml:test-results.xml
fi
- name: Run C++ Tests (Windows)
if: matrix.os == 'windows-latest'
run: |
$testExe = Get-ChildItem -Path build -Recurse -Filter "tml_tests.exe" | Select-Object -First 1
if ($testExe) {
& $testExe.FullName --gtest_output=xml:test-results.xml
}
shell: pwsh
- name: Upload Compiler Artifact
uses: actions/upload-artifact@v4
with:
name: tml-${{ matrix.os }}
path: |
build/debug/tml*
build/Debug/tml*
if-no-files-found: warn
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-cpp-${{ matrix.os }}
path: test-results.xml
if-no-files-found: ignore
# Run TML integration tests (Linux only for simplicity)
test-tml:
name: TML Tests
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang llvm
- name: Download TML Compiler
uses: actions/download-artifact@v4
with:
name: tml-ubuntu-latest
path: build/debug
- name: Run TML Tests
run: |
TML_EXE="build/debug/tml"
chmod +x "$TML_EXE"
echo "Using TML compiler: $TML_EXE"
echo "Running TML integration tests..."
# Run compiler tests
for test in packages/compiler/tests/compiler/*.test.tml; do
if [ -f "$test" ]; then
echo "Testing: $test"
"$TML_EXE" test "$test" || echo "Test failed: $test"
fi
done
# Run runtime tests
for test in packages/compiler/tests/runtime/*.test.tml; do
if [ -f "$test" ]; then
echo "Testing: $test"
"$TML_EXE" test "$test" || echo "Test failed: $test"
fi
done
# Run std tests
for test in packages/std/tests/*.test.tml; do
if [ -f "$test" ]; then
echo "Testing: $test"
"$TML_EXE" test "$test" || echo "Test failed: $test"
fi
done
# Spell check (moved from separate file)
codespell:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Codespell
run: python -m pip install --upgrade 'codespell[toml]'
- name: Run Codespell
run: |
codespell \
--skip="*.lock,*.json,*.map,*.yaml,*.yml,*.csv,*.bib,*.md,target,node_modules,.git,dist,venv,build,benchmarks,coverage,*.ll,*.bc,*.o,*.obj,*.exe,docs,rulebook" \
--ignore-words-list="crate,ser,deser,upToDate,optIn,shouldBe,Bloc,strbuilder,LPAR,RPAR,LBRACE,RBRACE,LBRACKET,RBRACKET,inout,hte,teh"