Bump graphql_flutter from 5.2.0-beta.8 to 5.2.0 #3625
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
############################################################################## | |
############################################################################## | |
# | |
# NOTE! | |
# | |
# Please read the README.md file in this directory that defines what should | |
# be placed in this file | |
# | |
############################################################################## | |
############################################################################## | |
name: PR Workflow | |
on: | |
pull_request: | |
branches-ignore: | |
- "master" | |
env: | |
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }} | |
jobs: | |
Flutter-Codebase-Check: | |
name: Checking codebase | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
#needs: PR-Greeting | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- 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.27.3" | |
channel: "stable" # or: 'beta', 'dev' or 'master' | |
- name: Set default branch. | |
run: git remote set-head origin --auto | |
shell: bash | |
- name: Running pub get in talawa_lint | |
run: cd talawa_lint && flutter pub get && cd .. | |
- name: Running pub get to fetch dependencies | |
run: flutter pub get | |
- name: Checking for correct formatting of code | |
run: dart format --set-exit-if-changed . | |
- name: setup python | |
uses: actions/setup-python@v5 | |
- name: Count lines of code in each file | |
run: chmod +x ./.github/workflows/scripts/countline.py | |
- name: Running count lines | |
run: ./.github/workflows/scripts/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart lib/views/after_auth_screens/events/manage_volunteer_group.dart lib/views/after_auth_screens/events/create_agenda_item_page.dart lib/views/after_auth_screens/events/edit_agenda_item_page.dart lib/utils/event_queries.dart | |
- name: Check for presence of ignore directives corresponding to custom lints | |
run: chmod +x ./.github/workflows/scripts/check_ignore.py | |
- name: Run check_ignore | |
run: | | |
if [[ -n "$(git status --porcelain pubspec.lock)" ]]; then | |
echo "Uncommitted changes detected in pubspec.lock. Stashing just that file..." | |
git stash push -u -- "pubspec.lock" | |
fi | |
git branch | |
git checkout -b temp_branch | |
git branch | |
git checkout develop | |
git pull | |
git branch | |
git diff --name-only develop..HEAD | |
git checkout temp_branch | |
pip install GitPython | |
python ./.github/workflows/scripts/check_ignore.py --repository ${{github.repository}} --merge_branch_name ${{github.head_ref}} | |
if git stash list | grep -q "stash@{0}"; then | |
echo "Restoring stashed changes..." | |
git stash pop | |
fi | |
- name: Compare translation files | |
run: | | |
chmod +x .github/workflows/scripts/compare_translations.py | |
python .github/workflows/scripts/compare_translations.py --directory lang | |
- name: Analysing codebase for default linting | |
run: flutter analyze --no-pub | |
- name: Analysing codebase for custom linting | |
run: dart run custom_lint | |
- name: Changed Files | |
id: changed-files | |
run: | | |
# Get the base branch ref | |
BASE_SHA=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) | |
# Get all changed files | |
ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT $BASE_SHA ${{ github.event.pull_request.head.sha }} | tr '\n' ' ') | |
echo "all_changed_files=${ALL_CHANGED_FILES}" >> $GITHUB_OUTPUT | |
- name: List all changed files | |
run: | | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
echo "$file was changed" | |
done | |
- name: Check if the source and target branches are different | |
if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} | |
run: | | |
echo "Source Branch ${{ github.event.pull_request.head.ref }}" | |
echo "Target Branch ${{ github.event.pull_request.base.ref }}" | |
echo "Error: Source and Target Branches are the same. Please ensure they are different." | |
echo "Error: Close this PR and try again." | |
exit 1 | |
Branch-check: | |
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} | |
name: "Base branch check" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check if base branch is develop" | |
if: github.event.pull_request.base.ref != 'develop' | |
run: | | |
echo "PR is not against develop branch. Please refer PR_GUIDELINES.md" | |
echo "Error: Close this PR and try again." | |
exit 1 | |
Check-Sensitive-Files: | |
if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} | |
name: Checks if sensitive files have been changed without authorization | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Get Changed Unauthorized files | |
id: changed-unauth-files | |
run : | | |
# Get the base branch ref | |
BASE_SHA=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) | |
# Define sensitive files pattern | |
SENSITIVE_FILES=".flake8 .pydocstyle pyproject.toml .env* vitest.config.js src/App.tsx .github/** env.example .node-version .husky/** scripts/** src/style/** schema.graphql package.json package-lock.json tsconfig.json .gitignore .eslintrc.json .eslintignore .prettierrc .prettierignore vite.config.ts docker/docker-compose.prod.yaml docker/docker-compose.dev.yaml docker/Dockerfile.dev docker/Dockerfile.prod config/docker/setup/nginx.conf config/docker/setup/nginx.prod.conf CODEOWNERS LICENSE setup.ts .coderabbit.yaml CODE_OF_CONDUCT.md CODE_STYLE.md CONTRIBUTING.md DOCUMENTATION.md INSTALLATION.md ISSUE_GUIDELINES.md PR_GUIDELINES.md README.md *.pem *.key *.cert *.password *.secret *.credentials .nojekyll yarn.lock docs/docusaurus.config.ts docs/sidebar* CNAME" | |
# Check for changes in sensitive files | |
CHANGED_UNAUTH_FILES="" | |
for pattern in $SENSITIVE_FILES; do | |
FILES=$(git diff --name-only --diff-filter=ACMRD $BASE_SHA ${{ github.event.pull_request.head.sha }} | grep -E "$pattern" || true) | |
if [ ! -z "$FILES" ]; then | |
CHANGED_UNAUTH_FILES="$CHANGED_UNAUTH_FILES $FILES" | |
fi | |
done | |
# Trim and format output | |
CHANGED_UNAUTH_FILES=$(echo "$CHANGED_UNAUTH_FILES" | xargs) | |
echo "all_changed_files=$CHANGED_UNAUTH_FILES" >> $GITHUB_OUTPUT | |
# Check if any unauthorized files changed | |
if [ ! -z "$CHANGED_UNAUTH_FILES" ]; then | |
echo "any_changed=true" >> $GITHUB_OUTPUT | |
echo "any_deleted=true" >> $GITHUB_OUTPUT | |
else | |
echo "any_changed=false" >> $GITHUB_OUTPUT | |
echo "any_deleted=false" >> $GITHUB_OUTPUT | |
fi | |
- name: List all changed unauthorized files | |
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' | |
env: | |
CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} | |
run: | | |
for file in ${CHANGED_UNAUTH_FILES}; do | |
echo "$file is unauthorized to change/delete" | |
done | |
echo "To override this, apply the 'ignore-sensitive-files-pr' label" | |
exit 1 | |
Count-Changed-Files: | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Checks if number of files changed is acceptable | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 #Fetch all history for all branches and tags | |
- name: Get changed files | |
id: changed-files | |
run: | | |
#Get the base branch ref | |
BASE_SHA=$(git merge-base ${{github.event.pull_request.base.sha}} ${{github.event.pull_request.head.sha}}) | |
#Get all changed files | |
ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT $BASE_SHA ${{github.event.pull_request.head.sha}} | tr '\n' ' ') | |
echo "all_changed_files=${ALL_CHANGED_FILES}" >> $GITHUB_OUTPUT | |
- env: | |
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }} | |
if: steps.changed_files.outputs.any_changed == 'true' || steps.changed_files.outputs.any_deleted == 'true' | |
name: Show changed files | |
run: | | |
echo "Unauthorized changes were made in the following files:" | |
for FILE in ${CHANGED_FILES}; do | |
echo "$FILE" | |
done | |
echo "To override this, apply the 'ignore-sensitive-files-pr' label" | |
exit 1 | |
- name: Echo number of changed files | |
env: | |
CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} | |
run: | | |
echo "Number of files changed: $CHANGED_FILES_COUNT" | |
- name: Check if the number of changed files is less than 100 | |
if: steps.changed-files.outputs.all_changed_files_count > 100 | |
env: | |
CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} | |
run: | | |
echo "Error: Too many files (greater than 100) changed in the pull request." | |
echo "Possible issues:" | |
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, Python-Compliance] | |
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.27.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-Testing] | |
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.27.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-Testing] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.27.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 branch and not dependabot | |
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} | |
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 | |
working-directory: ./docs | |
run: npm install | |
- name: Test building the website | |
working-directory: ./docs | |
run: npm run build | |
Python-Compliance: | |
name: Check Python Code Style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Cache pip packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r .github/workflows/requirements.txt | |
- name: Run Black Formatter Check | |
run: | | |
source venv/bin/activate | |
black --check . | |
- name: Run Flake8 Linter | |
run: | | |
source venv/bin/activate | |
flake8 --docstring-convention google --ignore E402,E722,E203,F401,W503 .github scripts | |
- name: Run pydocstyle | |
run: | | |
source venv/bin/activate | |
pydocstyle --convention=google --add-ignore=D415,D205 .github scripts | |
- name: Run docstring compliance check | |
run: | | |
source venv/bin/activate | |
python .github/workflows/scripts/check_docstrings.py --directories .github scripts |