Start 7.0.0 release #16
Workflow file for this run
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: Build, Test and Package (Parallel) | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| - develop | |
| - 'hotfix/**' | |
| paths-ignore: | |
| - '**/*.md' | |
| - 'docs/**' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| - 'hotfix/**' | |
| paths-ignore: | |
| - '**/*.md' | |
| - 'docs/**' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| jobs: | |
| build: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: ['22.x'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # Fetch full history for changelog generation and version comparison | |
| fetch-depth: 0 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| # setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Declare some variables | |
| id: vars | |
| shell: bash | |
| run: | | |
| # Extract branch name and sanitize for artifact naming | |
| branch_name="${GITHUB_REF#refs/heads/}" | |
| # For pull requests, use a cleaner name | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| branch_name="pr-${{ github.event.number }}" | |
| fi | |
| # Replace invalid characters for artifact names | |
| safe_branch=$(echo "$branch_name" | sed 's/[\/\\<>:"|?*]/-/g') | |
| echo "branch=$branch_name" >> $GITHUB_OUTPUT | |
| echo "safe_branch=$safe_branch" >> $GITHUB_OUTPUT | |
| - name: get-npm-version | |
| id: package-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| - name: Get Env Ready | |
| run: | | |
| npm ci | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: | | |
| cd src | |
| echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Build App | |
| run: | | |
| npm run package | |
| - name: Validate PHP Syntax | |
| run: | | |
| echo "🔍 Validating PHP syntax for all files in signatures..." | |
| npm run build:php:validate | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ github.run_id }} | |
| path: | | |
| src/ | |
| temp/ | |
| !src/logs | |
| retention-days: 1 | |
| test-root: | |
| needs: build | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download Build Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-${{ github.run_id }} | |
| path: . | |
| - name: Install Composer Dependencies | |
| run: | | |
| cd src | |
| composer install --no-dev | |
| - name: Run Docker (Root Path) | |
| run: npm run docker:ci:root:start | |
| - name: Wait for Docker to be ready | |
| run: | | |
| echo "Waiting for root path services to be ready..." | |
| sleep 10 | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-root ps -a | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-root logs | |
| - name: Test Server (Root Path) | |
| run: | | |
| echo "Testing root path API endpoint..." | |
| max_attempts=12 | |
| attempt=1 | |
| until curl -f http://127.0.0.1/api/public/echo || [ $attempt -eq $max_attempts ]; do | |
| echo "Attempt $attempt/$max_attempts failed. Retrying in 5 seconds..." | |
| sleep 5 | |
| attempt=$((attempt + 1)) | |
| done | |
| if [ $attempt -eq $max_attempts ]; then | |
| echo "Server failed to respond after $max_attempts attempts" | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-root ps -a | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-root logs | |
| exit 1 | |
| fi | |
| echo "Root path server is responding!" | |
| curl -vvv http://127.0.0.1/api/public/echo | |
| - name: Run Cypress Tests (Root Path) | |
| run: | | |
| npm run test:root | |
| - name: Collect Docker Logs on Failure | |
| if: failure() | |
| run: | | |
| mkdir -p cypress/logs/docker | |
| echo "=== Docker Container Logs ===" > cypress/logs/docker/docker-compose-root.log | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-root logs >> cypress/logs/docker/docker-compose-root.log 2>&1 || true | |
| echo "=== Docker Container Status ===" >> cypress/logs/docker/docker-compose-root.log | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-root ps -a >> cypress/logs/docker/docker-compose-root.log 2>&1 || true | |
| echo "=== Collecting PHP Application Logs ===" | |
| mkdir -p cypress/logs/php | |
| if [ -d "src/logs" ]; then | |
| cp -r src/logs cypress/logs/php/ || true | |
| fi | |
| - name: Upload Cypress Artifacts (Root) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cypress-artifacts-root-${{ github.run_id }} | |
| path: | | |
| cypress/logs | |
| cypress/results | |
| cypress/screenshots | |
| cypress/videos | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| - name: Stop Docker | |
| if: always() | |
| run: | | |
| npm run docker:ci:root:down | |
| test-subdir: | |
| needs: build | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download Build Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-${{ github.run_id }} | |
| path: . | |
| - name: Install Composer Dependencies | |
| run: | | |
| cd src | |
| composer install --no-dev | |
| - name: Run Docker (Subdirectory Path) | |
| run: npm run docker:ci:subdir:start | |
| - name: Wait for Docker to be ready | |
| run: | | |
| echo "Waiting for subdirectory path services to be ready..." | |
| sleep 10 | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-subdir ps -a | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-subdir logs | |
| - name: Test Server (Subdirectory Path) | |
| run: | | |
| echo "Testing subdirectory path API endpoint..." | |
| max_attempts=12 | |
| attempt=1 | |
| until curl -f http://127.0.0.1:8080/churchcrm/api/public/echo || [ $attempt -eq $max_attempts ]; do | |
| echo "Attempt $attempt/$max_attempts failed. Retrying in 5 seconds..." | |
| sleep 5 | |
| attempt=$((attempt + 1)) | |
| done | |
| if [ $attempt -eq $max_attempts ]; then | |
| echo "Server failed to respond after $max_attempts attempts" | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-subdir ps -a | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-subdir logs | |
| exit 1 | |
| fi | |
| echo "Subdirectory path server is responding!" | |
| curl -vvv http://127.0.0.1:8080/churchcrm/api/public/echo | |
| - name: Run Cypress Tests (Subdirectory Path) | |
| run: | | |
| npm run test:subdir | |
| - name: Collect Docker Logs on Failure | |
| if: failure() | |
| run: | | |
| mkdir -p cypress/logs/docker | |
| echo "=== Docker Container Logs ===" > cypress/logs/docker/docker-compose-subdir.log | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-subdir logs >> cypress/logs/docker/docker-compose-subdir.log 2>&1 || true | |
| echo "=== Docker Container Status ===" >> cypress/logs/docker/docker-compose-subdir.log | |
| docker compose -f docker/docker-compose.yaml -f docker/docker-compose.parallel.yaml --profile ci-subdir ps -a >> cypress/logs/docker/docker-compose-subdir.log 2>&1 || true | |
| echo "=== Collecting PHP Application Logs ===" | |
| mkdir -p cypress/logs/php | |
| if [ -d "src/logs" ]; then | |
| cp -r src/logs cypress/logs/php/ || true | |
| fi | |
| - name: Upload Cypress Artifacts (Subdir) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cypress-artifacts-subdir-${{ github.run_id }} | |
| path: | | |
| cypress/logs | |
| cypress/results | |
| cypress/screenshots | |
| cypress/videos | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| - name: Stop Docker | |
| if: always() | |
| run: | | |
| npm run docker:ci:subdir:down | |
| package: | |
| needs: [test-root, test-subdir] | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| cache: 'npm' | |
| - name: Declare some variables | |
| id: vars | |
| shell: bash | |
| run: | | |
| # Extract branch name and sanitize for artifact naming | |
| branch_name="${GITHUB_REF#refs/heads/}" | |
| # For pull requests, use a cleaner name | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| branch_name="pr-${{ github.event.number }}" | |
| fi | |
| # Replace invalid characters for artifact names | |
| safe_branch=$(echo "$branch_name" | sed 's/[\/\\<>:"|?*]/-/g') | |
| echo "branch=$branch_name" >> $GITHUB_OUTPUT | |
| echo "safe_branch=$safe_branch" >> $GITHUB_OUTPUT | |
| - name: get-npm-version | |
| id: package-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| - name: Download Build Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-${{ github.run_id }} | |
| path: . | |
| - name: List build artifacts | |
| run: | | |
| echo "📦 Build artifacts created:" | |
| if [ -d "temp" ]; then | |
| ls -la temp/ | |
| echo "" | |
| echo "📊 File sizes:" | |
| du -h temp/* | |
| else | |
| echo "❌ No temp directory found" | |
| exit 1 | |
| fi | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: >- | |
| ${{ github.ref == 'refs/heads/master' && | |
| format('ChurchCRM-{0}', steps.package-version.outputs.current-version) || | |
| (github.event_name == 'pull_request' && | |
| format('ChurchCRM-{0}-PR{1}', steps.package-version.outputs.current-version, github.event.number) || | |
| format('ChurchCRM-{0}-{1}', steps.package-version.outputs.current-version, steps.vars.outputs.safe_branch)) }} | |
| path: temp/ChurchCRM-*.zip | |
| retention-days: 90 | |
| if-no-files-found: error | |
| - name: Build Summary | |
| if: always() | |
| run: | | |
| echo "## 🏗️ Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**📦 Version:** ${{ steps.package-version.outputs.current-version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**🌿 Branch:** ${{ steps.vars.outputs.branch }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**📝 Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**✅ Tests Passed:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Root path installation tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Subdirectory installation tests" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -d "temp" ]; then | |
| echo "**📦 Artifacts Created:**" >> $GITHUB_STEP_SUMMARY | |
| for file in temp/ChurchCRM-*.zip; do | |
| if [ -f "$file" ]; then | |
| size=$(ls -lh "$file" | awk '{print $5}') | |
| echo "- 📄 \`$(basename "$file")\` ($size)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| done | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| fi |