Skip to content

fix: use actual inserted count in add images to album response #317

fix: use actual inserted count in add images to album response

fix: use actual inserted count in add images to album response #317

Workflow file for this run

name: PR Check
on:
pull_request:
branches:
- main
- dev
permissions:
contents: read
jobs:
linting:
runs-on: ubuntu-latest
name: Linting
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# MyPy compares the exact PR base and head commits below.
fetch-depth: 0
persist-credentials: false
- name: Markdown lint
uses: DavidAnson/markdownlint-cli2-action@v23
with:
config: .github/.markdownlint-cli2.jsonc
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Agent hook tests
run: node scripts/agent-format-hook.test.mjs
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Duplicate issue detector tests
run: |
cd .github/scripts/duplicate_detection
for test in tests/test_*.py; do
python -m "tests.$(basename "$test" .py)"
done
- name: Install frontend dependencies
run: |
cd frontend
npm ci --ignore-scripts
- name: Install backend lint dependencies
run: |
cd backend
pip install -r requirements-lint.txt
- name: Run Linters
env:
SKIP: mypy-backend,mypy-sync-microservice
run: |
cd frontend
npm run lint:check
npm run format:check
cd ..
cd backend
pre-commit run --config ../.pre-commit-config.yaml --all-files || exit 1
cd ..
cd frontend/src-tauri
cargo fmt -- --check
- name: Run MyPy on changed Python files
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if ! git rev-parse --verify --quiet "${BASE_SHA}^{commit}" > /dev/null || \
! git rev-parse --verify --quiet "${HEAD_SHA}^{commit}" > /dev/null; then
echo "Unable to resolve pull request commits for MyPy."
exit 1
fi
mapfile -t backend_files < <(
git diff --name-only --diff-filter=ACMR "$BASE_SHA...$HEAD_SHA" -- ':(glob)backend/**/*.py'
)
mapfile -t sync_files < <(
git diff --name-only --diff-filter=ACMR "$BASE_SHA...$HEAD_SHA" -- ':(glob)sync-microservice/**/*.py'
)
if (( ${#backend_files[@]} > 0 )); then
mypy --config-file backend/pyproject.toml "${backend_files[@]}"
fi
if (( ${#sync_files[@]} > 0 )); then
mypy --config-file sync-microservice/pyproject.toml "${sync_files[@]}"
fi
if (( ${#backend_files[@]} == 0 && ${#sync_files[@]} == 0 )); then
echo "No changed Python files to type check."
fi
# Frontend Test Job
frontend:
runs-on: ubuntu-latest
name: Frontend Tests
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Dependencies & Run Tests
run: |
cd frontend
npm install
npm test
# Backend Test Job
backend:
runs-on: ubuntu-latest
name: Backend Tests
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build check(Main backend)
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
- name: Build check(Sync Microservice)
run: |
cd sync-microservice
pip install -r requirements.txt
pyinstaller main.py --name PictoPy_Sync_Microservice --onedir --distpath dist
- name: Run Tests
run: |
cd backend
pytest