Skip to content

Commit

Permalink
Merge pull request #342 from zurdi15/master
Browse files Browse the repository at this point in the history
v1.10
  • Loading branch information
zurdi15 authored Aug 15, 2023
2 parents 7306597 + e977cdd commit 19b3dd6
Show file tree
Hide file tree
Showing 111 changed files with 195,797 additions and 1,449 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/tests/cassettes/*.yaml linguist-generated
File renamed without changes.
69 changes: 69 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: run pytest

on:
pull_request:
types:
- "opened"
- "synchronize"
paths-ignore:
- "docker/**"
- "examples/*"
- "frontend/**"
push:
branches:
- "master"
paths-ignore:
- "docker/**"
- "examples/*"
- "frontend/**"

jobs:
pytest:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
services:
mariadb:
image: mariadb:10.11
ports:
- 3306
env:
MYSQL_USER: romm_test
MYSQL_PASSWORD: passwd
MYSQL_DATABASE: romm_test
MYSQL_ROOT_PASSWORD: passwd
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install mariadb connectors
run: |
sudo apt-get update
sudo apt-get install -y libmariadb3 libmariadb-dev
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies
run: |
poetry install --sync
- name: Initiate database
run: |
mysql --host 127.0.0.1 --port ${{ job.services.mariadb.ports['3306'] }} -uroot -ppasswd -e "GRANT ALL PRIVILEGES ON romm_test.* TO 'romm_test'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;"
- name: Run python tests
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mariadb.ports['3306'] }}
run: |
cd backend
poetry run pytest -vv --maxfail=10 --junitxml=pytest-report.xml .
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
files: |
backend/pytest-report.xml
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ coverage
# Editor directories and files
.vscode
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/tasks.json
.idea
*.suo
*.ntvs*
Expand All @@ -42,3 +44,11 @@ romm_mock

# virtualenv
.venv

# testing
backend/romm_test/resources
backend/romm_test/logs
.pytest_cache

# service worker
frontend/dev-dist
52 changes: 52 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev",
"path": "frontend",
"problemMatcher": [],
"label": "Launch frontend [npm]"
},
{
"type": "shell",
"command": "source ~/.cache/pypoetry/virtualenvs/romm-TjwgbYlf-py3.11/bin/activate; cd backend; python main.py",
"label": "Launch backend [python]",
"problemMatcher": []
},
{
"type": "shell",
"command": "source ~/.cache/pypoetry/virtualenvs/romm-TjwgbYlf-py3.11/bin/activate; cd backend; pytest -v",
"label": "Execute tests [pytest]",
"problemMatcher": []
},
{
"type": "shell",
"command": "./docker/build_local_image.sh",
"label": "Build docker local image [docker]",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"command": "docker compose up -d",
"label": "Setup development environment [docker] (1)",
"problemMatcher": []
},
{
"type": "shell",
"command": "export $(cat .env | xargs); docker exec -i mariadb mariadb -u root -p$DB_ROOT_PASSWD < backend/romm_test/setup.sql",
"label": "Setup development environment migrations [docker] (2)",
"problemMatcher": []
},
{
"type": "shell",
"command": "cd romm_mock; docker compose up -d",
"label": "Setup testing environment [docker]",
"problemMatcher": []
}
]
}
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# v1.10 (_xx-08-2023_)

## Added
- Rom admin menu added to roms in gallery. Closes [#28](https://github.com/zurdi15/romm/issues/28)
- Added ps2/opl naming convention support for roms scanning. Closes [#324](https://github.com/zurdi15/romm/issues/324)

## Fixed
- Fixed an error caused by the service worker that sometimes intercepts download requests and returns a bad response. Fixes [#297](https://github.com/zurdi15/romm/issues/297)
- Fixed rom count in platform selector when deleting/scanning roms. Fixes [#325](https://github.com/zurdi15/romm/issues/325)

## Changed
- Improved scanning and IGDB requests logs. Fixes [#317](https://github.com/zurdi15/romm/issues/317)
- Improved downloading process. Fixes [#332](https://github.com/zurdi15/romm/issues/332)



**_Note_**: Experimental support for redis in the backend was added for anyone that wants to test it (it's experimental so expect some bugs). It's not required yet (check docker-compose.example.yml to check how to set the needed environment variables) but it will likely be introduced in 2.0.

<br>

# v1.9.1 (_01-08-2023_)

## Added
Expand Down
54 changes: 42 additions & 12 deletions DEVELOPER-SETUP.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Create the mock structure with at least one rom
# Environment setup

## Mocking RomM structure

### - Create the mock structure with at least one rom and empty config for manual testing

```sh
mkdir -p romm_mock/library/roms/switch
Expand All @@ -9,13 +13,13 @@ touch romm_mock/config.yml

## Setting up the backend

### Copy env.template to .env and fill the variables
### - Copy env.template to .env and fill the variables

```sh
cp env.template .env
```

### Install python dependencies
### - Install python dependencies

You'll need poetry installed

Expand All @@ -26,47 +30,73 @@ Then initialize the virtual environment and install the dependencies
```sh
poetry shell
# Fix disable parallel installation stuck: $> poetry config experimental.new-installer false
# Fix Loading macOS stuck: $> export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
# Fix Loading macOS/linux stuck: $> export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
# Fix mariadb install on linux: $> sudo apt install libmariadb3 libmariadb-dev
# Fix mariadb connector/c >= 3.3.1: https://mariadb.com/docs/skysql-previous-release/connect/programming-languages/c/install/#Installation_via_Package_Repository_(Linux)
poetry install
```

### Spin up mariadb in docker
### - Spin up mariadb in docker

```sh
docker-compose up -d
```

### Run the migrations
### - Run the backend

*__*Migrations will be run automatically when running the backend.__*

```sh
cd backend
alembic upgrade head
python main.py
```

## And finally run the backend

### - Start a worker

```sh
python main.py
cd backend
python worker.py
```

## Setting up the frontend

### Install node.js dependencies
### - Install node.js dependencies

```sh
cd frontend
# npm version >= 9 needed
npm install
```

### Create symlink to library and resources
### - Create symlink to library and resources
```sh
mkdir assets/romm
ln -s ../../../romm_mock/library assets/romm/library
ln -s ../../../romm_mock/resources assets/romm/resources
```

### Run the frontend
### - Run the frontend

```sh
npm run dev
```

# Test setup

### - Create the test user and database with root user

```sh
docker exec -i mariadb mysql -u root -p<root password> < backend/romm_test/setup.sql # for amd images
docker exec -i mariadb mariadb -u root -p<root password> < backend/romm_test/setup.sql # for arm images
```

### - Run tests

*__*Migrations will be run automatically when running the tests.__*

```sh
cd backend
# path or test file can be passed as argument to test only a subset
pytest [path/file]
```
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1 style="padding:20px;"><img src="romm.svg" height="220px" width="auto" alt="RomM Logo"></h1>
<img alt="GitHub" src="https://img.shields.io/github/license/zurdi15/romm?style=flat-square">
<img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/zurdi15/romm?style=flat-square">
<img alt="GitHub Workflow Status (with branch)" src="https://img.shields.io/github/actions/workflow/status/zurdi15/romm/image.yml?style=flat-square&branch=master">
<img alt="GitHub Workflow Status (with branch)" src="https://img.shields.io/github/actions/workflow/status/zurdi15/romm/build.yml?style=flat-square&branch=master">
<br>
<a href="https://hub.docker.com/r/zurdi15/romm">
<img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/zurdi15/romm?style=flat-square">
Expand Down Expand Up @@ -67,6 +67,10 @@ Inspired by [Jellyfin](https://jellyfin.org/), allows you to manage all your gam
</details>
<br>

# The RomM community
[Wiki](https://github.com/zurdi15/romm/wiki) <br/>
[Discord](https://discord.gg/P5HtHnhUDH)<br/>

# Installation

## 🐳 Docker
Expand Down Expand Up @@ -149,7 +153,7 @@ Check the [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/examp
<h2 id="platform-support">🎮 Platform support</h2>

If the RomM [folder structure](#📁-folder-structure) is followed, any kind of platform/folder-name is supported for the core features. For having extra metadata as well as cover images and platforms icons, the following table shows how to name your platforms folders.
This will change over the time, adding games metadata for more platforms. Make sure that the platforms folder names are lowercase.
This will change over the time, adding games metadata for more platforms.

<br>
<details>
Expand Down
6 changes: 2 additions & 4 deletions backend/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from config.config_loader import ConfigLoader
from alembic import context
from models.base import BaseModel

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand All @@ -13,14 +14,11 @@
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)
fileConfig(config.config_file_name, disable_existing_loggers=False)

# add your model's MetaData object here
# for 'autogenerate' support
sys.path.append(f"{Path(__file__).parent.parent.resolve()}")
from models.base import BaseModel
from models.platform import Platform
from models.rom import Rom

target_metadata = BaseModel.metadata

Expand Down
Loading

0 comments on commit 19b3dd6

Please sign in to comment.