Implement updates for better performance #33
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: CI Formatting Check | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| formatting_check: | |
| runs-on: ubuntu-latest | |
| env: | |
| BACKEND_DIR: backend | |
| WEB_FRONTEND_DIR: web-frontend | |
| MOBILE_FRONTEND_DIR: mobile-frontend | |
| INFRASTRUCTURE_DIR: infrastructure | |
| steps: | |
| # ------------------------------- | |
| # Checkout Repository | |
| # ------------------------------- | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| # ------------------------------- | |
| # Java Setup + Formatting | |
| # ------------------------------- | |
| - name: Set up Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Install Google Java Format | |
| run: | | |
| curl -LJO https://github.com/google/google-java-format/releases/download/v1.17.0/google-java-format-1.17.0-all-deps.jar | |
| - name: Run Java Formatting Checks | |
| working-directory: ${{ env.BACKEND_DIR }} | |
| run: | | |
| echo "=== Running Google Java Format ===" | |
| find . -name "*.java" | while read file; do | |
| java -jar ../google-java-format-1.17.0-all-deps.jar --dry-run "$file" || exit 1 | |
| done | |
| # ------------------------------- | |
| # Node + Prettier Setup | |
| # ------------------------------- | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| # Install Node dependencies (root) | |
| - name: Install Node Dependencies | |
| working-directory: . | |
| run: npm ci | |
| # Prettier: web-frontend | |
| - name: Run Prettier Checks (web-frontend) | |
| working-directory: . | |
| run: | | |
| echo "=== Running Prettier (web-frontend) ===" | |
| ./node_modules/.bin/prettier --check "web-frontend/**/*.{js,jsx,ts,tsx,json,html,css,md}" | |
| # Prettier: mobile-frontend | |
| - name: Run Prettier Checks (mobile-frontend) | |
| working-directory: . | |
| run: | | |
| echo "=== Running Prettier (mobile-frontend) ===" | |
| ./node_modules/.bin/prettier --check "mobile-frontend/**/*.{js,jsx,ts,tsx,json,html,css,md}" | |
| # ------------------------------- | |
| # New: Repository-wide Markdown check (ALL .md files) | |
| # ------------------------------- | |
| - name: Run Prettier Checks (all .md files in repo) | |
| working-directory: . | |
| run: | | |
| echo "=== Running Prettier (all .md files) ===" | |
| ./node_modules/.bin/prettier --check "**/*.md" || { | |
| echo "Prettier formatting issues detected in markdown files across the repo." | |
| exit 1 | |
| } | |
| # ------------------------------- | |
| # New: Infrastructure directory YAML/YML check (infrastructure/*.yml, *.yaml) | |
| # ------------------------------- | |
| - name: Run Prettier Checks (infrastructure YAML/YML files) | |
| working-directory: . | |
| run: | | |
| if [ -n "${{ env.INFRASTRUCTURE_DIR }}" ] && [ -d "${{ env.INFRASTRUCTURE_DIR }}" ]; then | |
| echo "=== Running Prettier (infrastructure YAML/YML files) in ${INFRASTRUCTURE_DIR} ===" | |
| ./node_modules/.bin/prettier --check "${{ env.INFRASTRUCTURE_DIR }}/**/*.{yml,yaml}" || { | |
| echo "Prettier formatting issues detected in ${INFRASTRUCTURE_DIR} YAML/YML files." | |
| exit 1 | |
| } | |
| else | |
| echo "No infrastructure directory '${{ env.INFRASTRUCTURE_DIR }}' found — skipping infra YAML/YML checks." | |
| fi | |
| # ------------------------------- | |
| # Done | |
| # ------------------------------- | |
| - name: Finalize Check | |
| run: echo "All formatting checks completed successfully." |