diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5096758ea5..f63b4f9d91 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -42,7 +42,7 @@ jobs: - name: Get changed TypeScript files id: changed-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@v40 - name: Check formatting if: steps.changed-files.outputs.only_changed != 'true' run: npm run format:check @@ -58,9 +58,7 @@ jobs: - name: Check for linting errors in modified files if: steps.changed-files.outputs.only_changed != 'true' env: - CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py - + CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }} - name: Check for TSDoc comments run: npm run check-tsdoc # Run the TSDoc check script @@ -92,10 +90,9 @@ jobs: - name: Get Changed Unauthorized files id: changed-unauth-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@v40 with: files: | - .env* .github/** env.example .node-version @@ -125,12 +122,7 @@ jobs: ISSUE_GUIDELINES.md PR_GUIDELINES.md README.md - *.pem - *.key - *.cert - *.password - *.secret - *.credentials + - name: List all changed unauthorized files if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' @@ -152,7 +144,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@v40 - name: Echo number of changed files env: @@ -205,7 +197,8 @@ jobs: - name: Get changed TypeScript files id: changed-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@v40 + - name: Run Jest Tests if: steps.changed-files.outputs.only_changed != 'true' @@ -238,17 +231,17 @@ jobs: fi done - - name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} + - name:Upload Coverage to Codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: false + files: './coverage/lcov.info' name: '${{env.CODECOV_UNIQUE_NAME}}' - name: Test acceptable level of code coverage - uses: VeryGoodOpenSource/very_good_coverage@v3 + uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: "./coverage/lcov.info" min_coverage: 0.0 @@ -276,130 +269,10 @@ jobs: echo "FULL_Branch_NAME: $FULL_BRANCH_NAME" # Clone the specified repository using the extracted branch name - git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a + git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a - name: Validate Documents run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' - Start-App-Without-Docker: - name: Check if Talawa Admin app starts (No Docker) - runs-on: ubuntu-latest - needs: [Code-Quality-Checks, Test-Application] - if: github.actor != 'dependabot' - steps: - - name: Checkout the Repository - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.x' - - - name: Install Dependencies - run: npm install - - - name: Build Production App - run: npm run build - - - name: Start Production App - run: | - npm run preview & - echo $! > .pidfile_prod - - name: Check if Production App is running - run: | - timeout=120 - echo "Starting production health check with ${timeout}s timeout" - while ! nc -z localhost 4173 && [ $timeout -gt 0 ]; do - sleep 1 - timeout=$((timeout-1)) - if [ $((timeout % 10)) -eq 0 ]; then - echo "Still waiting for production app to start... ${timeout}s remaining" - fi - done - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for production application to start" - exit 1 - fi - echo "Production app started successfully" - - name: Stop Production App - run: | - if [ -f .pidfile_prod ]; then - kill "$(cat .pidfile_prod)" - fi - - name: Start Development App - run: | - npm run serve & - echo $! > .pidfile_dev - - name: Check if Development App is running - run: | - timeout=120 - echo "Starting development health check with ${timeout}s timeout" - while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do - sleep 1 - timeout=$((timeout-1)) - if [ $((timeout % 10)) -eq 0 ]; then - echo "Still waiting for development app to start... ${timeout}s remaining" - fi - done - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for development application to start" - exit 1 - fi - echo "Development app started successfully" - - name: Stop Development App - if: always() - run: | - if [ -f .pidfile_dev ]; then - kill "$(cat .pidfile_dev)" - fi - Docker-Start-Check: - name: Check if Talawa Admin app starts in Docker - runs-on: ubuntu-latest - needs: [Code-Quality-Checks, Test-Application] - if: github.actor != 'dependabot' - steps: - - name: Checkout the Repository - uses: actions/checkout@v4 - - - name: Set up Docker - uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:latest - - name: Build Docker image - run: | - set -e - echo "Building Docker image..." - docker build -t talawa-admin-app . - echo "Docker image built successfully" - - name: Run Docker Container - run: | - set -e - echo "Started Docker container..." - docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app - echo "Docker container started successfully" - - name: Check if Talawa Admin App is running - run: | - timeout="${HEALTH_CHECK_TIMEOUT:-120}" - echo "Starting health check with ${timeout}s timeout" - while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do - sleep 1 - timeout=$((timeout-1)) - if [ $((timeout % 10)) -eq 0 ]; then - echo "Still waiting for app to start... ${timeout}s remaining" - fi - done - if [ $timeout -eq 0 ]; then - echo "Timeout waiting for application to start" - echo "Container logs:" - docker logs talawa-admin-app-container - exit 1 - fi - echo "Port check passed, verifying health endpoint..." - - name: Stop Docker Container - if: always() - run: | - docker stop talawa-admin-app-container - docker rm talawa-admin-app-container Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} @@ -407,7 +280,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check if the target branch is develop - if: github.event.pull_request.base.ref != 'develop-postgres' + if: github.event.pull_request.base.ref != 'develop' run: | - echo "Error: Pull request target branch must be 'develop-postgres'. Please refer PR_GUIDELINES.md" + echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md" exit 1