test archive
This commit is contained in:
@@ -1,28 +1,85 @@
|
||||
name: CI
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches:
|
||||
- main
|
||||
- test
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
test-backend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
cd api
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Verify build
|
||||
run: |
|
||||
cd api
|
||||
python -c "from main import app"
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest -q
|
||||
cd api
|
||||
pytest tests/
|
||||
|
||||
# test-frontend:
|
||||
# needs: test-backend
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Set up Node.js
|
||||
# uses: actions/setup-node@v4
|
||||
# with:
|
||||
# node-version: '20'
|
||||
|
||||
# - name: Install dependencies
|
||||
# run: |
|
||||
# cd web
|
||||
# npm ci
|
||||
|
||||
# - name: Build frontend
|
||||
# run: |
|
||||
# cd web
|
||||
# npm run build
|
||||
|
||||
create-archives:
|
||||
needs: [test-backend, test-frontend]
|
||||
runs-on: ubuntu-latest
|
||||
if: success()
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create archives
|
||||
run: |
|
||||
# Создаём архивы с исключением ненужных файлов
|
||||
zip -r api.zip api/ -x "*.pyc" "*__pycache__*" "*.git*" "*.pytest_cache*"
|
||||
zip -r web.zip web/ -x "node_modules/*" ".git*" "dist/*" "*.log"
|
||||
|
||||
# Создаём общий архив
|
||||
zip -r full-build.zip api/ web/ -x "*/node_modules/*" "*__pycache__*" "*.pyc" "*.git*"
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: |
|
||||
api.zip
|
||||
web.zip
|
||||
full-build.zip
|
||||
retention-days: 30 # сколько дней хранить артефакты
|
||||
|
||||
Reference in New Issue
Block a user