feat: настройка тестов + CI #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 | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install project with uv | |
| run: | | |
| uv pip install -r requirements-dev.txt --system | |
| - name: Ruff - check style | |
| run: ruff check . | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| services: | |
| docker: | |
| image: docker:24.0.5 | |
| options: --privileged | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Compose | |
| run: | | |
| docker compose version | |
| - name: Run tests with Docker Compose | |
| run: | | |
| docker compose -p taskflow_test -f docker-compose.test.yml --env-file .env.test up -d --build | |
| # Ждем завершения web-test | |
| docker wait taskflow_web_test | |
| # Получаем exit code тестов | |
| EXIT_CODE=$(docker inspect taskflow_web_test --format='{{.State.ExitCode}}') | |
| # Выключаем и удаляем все контейнеры и тома | |
| docker compose -f docker-compose.test.yml down --volumes --remove-orphans | |
| # Выходим с кодом тестов | |
| exit $EXIT_CODE |