Reclassify 7 challenges by difficulty (#212) #164
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: Lint Starter Code | |
| on: | |
| pull_request: | |
| paths: | |
| - 'challenges/**' | |
| - 'scripts/**' | |
| - '.clang-format' | |
| - 'pyproject.toml' | |
| - '.github/workflows/lint.yml' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'challenges/**' | |
| - 'scripts/**' | |
| - '.clang-format' | |
| - 'pyproject.toml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-python: | |
| name: Lint Python Files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Python linting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black==24.1.1 flake8==7.0.0 isort==5.13.2 | |
| - name: Check Python formatting with black | |
| run: | | |
| black --check --diff challenges/ scripts/ | |
| - name: Check Python import ordering with isort | |
| run: | | |
| isort --check-only --diff challenges/ scripts/ | |
| - name: Lint Python with flake8 | |
| run: | | |
| flake8 challenges/ scripts/ | |
| lint-cpp: | |
| name: Lint C++/CUDA Files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install clang-format | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format | |
| - name: Check C++/CUDA formatting | |
| run: | | |
| find challenges -name "*.cu" -o -name "*.cpp" -o -name "*.h" | xargs clang-format --dry-run --Werror | |
| lint-mojo: | |
| name: Check Mojo Files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check Mojo files exist and are valid | |
| run: | | |
| echo "Checking Mojo files for basic syntax issues..." | |
| find challenges -name "*.mojo" -type f | while read file; do | |
| # Basic checks: file is not empty and contains required imports | |
| if [ ! -s "$file" ]; then | |
| echo "Error: $file is empty" | |
| exit 1 | |
| fi | |
| # Check for required imports in Mojo starter files | |
| if ! grep -q "from gpu.host import DeviceContext" "$file" && \ | |
| ! grep -q "from gpu.id import" "$file" && \ | |
| ! grep -q "from memory import UnsafePointer" "$file"; then | |
| echo "Warning: $file may be missing standard GPU imports" | |
| fi | |
| # Check for @export decorator in starter files | |
| if echo "$file" | grep -q "starter.mojo"; then | |
| if ! grep -q "@export" "$file"; then | |
| echo "Warning: $file may be missing @export decorator" | |
| fi | |
| fi | |
| echo "✓ $file passed basic checks" | |
| done | |
| echo "✅ All Mojo files passed basic validation" |