Repository navigation
Update costume retrieval to work with normal + shiny #101
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: Test Suite | |
| permissions: | |
| contents: read | |
| checks: write | |
| on: | |
| push: | |
| branches: | |
| - development | |
| - main | |
| pull_request: | |
| branches: | |
| - development | |
| - main | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| tests: | |
| name: Run Tests | |
| runs-on: ubuntu-24.04 | |
| environment: Test | |
| timeout-minutes: 30 | |
| # Set default working directory for all run steps | |
| defaults: | |
| run: | |
| working-directory: ./app | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: runner | |
| POSTGRES_PASSWORD: postgres_docker | |
| POSTGRES_DB: test_pogotracker | |
| ports: | |
| - 5435:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Java | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| - name: Setup CommandBox CLI | |
| uses: Ortus-Solutions/setup-commandbox@7be599028dcf77743854b2f6c720b15316f39be2 # v2.0.1 | |
| with: | |
| version: latest | |
| - name: Create .env file | |
| run: | | |
| cat > .env << 'EOL' | |
| ENVIRONMENT=test | |
| OTHER_EXTENSIONS=,CED6227E-0F49-6367-A68D21AACA6B07E8;version=1.0.0.7 | |
| CFCONFIG_ADMINPASSWORD=commandbox | |
| LUCEE_ADMIN_ENABLED=false | |
| INSPECTTEMPLATE=never | |
| IMAGEMAGICKPATH=/usr/bin | |
| HTTP_PORT=8084 | |
| HTTP_HOST=0.0.0.0 | |
| REQUESTTIMEOUT=60 | |
| SESSIONTIMEOUT=30 | |
| OS=linux | |
| JAVAHEAP=2048 | |
| DB_HOST=localhost | |
| DB_PORT=5435 | |
| DB_NAME=test_pogotracker | |
| DB_SCHEMA=public | |
| DB_USERNAME=runner | |
| DB_PASSWORD=postgres_docker | |
| DB_BUNDLEVERSION=42.7.9 | |
| EMAIL_SERVER=localhost | |
| EMAIL_PORT=587 | |
| EMAIL_USERNAME=noreply@pogotracker.app | |
| EMAIL_PASSWORD=test | |
| EMAIL_TLS=false | |
| EMAIL_SSL=false | |
| EMAIL_SPOOL=false | |
| ALGORITHM=SHA-512 | |
| ITERATIONS=2 | |
| PEPPER=AAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
| REINITKEY= | |
| RECAPTCHASITEKEY=${{ secrets.RECAPTCHASITEKEY }} | |
| RECAPTCHASECRETKEY=${{ secrets.RECAPTCHASECRETKEY }} | |
| EOL | |
| - name: Install, Migrate, Seed, and Start Server | |
| run: box recipe scripts/test-setup.boxr | |
| timeout-minutes: 10 | |
| - name: Wait for Server to be Ready | |
| run: | | |
| echo "Waiting for server to start..." | |
| for i in {1..60}; do | |
| if curl -sf http://localhost:8084 > /dev/null 2>&1; then | |
| echo "Server is ready!" | |
| exit 0 | |
| fi | |
| echo "Attempt $i: Server not ready yet..." | |
| sleep 2 | |
| done | |
| echo "Server failed to start" | |
| box server log | |
| exit 1 | |
| - name: Run TestBox Tests | |
| id: run_tests | |
| run: | | |
| mkdir -p tests/results | |
| box testbox run --verbose outputFile="tests/results/test-results" outputFormats="json,antjunit" \ | |
| || echo "TESTS_FAILED=true" >> $GITHUB_ENV | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| - name: Display Test Results | |
| if: always() | |
| run: | | |
| if [ -f "tests/results/test-results.json" ]; then | |
| echo "=== Test Results Summary ===" | |
| cat tests/results/test-results.json | jq -r ' | |
| "Total Bundles: \(.totalBundles)", | |
| "Total Suites: \(.totalSuites)", | |
| "Total Specs: \(.totalSpecs)", | |
| "Total Pass: \(.totalPass)", | |
| "Total Fail: \(.totalFail)", | |
| "Total Error: \(.totalError)", | |
| "Total Skipped: \(.totalSkipped)" | |
| ' | |
| else | |
| echo "No test results found!" | |
| ls -la tests/results/ || echo "Results directory doesn't exist" | |
| fi | |
| - name: Publish Test Reports | |
| uses: mikepenz/action-junit-report@5b7ee5a21e8674b695313d769f3cbdfd5d4d53a4 # v6.0.0 | |
| if: always() | |
| with: | |
| report_paths: | | |
| app/tests/results/**/*.xml | |
| check_name: "TestBox Report" | |
| include_passed: false | |
| fail_on_failure: true | |
| detailed_summary: true | |
| - name: TestBox Results Comment | |
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const path = 'tests/results/test-results.json'; | |
| let body; | |
| if (fs.existsSync(path)) { | |
| const results = JSON.parse(fs.readFileSync(path, 'utf8')); | |
| const total = results.totalSpecs ?? 0; | |
| const passed = results.totalPass ?? 0; | |
| const failed = results.totalFail ?? 0; | |
| const errored = results.totalError ?? 0; | |
| const skipped = results.totalSkipped ?? 0; | |
| const passRate = total > 0 ? ((passed / (total-skipped)) * 100).toFixed(1) : '0.0'; | |
| body = [ | |
| `## TestBox Suite`, | |
| '', | |
| '| Metric | Value |', | |
| '|--------|-------|', | |
| `| Bundles | ${results.totalBundles ?? 0} |`, | |
| `| Suites | ${results.totalSuites ?? 0} |`, | |
| `| Specs | ${total} |`, | |
| `| Passed | ${passed} |`, | |
| `| Failed | ${failed} |`, | |
| `| Errors | ${errored} |`, | |
| `| Skipped | ${skipped} |`, | |
| `| Pass Rate | ${passRate}% |`, | |
| ].join('\n'); | |
| } else { | |
| body = '## TestBox Results\n\nNo test results file found at `tests/results/test-results.json`.'; | |
| } | |
| // Find and update existing comment, or create a new one | |
| const marker = '<!-- testbox-results -->'; | |
| const fullBody = `${marker}\n${body}`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body: fullBody, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: fullBody, | |
| }); | |
| } | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: | | |
| app/tests/results/ | |
| app/tests/results/*.json | |
| app/tests/results/*.xml | |
| retention-days: 30 | |
| continue-on-error: true | |
| - name: Stop Server | |
| if: always() | |
| run: | | |
| box server stop --force | |
| continue-on-error: true |