Implement updates for better performance #100
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 | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| code_quality: | |
| name: Code Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Python formatters | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install autoflake black==25.11.0 | |
| - name: Check Python Code Quality | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "=== Running autoflake check ===" | |
| autoflake --remove-all-unused-imports --remove-unused-variables --recursive --check . | |
| echo "=== Running black check ===" | |
| black . --check | |
| - name: Set up Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Global Formatters | |
| run: npm install -g prettier prettier-plugin-solidity | |
| - name: Run Global Prettier Check | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| NODE_GLOBAL=$(npm root -g) | |
| echo "=== Running Prettier check for all supported files ===" | |
| prettier --plugin="$NODE_GLOBAL/prettier-plugin-solidity/dist/index.js" \ | |
| --check "**/*.{js,jsx,ts,tsx,json,html,css,md,sol,yml,yaml}" | |
| - name: Quality checks complete | |
| run: echo "All formatting and quality checks passed." | |
| backend_tests: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| needs: code_quality | |
| env: | |
| BACKEND_DIR: code/backend | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| cache-dependency-path: code/backend/requirements.txt | |
| - name: Install backend dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| if [ -f "${BACKEND_DIR}/requirements.txt" ]; then | |
| python -m pip install -r "${BACKEND_DIR}/requirements.txt" | |
| fi | |
| python -m pip install pytest pytest-cov pytest-asyncio | |
| - name: Run backend test suite | |
| working-directory: ${{ env.BACKEND_DIR }} | |
| run: | | |
| set -euo pipefail | |
| pytest tests/ \ | |
| --tb=short \ | |
| --strict-markers \ | |
| -v \ | |
| --cov=. \ | |
| --cov-report=xml:coverage.xml | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-coverage-report | |
| path: ${{ env.BACKEND_DIR }}/coverage.xml | |
| retention-days: 30 |