From 918eb7e79724c5e4d34ddc4242f48d09e166bf2e Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Fri, 3 Jan 2025 08:26:52 -0800 Subject: [PATCH] Update pull-request.yml --- .github/workflows/pull-request.yml | 182 ++++++++++++++++------------- 1 file changed, 102 insertions(+), 80 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6c778ec268..c37a554f72 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -93,85 +93,6 @@ jobs: echo "Error: Close this PR and try again." exit 1 - # - name: Echo the GitHub environment for troubleshooting - # run: echo "$GITHUB_CONTEXT" - # - name: Echo the GitHub context for troubleshooting - # run: echo "${{ toJSON(github) }}" - # - name: setup python - # uses: actions/setup-python@v5 - # - name: Granting permission to documentationcheck.py - # run: chmod +x ./.github/workflows/documentationcheck.py - # - name: execute py script - # # For more information on the GitHub context used for the "--repository" flag used by this script visit: - # # https://docs.github.com/en/actions/learn-github-actions/contexts - # run: | - # git branch - # pip install GitPython - # python ./.github/workflows/documentationcheck.py --repository ${{github.repository}} --merge_branch_name ${{github.ref_name}} - - Flutter-Testing: - name: Testing codebase - runs-on: ubuntu-latest - needs: Flutter-Codebase-Check - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: "zulu" # See 'Supported distributions' for available options - java-version: "17.0" - - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.22.3" - channel: "stable" # or: 'beta', 'dev' or 'master' - - name: Running pub get to fetch dependencies - run: flutter pub get - - name: Codebase testing - run: flutter test --coverage - - name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false - name: "${{env.CODECOV_UNIQUE_NAME}}" - - name: Test acceptable level of code coverage - uses: VeryGoodOpenSource/very_good_coverage@v3 - with: - path: "./coverage/lcov.info" - min_coverage: 92.0 - - Android-Build: - name: Testing build for android - runs-on: ubuntu-latest - needs: Flutter-Codebase-Check - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: "zulu" # See 'Supported distributions' for available options - java-version: "17.0" - - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.22.3" - channel: "stable" # or: 'beta', 'dev' or 'master' - - name: Running pub get to fetch dependencies - run: flutter pub get - - name: Building for android - run: flutter build apk - - iOS-Build: - name: Testing build for iOS - runs-on: macos-latest - needs: Flutter-Codebase-Check - steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.22.3" - channel: "stable" # or: 'beta', 'dev' or 'master' - architecture: x64 - - name: Building for ios - run: flutter build ios --release --no-codesign Branch-check: if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} @@ -192,7 +113,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Get Changed Unauthorized files id: changed-unauth-files uses: tj-actions/changed-files@v45 @@ -251,3 +171,105 @@ jobs: echo "- Contributor may be merging into an incorrect branch." echo "- Source branch may be incorrect please use develop as source branch." exit 1 + + Flutter-Testing: + name: Testing codebase + runs-on: ubuntu-latest + needs: Flutter-Codebase-Check + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: "zulu" # See 'Supported distributions' for available options + java-version: "17.0" + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Codebase testing + run: flutter test --coverage + - name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false + name: "${{env.CODECOV_UNIQUE_NAME}}" + - name: Test acceptable level of code coverage + uses: VeryGoodOpenSource/very_good_coverage@v3 + with: + path: "./coverage/lcov.info" + min_coverage: 92.0 + + Android-Build: + name: Testing build for android + runs-on: ubuntu-latest + needs: Flutter-Codebase-Check + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: "zulu" # See 'Supported distributions' for available options + java-version: "17.0" + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + - name: Running pub get to fetch dependencies + run: flutter pub get + - name: Building for android + run: flutter build apk + + iOS-Build: + name: Testing build for iOS + runs-on: macos-latest + needs: Flutter-Codebase-Check + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.3" + channel: "stable" # or: 'beta', 'dev' or 'master' + architecture: x64 + - name: Building for ios + run: flutter build ios --release --no-codesign + + Test-Docusaurus-Deployment: + name: Test Deployment to https://docs-mobile.talawa.io + runs-on: ubuntu-latest + needs: [iOS-Build, Android-Build] + # Run only if the develop-postgres branch and not dependabot + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop-postgres' }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: yarn + cache-dependency-path: 'docs/' + # Run Docusaurus in the ./docs directory + - name: Install dependencies + working-directory: ./docs + run: yarn install --frozen-lockfile + - name: Test building the website + working-directory: ./docs + run: yarn build + + Validate-Coderabbit: + name: Validate CodeRabbit Approval + runs-on: ubuntu-latest + if: github.actor != 'dependabot[bot]' + needs: [Test-Docusaurus-Deployment] + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Validate CodeRabbit.ai Approval + run: | + chmod +x $GITHUB_WORKSPACE/.github/workflows/scripts/validate-coderabbit.sh + $GITHUB_WORKSPACE/.github/workflows/scripts/validate-coderabbit.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_REPOSITORY: ${{ github.repository }}