Skip to content

refactor: consolidate tests/ to test/ directory #16

refactor: consolidate tests/ to test/ directory

refactor: consolidate tests/ to test/ directory #16

Workflow file for this run

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 --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 test/unit/GeneratorTests.chpl src/*.chpl -o /tmp/generator_tests
/tmp/generator_tests
- name: Run Shrinker Tests
run: |
echo "Running Shrinker Tests..."
chpl test/unit/ShrinkerTests.chpl src/*.chpl -o /tmp/shrinker_tests
/tmp/shrinker_tests
- name: Run Property Tests
run: |
echo "Running Property Tests..."
chpl test/unit/PropertyTests.chpl src/*.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 examples/GettingStarted.chpl src/*.chpl -o /tmp/getting_started
/tmp/getting_started
- name: Run Algebraic Properties Example
run: |
echo "Running Algebraic Properties Example..."
chpl examples/AlgebraicProperties.chpl src/*.chpl -o /tmp/algebraic
/tmp/algebraic
- name: Run Custom Generators Example
run: |
echo "Running Custom Generators Example..."
chpl examples/CustomGenerators.chpl src/*.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 test/properties/SelfTests.chpl src/*.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 test/unit/GeneratorTests.chpl src/*.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 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)
# - 21 UnusedLoopIndex (_unused variable - Chapel limitation)
# - 1 PascalCaseModules (quickchpl - package name)
ACCEPTABLE=30
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 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: |
cd src
for file in *.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