fix: restructure for Mason submodule conventions and resolve warnings #18
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: Chapel CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| QUICKCHPL_NUM_TESTS: "100" | |
| QUICKCHPL_VERBOSE: "false" | |
| jobs: | |
| build: | |
| name: Build quickchpl | |
| runs-on: ubuntu-latest | |
| container: | |
| image: chapel/chapel:2.6.0 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Verify Chapel installation | |
| run: | | |
| chpl --version | |
| mason --version || echo "Mason not found, using chpl directly" | |
| - name: Verify library compiles | |
| run: | | |
| # Verify all modules compile together | |
| chpl -M src -M src/quickchpl --no-codegen src/quickchpl.chpl | |
| echo "✓ All modules compile successfully" | |
| test-unit: | |
| name: Unit Tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| container: | |
| image: chapel/chapel:2.6.0 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Generator Tests | |
| run: | | |
| echo "Running Generator Tests..." | |
| chpl -M src -M src/quickchpl test/unit/GeneratorTests.chpl -o /tmp/generator_tests | |
| /tmp/generator_tests | |
| - name: Run Shrinker Tests | |
| run: | | |
| echo "Running Shrinker Tests..." | |
| chpl -M src -M src/quickchpl test/unit/ShrinkerTests.chpl -o /tmp/shrinker_tests | |
| /tmp/shrinker_tests | |
| - name: Run Property Tests | |
| run: | | |
| echo "Running Property Tests..." | |
| chpl -M src -M src/quickchpl test/unit/PropertyTests.chpl -o /tmp/property_tests | |
| /tmp/property_tests | |
| test-examples: | |
| name: Example Programs | |
| needs: build | |
| runs-on: ubuntu-latest | |
| container: | |
| image: chapel/chapel:2.6.0 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Getting Started Example | |
| run: | | |
| echo "Running Getting Started Example..." | |
| chpl -M src -M src/quickchpl examples/GettingStarted.chpl -o /tmp/getting_started | |
| /tmp/getting_started | |
| - name: Run Algebraic Properties Example | |
| run: | | |
| echo "Running Algebraic Properties Example..." | |
| chpl -M src -M src/quickchpl examples/AlgebraicProperties.chpl -o /tmp/algebraic | |
| /tmp/algebraic | |
| - name: Run Custom Generators Example | |
| run: | | |
| echo "Running Custom Generators Example..." | |
| chpl -M src -M src/quickchpl examples/CustomGenerators.chpl -o /tmp/custom_gen | |
| /tmp/custom_gen | |
| test-self: | |
| name: Property-Based Self Tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| container: | |
| image: chapel/chapel:2.6.0 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run quickchpl self-tests | |
| run: | | |
| chpl -M src -M src/quickchpl test/properties/SelfTests.chpl -o /tmp/self_tests | |
| /tmp/self_tests --numTests=${{ env.QUICKCHPL_NUM_TESTS }} | |
| test-matrix: | |
| name: Test on Chapel ${{ matrix.chapel-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| chapel-version: ['2.6.0', '2.7.0'] | |
| container: | |
| image: chapel/chapel:${{ matrix.chapel-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build with Chapel ${{ matrix.chapel-version }} | |
| run: | | |
| chpl --version | |
| chpl -M src -M src/quickchpl test/unit/GeneratorTests.chpl -o /tmp/test | |
| /tmp/test | |
| lint: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| container: | |
| image: chapel/chapel:2.6.0 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run chplcheck | |
| run: | | |
| echo "Running chplcheck linter..." | |
| chplcheck --version || echo "chplcheck version unknown" | |
| chplcheck src/*.chpl src/quickchpl/*.chpl test/*.chpl test/**/*.chpl examples/*.chpl > chplcheck.log 2>&1 || true | |
| cat chplcheck.log | |
| # Count violations (excluding intentional API design decisions) | |
| VIOLATIONS=$(grep -c "violates rule" chplcheck.log || true) | |
| echo "" | |
| echo "=== chplcheck Summary ===" | |
| echo "Total violations: $VIOLATIONS" | |
| echo "" | |
| # Known acceptable violations: | |
| # - 8 CamelCaseRecords (generator types - intentional API) | |
| # - 1 PascalCaseModules (quickchpl - package name) | |
| ACCEPTABLE=9 | |
| if [ "$VIOLATIONS" -gt "$ACCEPTABLE" ]; then | |
| echo "❌ Too many chplcheck violations (expected <=$ACCEPTABLE, got $VIOLATIONS)" | |
| exit 1 | |
| else | |
| echo "✅ chplcheck passed (acceptable violations: $VIOLATIONS/$ACCEPTABLE)" | |
| fi | |
| - name: Check for trailing whitespace | |
| run: | | |
| echo "Checking for trailing whitespace..." | |
| ! grep -rn '[[:space:]]$' src/*.chpl src/quickchpl/*.chpl test/*.chpl test/**/*.chpl examples/*.chpl || { | |
| echo "Found trailing whitespace" | |
| exit 1 | |
| } | |
| - name: Check file permissions | |
| run: | | |
| echo "Checking execute permissions on source files..." | |
| find src test examples -name "*.chpl" -perm +111 && { | |
| echo "Found executable .chpl files (should not be executable)" | |
| exit 1 | |
| } || echo "✓ No executable .chpl files found" | |
| generate-docs: | |
| name: Generate API Documentation | |
| runs-on: ubuntu-latest | |
| container: | |
| image: chapel/chapel:2.6.0 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate documentation with chpldoc | |
| run: | | |
| for file in src/quickchpl.chpl src/quickchpl/*.chpl; do | |
| echo "Generating docs for $file..." | |
| chpldoc "$file" --output-dir docs/api || echo "Warning: chpldoc failed for $file" | |
| done | |
| - name: Upload documentation artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-docs | |
| path: docs/api/ | |
| retention-days: 7 |