fix import error #18
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/CD Pipeline | |
| on: | |
| push: | |
| branches: ["master", "main"] | |
| pull_request: | |
| branches: ["master", "main"] | |
| jobs: | |
| lint-backend: | |
| name: Lint Backend | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 isort | |
| - name: Run isort check | |
| run: isort --check-only --diff app/ tests/ | |
| - name: Run flake8 | |
| run: flake8 app/ tests/ | |
| lint-frontend: | |
| name: Lint Frontend | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./frontend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: ./frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run lint | |
| run: npm run lint | |
| test-backend: | |
| name: Run Backend Tests | |
| runs-on: ubuntu-latest | |
| needs: lint-backend | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests with coverage | |
| run: | | |
| pytest tests/ -v --cov=app --cov-report=xml --cov-report=term-missing --cov-fail-under=100 | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./backend/coverage.xml | |
| fail_ci_if_error: false | |
| build: | |
| name: Build Docker Images | |
| runs-on: ubuntu-latest | |
| needs: [test-backend, lint-frontend] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| run: | | |
| docker compose build |