Add new API endpoints for media retrieval by country and enhance configuration
Some checks failed
Test Suite / test (push) Has been cancelled
Some checks failed
Test Suite / test (push) Has been cancelled
- Introduced `/api/tmdb` and `/api/collection/missing-locations` endpoints to the backend for improved media management. - Added a new `get_media_by_country` function in the collection API to fetch media items based on country codes. - Updated configuration to allow overriding *arr base URLs via environment variables for better flexibility. - Enhanced frontend with a new `MissingLocations` component and integrated it into the routing structure. - Improved the `CollectionMap` component to handle country selection and display media items accordingly. - Added testing dependencies in `requirements.txt` and updated frontend configuration for testing support.
This commit is contained in:
97
.gitea/workflows/test.yml
Normal file
97
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,97 @@
|
||||
name: Test Suite
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master, develop ]
|
||||
pull_request:
|
||||
branches: [ main, master, develop ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Nix
|
||||
uses: cachix/install-nix-action@v20
|
||||
with:
|
||||
nix: 2.18.1
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
|
||||
- name: Install Nix dependencies
|
||||
run: |
|
||||
nix profile install nixpkgs#postgresql
|
||||
nix profile install nixpkgs#python3
|
||||
nix profile install nixpkgs#nodejs_20
|
||||
nix profile install nixpkgs#npm
|
||||
|
||||
- name: Setup Python
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip
|
||||
pip install -r backend/requirements.txt
|
||||
|
||||
- name: Setup Node.js
|
||||
run: |
|
||||
cd frontend
|
||||
npm ci
|
||||
|
||||
- name: Start PostgreSQL
|
||||
run: |
|
||||
sudo systemctl start postgresql || sudo service postgresql start
|
||||
sudo -u postgres psql -c "CREATE DATABASE moviemap_test;"
|
||||
sudo -u postgres psql -c "CREATE USER moviemap WITH PASSWORD 'test';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE moviemap_test TO moviemap;"
|
||||
sudo -u postgres psql -c "ALTER USER moviemap CREATEDB;"
|
||||
env:
|
||||
POSTGRES_HOST: localhost
|
||||
POSTGRES_PORT: 5432
|
||||
|
||||
- name: Run database migrations
|
||||
run: |
|
||||
cd backend
|
||||
export POSTGRES_SOCKET_PATH=/var/run/postgresql
|
||||
export POSTGRES_DB=moviemap_test
|
||||
export POSTGRES_USER=moviemap
|
||||
alembic upgrade head
|
||||
env:
|
||||
TEST_POSTGRES_DB: moviemap_test
|
||||
TEST_POSTGRES_USER: moviemap
|
||||
TEST_POSTGRES_SOCKET_PATH: /var/run/postgresql
|
||||
|
||||
- name: Run backend tests
|
||||
run: |
|
||||
cd backend
|
||||
export POSTGRES_SOCKET_PATH=/var/run/postgresql
|
||||
export POSTGRES_DB=moviemap_test
|
||||
export POSTGRES_USER=moviemap
|
||||
export TEST_POSTGRES_DB=moviemap_test
|
||||
export TEST_POSTGRES_USER=moviemap
|
||||
export TEST_POSTGRES_SOCKET_PATH=/var/run/postgresql
|
||||
pytest tests/ -v --cov=app --cov-report=term-missing
|
||||
env:
|
||||
# Mock *arr URLs for testing (tests will mock the actual API calls)
|
||||
RADARR_URL: http://localhost:7878
|
||||
SONARR_URL: http://localhost:8989
|
||||
LIDARR_URL: http://localhost:8686
|
||||
RADARR_API_KEY: test-key
|
||||
SONARR_API_KEY: test-key
|
||||
LIDARR_API_KEY: test-key
|
||||
|
||||
- name: Build frontend
|
||||
run: |
|
||||
cd frontend
|
||||
npm run build
|
||||
|
||||
- name: Run frontend tests
|
||||
run: |
|
||||
cd frontend
|
||||
npm test -- --run
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
sudo systemctl stop postgresql || sudo service postgresql stop || true
|
||||
|
||||
Reference in New Issue
Block a user