mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
110 lines
3.7 KiB
YAML
110 lines
3.7 KiB
YAML
# This Evennia workflow will install Python dependencies, run tests with a variety of Python versions
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
|
|
name: Evennia test-suite and coveralls
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, develop ]
|
|
pull_request:
|
|
branches: [ master, develop ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
python-version: [3.7, 3.8]
|
|
TESTING_DB: ['sqlite3', 'postgresql', 'mysql']
|
|
fail-fast: False
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
- name: Set up PostgreSQL server
|
|
uses: harmon758/postgresql-action@v1
|
|
if: ${{ matrix.TESTING_DB == 'postgresql' }}
|
|
with:
|
|
postgresql version: '10.7'
|
|
postgresql user: 'postgres'
|
|
postgresql password: 'postgres'
|
|
- name: Set up MySQL server
|
|
uses: mirromutth/mysql-action@v1.1
|
|
if: ${{ matrix.TESTING_DB == 'mysql'}}
|
|
with:
|
|
mysql version: '8.0'
|
|
mysql root password: 'root'
|
|
|
|
# wait for db to activage, get logs from their start
|
|
- name: Wait / sleep
|
|
uses: jakejarvis/wait-action@v0.1.0
|
|
with:
|
|
time: '10s'
|
|
- name: Database container logs
|
|
# if: failure()
|
|
uses: jwalton/gh-docker-logs@v1.0.0
|
|
- name: Check running containers
|
|
run: docker ps -a
|
|
|
|
- name: Setup PostgreSQL database
|
|
if: ${{ matrix.TESTING_DB == 'postgresql' }}
|
|
run: |
|
|
psql --version
|
|
psql -U postgres -c "CREATE DATABASE evennia;"
|
|
psql -U postgres -c "CREATE USER evennia WITH PASSWORD 'password';"
|
|
psql -U postgres -c "ALTER USER evennia CREATEDB;"
|
|
- name: Setup MySQL database
|
|
if: ${{ matrix.TESTING_DB == 'mysql' }}
|
|
run: |
|
|
mysql --version
|
|
mysql -u root -proot -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
|
mysql -u root -proot -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';"
|
|
mysql -u root -proot -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';"
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install package dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install wheel
|
|
pip install psycopg2-binary
|
|
pip install mysqlclient
|
|
pip install coveralls
|
|
pip install -e .
|
|
|
|
- name: Install extra dependencies # Only develop branch right now
|
|
if: ${{ github.ref == 'refs/heads/develop' }}
|
|
run: pip install -r requirements_extra.txt
|
|
|
|
- name: Install and initialize evennia
|
|
run: |
|
|
evennia --init testing_mygame
|
|
cp .travis/${{ matrix.TESTING_DB }}_settings.py testing_mygame/server/conf/settings.py
|
|
cd testing_mygame
|
|
evennia migrate
|
|
evennia collectstatic --noinput
|
|
|
|
- name: Run test
|
|
run: |
|
|
echo `pwd`
|
|
echo `ls`
|
|
cd testing_mygame
|
|
coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia
|
|
|
|
# we only want to run coverall once, so we only do it for one of the matrix combinations
|
|
- name: Run coverall
|
|
if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }}
|
|
run: |
|
|
coveralls
|
|
coverage xml
|
|
|
|
- name: Report coverage to codacy
|
|
if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }}
|
|
uses: codacy/codacy-coverage-reporter-action@master
|
|
with:
|
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
coverage-reports: coverage.xml
|