Comprehensive CI - Full Integration Tests #55
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: Comprehensive CI - Full Integration Tests | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 2 * * *' # Daily at 2 AM UTC | |
| push: | |
| branches: ["main"] | |
| paths-ignore: ["**.md", "docs/**"] | |
| jobs: | |
| build-docker: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| tags: impact:ci-${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Save Docker image | |
| run: | | |
| docker save impact:ci-${{ github.sha }} -o impact-image.tar | |
| - name: Upload Docker image | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: impact-image.tar | |
| retention-days: 1 | |
| test-all-examples: | |
| name: "Test: ${{ matrix.example }}" | |
| runs-on: ubuntu-latest | |
| needs: build-docker | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: | |
| # Small examples | |
| - ex_2Drobot-R-U | |
| - ex_2Drobot-R-D | |
| - ex_4DBAS-S | |
| - ex_customPDF | |
| - ex_multivariateNormalPDF | |
| # Medium examples | |
| - ex_2Drobot-RA-U | |
| - ex_2Drobot-RA-D | |
| - ex_3Dvehicle-RA | |
| # Large examples | |
| - ex_3Droom-S | |
| - ex_5Droom-S | |
| - ex_7DBAS-S | |
| # Special cases | |
| - ex_load_reach | |
| - ex_load_safe | |
| steps: | |
| - name: Download Docker image | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-image | |
| - name: Load Docker image | |
| run: | | |
| docker load -i impact-image.tar | |
| - name: Compile and run example | |
| id: test | |
| timeout-minutes: 45 | |
| run: | | |
| # Determine executable name | |
| case "${{ matrix.example }}" in | |
| *robot*) EXEC="robot2D" ;; | |
| *BAS4D*|*4DBAS*) EXEC="BAS4D" ;; | |
| *BAS7D*|*7DBAS*) EXEC="BAS7D" ;; | |
| *vehicle*) EXEC="vehicle3D" ;; | |
| *room3D*|*3Droom*) EXEC="room3D" ;; | |
| *room5D*|*5Droom*) EXEC="room5D" ;; | |
| *load*) EXEC="load" ;; | |
| *customPDF*) EXEC="customPDF" ;; | |
| *multivariateNormalPDF*) EXEC="multivariateNormalPDF" ;; | |
| *) EXEC="" ;; | |
| esac | |
| # Create output directories | |
| mkdir -p outputs logs | |
| # Run in Docker | |
| docker run --rm \ | |
| -v $(pwd)/outputs:/outputs \ | |
| -v $(pwd)/logs:/logs \ | |
| impact:ci-${{ github.sha }} \ | |
| -c " | |
| cd /app/examples/${{ matrix.example }} && \ | |
| echo '=== Compiling ===' && \ | |
| make 2>&1 | tee /logs/compile.log && \ | |
| COMPILE_STATUS=\${PIPESTATUS[0]} && \ | |
| if [ \$COMPILE_STATUS -ne 0 ]; then | |
| echo 'Compilation failed' | |
| exit 1 | |
| fi && \ | |
| echo '=== Running ===' && \ | |
| if [ -n '$EXEC' ]; then | |
| ./$EXEC 2>&1 | tee /logs/run.log | |
| else | |
| FOUND_EXEC=\$(ls | grep -v '\\.' | head -n 1) | |
| ./\$FOUND_EXEC 2>&1 | tee /logs/run.log | |
| fi && \ | |
| RUN_STATUS=\${PIPESTATUS[0]} && \ | |
| if [ \$RUN_STATUS -ne 0 ]; then | |
| echo 'Execution failed' | |
| exit 1 | |
| fi && \ | |
| echo '=== Copying outputs ===' && \ | |
| cp *.h5 /outputs/ 2>/dev/null || echo 'No HDF5 files found' | |
| " | |
| # Check results | |
| H5_COUNT=$(ls outputs/*.h5 2>/dev/null | wc -l) | |
| echo "output_count=$H5_COUNT" >> $GITHUB_OUTPUT | |
| if [ "$H5_COUNT" -gt 0 ]; then | |
| echo "✅ Generated $H5_COUNT HDF5 files" | |
| ls -lh outputs/*.h5 | |
| echo "success=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "❌ No HDF5 files generated" | |
| echo "success=false" >> $GITHUB_OUTPUT | |
| exit 1 | |
| fi | |
| continue-on-error: true | |
| - name: Upload outputs | |
| if: steps.test.outputs.success == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: outputs-${{ matrix.example }} | |
| path: outputs/*.h5 | |
| retention-days: 7 | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: logs-${{ matrix.example }} | |
| path: logs/ | |
| retention-days: 7 | |
| - name: Report status | |
| if: always() | |
| run: | | |
| echo "## ${{ matrix.example }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.test.outputs.success }}" = "true" ]; then | |
| echo "✅ **Test passed** - Generated ${{ steps.test.outputs.output_count }} HDF5 files" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "❌ **Test failed**" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| generate-report: | |
| name: Generate Test Report | |
| runs-on: ubuntu-latest | |
| needs: test-all-examples | |
| if: always() | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Generate summary report | |
| run: | | |
| echo "# Comprehensive Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Count examples | |
| TOTAL=13 # Total number of examples tested | |
| echo "**Examples tested**: $TOTAL" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Check for output files | |
| echo "## Output Files Generated" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| for dir in outputs-*/; do | |
| if [ -d "$dir" ]; then | |
| example=$(basename "$dir" | sed 's/outputs-//') | |
| count=$(ls "$dir"/*.h5 2>/dev/null | wc -l) | |
| if [ "$count" -gt 0 ]; then | |
| echo "- ✅ $example: $count files" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "- ❌ $example: no files" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| fi | |
| done | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "See individual job results for detailed logs." >> $GITHUB_STEP_SUMMARY | |
| - name: Create test results archive | |
| run: | | |
| mkdir -p test-results | |
| cp -r outputs-* test-results/ 2>/dev/null || true | |
| cp -r logs-* test-results/ 2>/dev/null || true | |
| tar -czf comprehensive-test-results.tar.gz test-results/ | |
| - name: Upload test results archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: comprehensive-test-results | |
| path: comprehensive-test-results.tar.gz | |
| retention-days: 30 |