101 lines
3.3 KiB
YAML
101 lines
3.3 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
description: 'Tag for registry'
|
|
type: string
|
|
default: latest
|
|
force_build:
|
|
type: boolean
|
|
description: force_build
|
|
default: false
|
|
|
|
jobs:
|
|
tests:
|
|
runs-on: gpu
|
|
env:
|
|
effective_tag: ${{ inputs.tag || github.head_ref || github.ref_name }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@master
|
|
|
|
- name: Login to Yandex Cloud
|
|
uses: yc-actions/yc-cr-login@v2
|
|
with:
|
|
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
|
|
|
|
- name: Send PRBot feedback
|
|
uses: imgurbot12/prbot@v2
|
|
with:
|
|
username: ${{ secrets.ACCOUNT_NAME }}
|
|
api_token: ${{ secrets.GITHUBTOKEN }}
|
|
|
|
- name: Prepare prbot_data directory
|
|
run: mkdir -p /home/runner/prbot_data && chmod -R 777 /home/runner/prbot_data
|
|
|
|
- name: Ruff format check (strict)
|
|
run: |
|
|
echo "Starting Ruff format check with tag: ${{ env.effective_tag }}"
|
|
|
|
docker run --rm \
|
|
-v /home/runner/prbot_data:/tmp \
|
|
cr.yandex/crp8vh46gd976oq8ipla/${{ github.event.repository.name }}:${{ env.effective_tag }} \
|
|
bash -c '
|
|
pip install ruff
|
|
cd /server
|
|
echo "=== Ruff format check ==="
|
|
ruff format . --check
|
|
' \
|
|
| tee /home/runner/prbot_data/full_output.txt | prbot
|
|
|
|
echo "=== Format Output ==="
|
|
cat /home/runner/prbot_data/full_output.txt
|
|
|
|
- name: Run Docker with output redirection
|
|
run: |
|
|
docker run --rm \
|
|
-v /home/runner/prbot_data:/tmp \
|
|
cr.yandex/crp8vh46gd976oq8ipla/${{ github.event.repository.name }}:${{ env.effective_tag }} \
|
|
bash -c '
|
|
pip install ruff pytest pytest-github-actions-annotate-failures
|
|
echo "=== Ruff ==="
|
|
cd /server && ruff check . | sed "s|/server/||g" || true
|
|
' \
|
|
| tee /home/runner/prbot_data/full_output.txt | prbot
|
|
|
|
echo "=== Full Output ==="
|
|
cat /home/runner/prbot_data/full_output.txt
|
|
|
|
- name: Pytest individual files + PRBot formatting
|
|
run: |
|
|
docker run --rm \
|
|
-v /home/runner/prbot_data:/tmp \
|
|
cr.yandex/crp8vh46gd976oq8ipla/${{ github.event.repository.name }}:${{ env.effective_tag }} \
|
|
bash -c '
|
|
pip install pytest pytest-github-actions-annotate-failures
|
|
|
|
cd /server
|
|
|
|
echo "=== Running Pytest Files Individually ==="
|
|
|
|
find . -name "test_*.py" | sort | while read -r test_file; do
|
|
echo "Starting Pytest for file: $test_file"
|
|
|
|
pytest -v -W always "$test_file" --capture=no --annotate-failures 2>&1 | tee -a /tmp/test_output.txt
|
|
|
|
echo "" >> /tmp/test_output.txt
|
|
done
|
|
|
|
echo "=== Formatting Output for PRBot ==="
|
|
> /tmp/prbot_output.txt
|
|
' \
|
|
| tee /home/runner/prbot_data/full_output.txt | prbot
|
|
|
|
echo " === Pytest raw output ==="
|
|
cat /home/runner/prbot_data/full_output.txt || echo "::warning::full_output.txt not found!"
|
|
|
|
- name: Commit PRBot feedback
|
|
if: always()
|
|
run: |
|
|
prbot commit |