Some asgi and tests changes #377
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyTest | |
on: | |
pull_request: | |
types: [opened] | |
push: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
database: ["mariadb", "sqlite", "mysql"] | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Install dependencies | |
run: poetry install --no-interaction | |
- name: Shutdown Ubuntu MySQL | |
if: matrix.database == 'mariadb' || matrix.database == 'mysql' | |
run: sudo service mysql stop | |
- uses: getong/mariadb-action@v1.1 | |
if: matrix.database == 'mariadb' | |
with: | |
mariadb version: '10.6.4' | |
mysql database: 'yepcord_test' | |
mysql root password: 'yepcord_test' | |
- uses: mirromutth/mysql-action@v1.1 | |
if: matrix.database == 'mysql' | |
with: | |
mariadb version: '5.7' | |
mysql database: 'yepcord_test' | |
mysql root password: 'yepcord_test' | |
- name: Wait for MariaDB/MySQL | |
if: matrix.database == 'mariadb' || matrix.database == 'mysql' | |
run: | | |
while ! mysqladmin ping --host=127.0.0.1 --password=yepcord_test --silent; do | |
sleep 1 | |
done | |
- name: Setup database | |
run: | | |
poetry run python app.py migrate | |
env: | |
YEPCORD_CONFIG: .github/settings_test.py | |
DB_TYPE: ${{ matrix.database }} | |
KEY: ${{ secrets.KEY }} | |
- name: Run test suite for core | |
run: | | |
poetry run pytest -x --cov-report=xml --cov-append --cov=yepcord/yepcord --disable-warnings tests/test_core.py | |
env: | |
DB_TYPE: ${{ matrix.database }} | |
KEY: ${{ secrets.KEY }} | |
YEPCORD_CONFIG: .github/settings_test.py | |
- name: Run test suite for http api | |
run: | | |
poetry run pytest -x --cov-report=xml --cov-append --cov=yepcord/rest_api --cov=yepcord/yepcord --cov=yepcord/remote_auth --disable-warnings tests/api/ | |
env: | |
DB_TYPE: ${{ matrix.database }} | |
KEY: ${{ secrets.KEY }} | |
TENOR_KEY: ${{ secrets.TENOR_KEY }} | |
YEPCORD_CONFIG: .github/settings_test.py | |
- name: Run test suite for cdn/storage | |
run: | | |
mkdir -p tests/files/yepcord-test | |
poetry run pytest -x --cov-report=xml --cov-append --cov=yepcord/cdn --cov=yepcord/yepcord --cov-config=.coveragerc --disable-warnings tests/cdn/ | |
env: | |
DB_TYPE: ${{ matrix.database }} | |
KEY: ${{ secrets.KEY }} | |
YEPCORD_CONFIG: .github/settings_test.py | |
- name: Print coverage report | |
run: | | |
poetry run coverage report | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |