Merge pull request #660 from MicroPyramid/sf_import #39
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: [master] | |
| paths: | |
| - 'backend/**' | |
| - 'frontend/**' | |
| - '.coveragerc' | |
| - '.github/workflows/tests.yml' | |
| pull_request: | |
| branches: [master] | |
| paths: | |
| - 'backend/**' | |
| - 'frontend/**' | |
| - '.coveragerc' | |
| - '.github/workflows/tests.yml' | |
| jobs: | |
| backend-tests: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: backend/requirements.txt | |
| - name: Install system dependencies (WeasyPrint) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libpango-1.0-0 \ | |
| libpangocairo-1.0-0 \ | |
| libgdk-pixbuf-2.0-0 \ | |
| libffi-dev \ | |
| shared-mime-info | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r backend/requirements.txt | |
| - name: Run tests with coverage | |
| working-directory: backend | |
| env: | |
| DJANGO_SETTINGS_MODULE: crm.test_settings | |
| SECRET_KEY: test-secret-key-for-ci | |
| ADMIN_EMAIL: admin@test.com | |
| run: | | |
| pytest -m "not postgres_only" --tb=short -v | |
| - name: Generate coverage badge | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| working-directory: backend | |
| run: | | |
| pip install "genbadge[coverage]" | |
| genbadge coverage -i coverage.xml -o ../coverage-badge.svg | |
| - name: Commit coverage badge | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add coverage-badge.svg || true | |
| git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]" | |
| git push || true | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: backend/htmlcov/ | |
| retention-days: 14 | |
| frontend-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Install dependencies | |
| working-directory: frontend | |
| run: pnpm install --frozen-lockfile | |
| - name: Prettier format check | |
| working-directory: frontend | |
| run: pnpm prettier --check . || echo "::warning::Prettier found formatting issues in $(pnpm prettier --check . 2>&1 | grep -c '^\[warn\]') files. Run 'pnpm format' to fix." | |
| - name: ESLint | |
| working-directory: frontend | |
| run: pnpm eslint . | |
| - name: Type check (svelte-check) | |
| working-directory: frontend | |
| run: pnpm check | |
| - name: Build | |
| working-directory: frontend | |
| run: pnpm build |