From 93e9cd0a1778f3be1fe5c351d16b5d0b0f124620 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 22:28:27 +0200 Subject: [PATCH 01/47] Create pythonpackage.yml Test with github actions. --- .github/workflows/pythonpackage.yml | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/pythonpackage.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 0000000000..487387d870 --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,62 @@ +# 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 + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + TESTING_DB: [sqlite3, postgresql, mysql] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Set up databases + 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;" + mysql --version + mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" + mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install psycopg2-binary + pip install mysqlclient + pip install coveralls + pip install codacy-coverage + pip install -e . + pip install -r requirements_extra.txt + - name: Set up 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: | + coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia + coveralls: + steps: + - name: upload to coveralls + run: | + coveralls + coverage xml + python-codacy-coveraage -r coverage.xml From 2616bd5ab5c6cfb4519abec82dd26eb6ca87bdd8 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 22:30:10 +0200 Subject: [PATCH 02/47] Update pythonpackage.yml --- .github/workflows/pythonpackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 487387d870..635199e8fc 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -54,6 +54,7 @@ jobs: run: | coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia coveralls: + runs-on: ubuntu-latest steps: - name: upload to coveralls run: | From 24b103b7e02c4784e930d86267f8ee81434569a5 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 22:36:47 +0200 Subject: [PATCH 03/47] Test setting up databases for github actions --- .github/workflows/pythonpackage.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 635199e8fc..cb6adf646d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -1,7 +1,7 @@ # 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 +name: Evennia test-suite and coveralls on: push: @@ -17,6 +17,16 @@ jobs: matrix: python-version: [3.5, 3.6, 3.7, 3.8] TESTING_DB: [sqlite3, postgresql, mysql] + services: + postgres: + image: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + mysql: + image: mysql steps: - uses: actions/checkout@v2 From 3f96246cd59f34c9fa2b3918b1ee9415d6d70f4b Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 22:44:32 +0200 Subject: [PATCH 04/47] Test to use custom actions for db installs --- .github/workflows/pythonpackage.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index cb6adf646d..bdd586b0f7 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,20 +16,13 @@ jobs: strategy: matrix: python-version: [3.5, 3.6, 3.7, 3.8] - TESTING_DB: [sqlite3, postgresql, mysql] - services: - postgres: - image: postgres - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - mysql: - image: mysql - + TESTING_DB: [sqlite3, postgresql, mysql] steps: - uses: actions/checkout@v2 + - name: Setup MySQL + uses: mirrmutth/mysql-qction@1.1 + - name: Setup PosgrSQL + uses: Harmon758/postgresql-action@v1.0.0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: From 1da71593e686efeb8c1c0cfee6daada596183520 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 22:47:59 +0200 Subject: [PATCH 05/47] Further corrections. Typo fix --- .github/workflows/pythonpackage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index bdd586b0f7..be89721136 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,12 +15,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.7, 3.8] TESTING_DB: [sqlite3, postgresql, mysql] steps: - uses: actions/checkout@v2 - name: Setup MySQL - uses: mirrmutth/mysql-qction@1.1 + uses: mirromutth/mysql-action@1.1 - name: Setup PosgrSQL uses: Harmon758/postgresql-action@v1.0.0 - name: Set up Python ${{ matrix.python-version }} From f8ce8f5476a33fa20e8ed5b8b4c1f37605aead0a Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 23:01:20 +0200 Subject: [PATCH 06/47] Another test with db actions --- .github/workflows/pythonpackage.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index be89721136..429d18640b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -18,11 +18,7 @@ jobs: python-version: [3.7, 3.8] TESTING_DB: [sqlite3, postgresql, mysql] steps: - - uses: actions/checkout@v2 - - name: Setup MySQL - uses: mirromutth/mysql-action@1.1 - - name: Setup PosgrSQL - uses: Harmon758/postgresql-action@v1.0.0 + - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -41,9 +37,7 @@ jobs: run: | python -m pip install --upgrade pip pip install psycopg2-binary - pip install mysqlclient - pip install coveralls - pip install codacy-coverage + pip install mysqlclient pip install -e . pip install -r requirements_extra.txt - name: Set up evennia @@ -59,8 +53,14 @@ jobs: coveralls: runs-on: ubuntu-latest steps: - - name: upload to coveralls + - uses: actions/checkout@v2 + - name: install coveralls + run: | + python -m pip install --upgrade pip + pip install coveralls + pip install codacy-coverage + - name: run and upload to coveralls run: | coveralls coverage xml - python-codacy-coveraage -r coverage.xml + python-codacy-coverage -r coverage.xml From d84c06b0b1810cc431d4afdc3ee051326b026014 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 23:07:46 +0200 Subject: [PATCH 07/47] Try postgresql service --- .github/workflows/pythonpackage.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 429d18640b..14f91162cd 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,21 @@ jobs: strategy: matrix: python-version: [3.7, 3.8] - TESTING_DB: [sqlite3, postgresql, mysql] + TESTING_DB: [sqlite3, postgresql, mysql] + services: + # Label used to access the service container + postgres: + # Docker Hub image + image: postgres + # Provide the password for postgres + env: + POSTGRES_PASSWORD: postgres + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} From 10dae4cefa3f99ad1685fbc374e778a50d1c3801 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 16 May 2020 23:26:16 +0200 Subject: [PATCH 08/47] Update pythonpackage.yml --- .github/workflows/pythonpackage.yml | 34 +++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 14f91162cd..76ab002e4c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -10,40 +10,31 @@ on: branches: [ master, develop ] jobs: - build: - + build: runs-on: ubuntu-latest strategy: matrix: python-version: [3.7, 3.8] - TESTING_DB: [sqlite3, postgresql, mysql] - services: - # Label used to access the service container - postgres: - # Docker Hub image - image: postgres - # Provide the password for postgres - env: - POSTGRES_PASSWORD: postgres - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 + TESTING_DB: [sqlite3, postgresql, mysql] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Set up databases - run: | + - name: Set up postgreSQL database + if: ${{ matrix.TESTING_DB }} == 'postgresql' + run: | psql --version + sudo service postgresql start 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: Set up MySQL database + if: ${{ matrix.TESTING_DB }} == 'mysql' + run: | mysql --version + sudo service mysql start mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" @@ -64,10 +55,15 @@ jobs: - name: run test run: | coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia + coveralls: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 - name: install coveralls run: | python -m pip install --upgrade pip From 9c85ba2ffba2f55d2f3cac1d0f4cfd9994937b38 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:08:13 +0200 Subject: [PATCH 09/47] Further tweaks to githubaction setup --- .github/workflows/pythonpackage.yml | 39 +++++++++++++---------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 76ab002e4c..84d97e8cc8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -23,7 +23,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Set up postgreSQL database - if: ${{ matrix.TESTING_DB }} == 'postgresql' + if: ${{ matrix.TESTING_DB == 'postgresql' }} + uses: harmon758/postgresql-action@v1 + with: + postgresql version: '11' run: | psql --version sudo service postgresql start @@ -31,7 +34,10 @@ jobs: psql -U postgres -c "CREATE USER evennia WITH PASSWORD 'password';" psql -U postgres -c "ALTER USER evennia CREATEDB;" - name: Set up MySQL database - if: ${{ matrix.TESTING_DB }} == 'mysql' + if: ${{ matrix.TESTING_DB == 'mysql' }} + uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '8.0' run: | mysql --version sudo service mysql start @@ -42,7 +48,9 @@ jobs: run: | python -m pip install --upgrade pip pip install psycopg2-binary - pip install mysqlclient + pip install mysqlclient + pip install coveralls + pip install codacy-coverage pip install -e . pip install -r requirements_extra.txt - name: Set up evennia @@ -55,22 +63,9 @@ jobs: - name: run test run: | coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia - - coveralls: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: install coveralls - run: | - python -m pip install --upgrade pip - pip install coveralls - pip install codacy-coverage - - name: run and upload to coveralls - run: | - coveralls - coverage xml - python-codacy-coverage -r coverage.xml + - name: run coverall + if: ${{ matrix.TESTING_DB == 'sqlite3' && matix.python-version == 3.7 }} + run: | + coveralls + coverage xml + python-codacy-coverage -r coverage.xml From 60d36d309b2a2052d00f48d54a59799ffa52aa2e Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:13:38 +0200 Subject: [PATCH 10/47] Try again with syntax fixes --- .github/workflows/pythonpackage.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 84d97e8cc8..f27f0c59dc 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,34 +16,41 @@ jobs: matrix: python-version: [3.7, 3.8] TESTING_DB: [sqlite3, postgresql, mysql] - steps: + steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Set up postgreSQL database + + - name: Start postgreSQL server if: ${{ matrix.TESTING_DB == 'postgresql' }} uses: harmon758/postgresql-action@v1 with: postgresql version: '11' + - name: Setup PostgreSQL database + if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | psql --version sudo service postgresql start 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: Set up MySQL database + + - name: Start MySQL server if: ${{ matrix.TESTING_DB == 'mysql' }} uses: mirromutth/mysql-action@v1.1 with: mysql version: '8.0' + - name: Setup MySQL database + if: ${{ matrix.TESTING_DB == 'mysql' }} run: | mysql --version sudo service mysql start mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" + - name: Install dependencies run: | python -m pip install --upgrade pip From 771556890e7f24246d89f6a456e7ce4bc355f580 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:15:41 +0200 Subject: [PATCH 11/47] Update pythonpackage.yml --- .github/workflows/pythonpackage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index f27f0c59dc..8f7b2c55bb 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -70,8 +70,10 @@ jobs: - name: run test run: | 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' && matix.python-version == 3.7 }} + if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} run: | coveralls coverage xml From a30432f6b529ce9bcc3ec9deb75e9ea11d96bca7 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:27:25 +0200 Subject: [PATCH 12/47] Another try with different mysql settings --- .github/workflows/pythonpackage.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 8f7b2c55bb..e16ea3b23f 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,7 +27,7 @@ jobs: if: ${{ matrix.TESTING_DB == 'postgresql' }} uses: harmon758/postgresql-action@v1 with: - postgresql version: '11' + postgresql version: '10.7' - name: Setup PostgreSQL database if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | @@ -42,6 +42,8 @@ jobs: uses: mirromutth/mysql-action@v1.1 with: mysql version: '8.0' + mysql_user: root + mysql_password: root - name: Setup MySQL database if: ${{ matrix.TESTING_DB == 'mysql' }} run: | @@ -54,6 +56,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install wheel pip install psycopg2-binary pip install mysqlclient pip install coveralls From a00531e138abc044a97d850b5e77fa3f24d19d31 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:37:27 +0200 Subject: [PATCH 13/47] Update pythonpackage.yml --- .github/workflows/pythonpackage.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e16ea3b23f..655b5e3cce 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -31,8 +31,7 @@ jobs: - name: Setup PostgreSQL database if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | - psql --version - sudo service postgresql start + psql --versiont 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;" @@ -41,14 +40,12 @@ jobs: if: ${{ matrix.TESTING_DB == 'mysql' }} uses: mirromutth/mysql-action@v1.1 with: - mysql version: '8.0' - mysql_user: root - mysql_password: root + mysql version: '8.0' + mysql root password: 'root' - name: Setup MySQL database if: ${{ matrix.TESTING_DB == 'mysql' }} run: | - mysql --version - sudo service mysql start + mysql --version mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" From 015e3e52c308ecb472cc859f3ba04e875a64b0c3 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:40:07 +0200 Subject: [PATCH 14/47] Update pythonpackage.yml --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 655b5e3cce..9f33e76433 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -31,7 +31,7 @@ jobs: - name: Setup PostgreSQL database if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | - psql --versiont + 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;" From 2faa71b093d7f49eb6451445e6af8a0a9ddaf9ce Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:49:21 +0200 Subject: [PATCH 15/47] Update pythonpackage.yml --- .github/workflows/pythonpackage.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9f33e76433..3f511d9732 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -17,31 +17,27 @@ jobs: python-version: [3.7, 3.8] TESTING_DB: [sqlite3, postgresql, mysql] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + - uses: harmon758/postgresql-action@v1 + with: + postgresql version: '10.7' + postgresql db: postgres + - uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '8.0' + mysql root password: 'root' - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - - name: Start postgreSQL server - if: ${{ matrix.TESTING_DB == 'postgresql' }} - uses: harmon758/postgresql-action@v1 - with: - postgresql version: '10.7' + - 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: Start MySQL server - if: ${{ matrix.TESTING_DB == 'mysql' }} - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: '8.0' - mysql root password: 'root' + psql -U postgres -c "ALTER USER evennia CREATEDB;" - name: Setup MySQL database if: ${{ matrix.TESTING_DB == 'mysql' }} run: | From c13f53397e75d22d523f36ac979f3b69170a4899 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 00:51:18 +0200 Subject: [PATCH 16/47] Stop github-action experiment for now --- .github/workflows/pythonpackage.yml | 76 ----------------------------- 1 file changed, 76 deletions(-) delete mode 100644 .github/workflows/pythonpackage.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml deleted file mode 100644 index 3f511d9732..0000000000 --- a/.github/workflows/pythonpackage.yml +++ /dev/null @@ -1,76 +0,0 @@ -# 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] - steps: - - uses: actions/checkout@v2 - - uses: harmon758/postgresql-action@v1 - with: - postgresql version: '10.7' - postgresql db: postgres - - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: '8.0' - mysql root password: 'root' - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - 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 -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" - mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install wheel - pip install psycopg2-binary - pip install mysqlclient - pip install coveralls - pip install codacy-coverage - pip install -e . - pip install -r requirements_extra.txt - - name: Set up 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: | - 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 - python-codacy-coverage -r coverage.xml From 7efe1082bc67686574f20013a1fc427c7a1abd23 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 10:55:13 +0200 Subject: [PATCH 17/47] Revert "Stop github-action experiment for now" This reverts commit c13f53397e75d22d523f36ac979f3b69170a4899. --- .github/workflows/pythonpackage.yml | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/pythonpackage.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 0000000000..3f511d9732 --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,76 @@ +# 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] + steps: + - uses: actions/checkout@v2 + - uses: harmon758/postgresql-action@v1 + with: + postgresql version: '10.7' + postgresql db: postgres + - uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '8.0' + mysql root password: 'root' + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - 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 -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" + mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install wheel + pip install psycopg2-binary + pip install mysqlclient + pip install coveralls + pip install codacy-coverage + pip install -e . + pip install -r requirements_extra.txt + - name: Set up 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: | + 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 + python-codacy-coverage -r coverage.xml From 6e212e04e8af27b7c8ff8125ef01af92e67017a6 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 11:09:37 +0200 Subject: [PATCH 18/47] Test with some new variations of github action --- .github/workflows/pythonpackage.yml | 35 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3f511d9732..4262c706a8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -12,25 +12,35 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: matrix: python-version: [3.7, 3.8] - TESTING_DB: [sqlite3, postgresql, mysql] + TESTING_DB: ['sqlite3', 'postgresql', 'mysql'] + steps: - uses: actions/checkout@v2 + - uses: harmon758/postgresql-action@v1 + if: ${{ TESTING_DB == 'mysql' }} with: postgresql version: '10.7' - postgresql db: postgres - uses: mirromutth/mysql-action@v1.1 + if: ${{ TESTING_DB == 'postgresql'}} with: mysql version: '8.0' mysql root password: 'root' - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + + # wait for db to activage, get logs from their start + - name: Wait / sleep + uses: jakejarvis/wait-action@v0.1.0 with: - python-version: ${{ matrix.python-version }} - + time: '10s' + - name: + uses: kwalton/gh-docker-logs@v1.0.0 + - name: Check running containers + run: docker ps -a + - name: Setup PostgreSQL database if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | @@ -45,8 +55,13 @@ jobs: mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" - - - name: Install dependencies + + - 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 @@ -56,13 +71,15 @@ jobs: pip install codacy-coverage pip install -e . pip install -r requirements_extra.txt - - name: Set up evennia + + - 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: | coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia From d99ee42210dfedc705dfbc6895fdf9d2361003ce Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 11:10:53 +0200 Subject: [PATCH 19/47] Need to add the matrix --- .github/workflows/pythonpackage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4262c706a8..cb5290c613 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -22,11 +22,11 @@ jobs: - uses: actions/checkout@v2 - uses: harmon758/postgresql-action@v1 - if: ${{ TESTING_DB == 'mysql' }} + if: ${{ matrix.TESTING_DB == 'mysql' }} with: postgresql version: '10.7' - uses: mirromutth/mysql-action@v1.1 - if: ${{ TESTING_DB == 'postgresql'}} + if: ${{ matrix.TESTING_DB == 'postgresql'}} with: mysql version: '8.0' mysql root password: 'root' From 83f7178e182f92d5e1a7e9f1e137e4d70a78965f Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 11:14:40 +0200 Subject: [PATCH 20/47] Correct action repo name, try fail-fast False --- .github/workflows/pythonpackage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index cb5290c613..15ee86151c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -17,6 +17,7 @@ jobs: matrix: python-version: [3.7, 3.8] TESTING_DB: ['sqlite3', 'postgresql', 'mysql'] + fail-fast: False steps: - uses: actions/checkout@v2 @@ -37,7 +38,8 @@ jobs: with: time: '10s' - name: - uses: kwalton/gh-docker-logs@v1.0.0 + if: failure() + uses: jwalton/gh-docker-logs@v1.0.0 - name: Check running containers run: docker ps -a From 0cf26f27fa240485367ab6413819597b04a7e13e Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 11:29:01 +0200 Subject: [PATCH 21/47] Fix conditionals --- .github/workflows/pythonpackage.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 15ee86151c..9bb1bb99b3 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -23,11 +23,11 @@ jobs: - uses: actions/checkout@v2 - uses: harmon758/postgresql-action@v1 - if: ${{ matrix.TESTING_DB == 'mysql' }} + if: ${{ matrix.TESTING_DB == 'postgresql' }} with: postgresql version: '10.7' - uses: mirromutth/mysql-action@v1.1 - if: ${{ matrix.TESTING_DB == 'postgresql'}} + if: ${{ matrix.TESTING_DB == 'mysql'}} with: mysql version: '8.0' mysql root password: 'root' @@ -44,7 +44,7 @@ jobs: run: docker ps -a - name: Setup PostgreSQL database - if: ${{ matrix.TESTING_DB == 'postgresql' }} + if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | psql --version psql -U postgres -c "CREATE DATABASE evennia;" @@ -72,7 +72,10 @@ jobs: pip install coveralls pip install codacy-coverage pip install -e . - pip install -r requirements_extra.txt + + - 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: | From ffafda283b85d3b65abb1fd3099c8aebeac2583e Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 11:52:09 +0200 Subject: [PATCH 22/47] Further testing --- .github/workflows/pythonpackage.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9bb1bb99b3..99817aa028 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -26,6 +26,7 @@ jobs: if: ${{ matrix.TESTING_DB == 'postgresql' }} with: postgresql version: '10.7' + postgresql user: 'postgres' - uses: mirromutth/mysql-action@v1.1 if: ${{ matrix.TESTING_DB == 'mysql'}} with: @@ -38,7 +39,7 @@ jobs: with: time: '10s' - name: - if: failure() + # if: failure() uses: jwalton/gh-docker-logs@v1.0.0 - name: Check running containers run: docker ps -a @@ -47,16 +48,16 @@ jobs: 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;" + psql -U postgres -w -c "CREATE DATABASE evennia;" + psql -U postgres -w -c "CREATE USER evennia WITH PASSWORD 'password';" + psql -U postgres -w -c "ALTER USER evennia CREATEDB;" - name: Setup MySQL database if: ${{ matrix.TESTING_DB == 'mysql' }} run: | mysql --version - mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" - mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" + 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 @@ -87,7 +88,8 @@ jobs: - name: run test run: | - coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia + echo `pwd` + 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 From 3e92d62b78f492d435bbe22b4a84b88934b2f833 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 12:05:51 +0200 Subject: [PATCH 23/47] Further testing --- .github/workflows/pythonpackage.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 99817aa028..c67bc1d4c6 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,6 +27,7 @@ jobs: with: postgresql version: '10.7' postgresql user: 'postgres' + postgresql password: 'postgres' - uses: mirromutth/mysql-action@v1.1 if: ${{ matrix.TESTING_DB == 'mysql'}} with: @@ -48,9 +49,12 @@ jobs: if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | psql --version - psql -U postgres -w -c "CREATE DATABASE evennia;" - psql -U postgres -w -c "CREATE USER evennia WITH PASSWORD 'password';" - psql -U postgres -w -c "ALTER USER evennia CREATEDB;" + psql postgreqsl://postgres:postgres@localhost:5432/postgres -c "CREATE DATABASE evennia;" + psql postgreqsl://postgres:postgres@localhost:5432/postgres -c "CREATE USER evennia WITH PASSWORD 'password';" + psql postgreqsl://postgres:postgres@localhost:5432/postgres -c "ALTER USER evennia CREATED;" + # psql -U postgres -w -c "CREATE DATABASE evennia;" + # psql -U postgres -w -c "CREATE USER evennia WITH PASSWORD 'password';" + # psql -U postgres -w -c "ALTER USER evennia CREATEDB;" - name: Setup MySQL database if: ${{ matrix.TESTING_DB == 'mysql' }} run: | @@ -89,7 +93,9 @@ jobs: - name: run test run: | echo `pwd` - coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ./bin/unix/evennia test --settings=settings --keepdb evennia + 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 From 6588e28d6fc665623891968c5d25fb0e66a70655 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 20:10:21 +0200 Subject: [PATCH 24/47] Add codacy github action --- .github/workflows/pythonpackage.yml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c67bc1d4c6..e18f9e649e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -39,7 +39,7 @@ jobs: uses: jakejarvis/wait-action@v0.1.0 with: time: '10s' - - name: + - name: Database container logs # if: failure() uses: jwalton/gh-docker-logs@v1.0.0 - name: Check running containers @@ -49,12 +49,9 @@ jobs: if: ${{ matrix.TESTING_DB == 'postgresql' }} run: | psql --version - psql postgreqsl://postgres:postgres@localhost:5432/postgres -c "CREATE DATABASE evennia;" - psql postgreqsl://postgres:postgres@localhost:5432/postgres -c "CREATE USER evennia WITH PASSWORD 'password';" - psql postgreqsl://postgres:postgres@localhost:5432/postgres -c "ALTER USER evennia CREATED;" - # psql -U postgres -w -c "CREATE DATABASE evennia;" - # psql -U postgres -w -c "CREATE USER evennia WITH PASSWORD 'password';" - # psql -U postgres -w -c "ALTER USER evennia CREATEDB;" + 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: | @@ -92,15 +89,5 @@ jobs: - 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 - python-codacy-coverage -r coverage.xml From 3d3b04c758323e39fae34431657376769f458f9c Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 20:12:52 +0200 Subject: [PATCH 25/47] Coverage file added --- .github/workflows/codacy-coverage-reporter.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/codacy-coverage-reporter.yml diff --git a/.github/workflows/codacy-coverage-reporter.yml b/.github/workflows/codacy-coverage-reporter.yml new file mode 100644 index 0000000000..21bb9b7a9a --- /dev/null +++ b/.github/workflows/codacy-coverage-reporter.yml @@ -0,0 +1,17 @@ +# This sends coverage reports to codacy +# +name: codacy-coverage-reporter + +on: ["push"] + +jobs: + codacy-coverage-reporter: + runs-on: ubuntu-latest + name: codacy-coverage-reporter + steps: + - uses: actions/checkout@master + - name: Run codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml From f84b86f27aedc9264f0b257ae3b792a7d49cb35b Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 20:18:14 +0200 Subject: [PATCH 26/47] Move codacy into main action --- .github/workflows/codacy-coverage-reporter.yml | 17 ----------------- .github/workflows/pythonpackage.yml | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 .github/workflows/codacy-coverage-reporter.yml diff --git a/.github/workflows/codacy-coverage-reporter.yml b/.github/workflows/codacy-coverage-reporter.yml deleted file mode 100644 index 21bb9b7a9a..0000000000 --- a/.github/workflows/codacy-coverage-reporter.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This sends coverage reports to codacy -# -name: codacy-coverage-reporter - -on: ["push"] - -jobs: - codacy-coverage-reporter: - runs-on: ubuntu-latest - name: codacy-coverage-reporter - steps: - - uses: actions/checkout@master - - name: Run codacy-coverage-reporter - uses: codacy/codacy-coverage-reporter-action@master - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: coverage.xml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e18f9e649e..c316cf6ff5 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -89,5 +89,21 @@ jobs: - 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 + python-codacy-coverage -r coverage.xml + + - name: codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml From 82ee3c689930681a9ef577011f6a3d40f554a828 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 20:28:49 +0200 Subject: [PATCH 27/47] Some refactoring --- .github/workflows/pythonpackage.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c316cf6ff5..1b58706784 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -20,15 +20,17 @@ jobs: fail-fast: False steps: - - uses: actions/checkout@v2 - - uses: harmon758/postgresql-action@v1 + - 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' - - uses: mirromutth/mysql-action@v1.1 + - name: Set up MySQL server + uses: mirromutth/mysql-action@v1.1 if: ${{ matrix.TESTING_DB == 'mysql'}} with: mysql version: '8.0' @@ -72,7 +74,6 @@ jobs: pip install psycopg2-binary pip install mysqlclient pip install coveralls - pip install codacy-coverage pip install -e . - name: Install extra dependencies # Only develop branch right now @@ -87,7 +88,7 @@ jobs: evennia migrate evennia collectstatic --noinput - - name: run test + - name: Run test run: | echo `pwd` echo `ls` @@ -95,14 +96,14 @@ jobs: 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 + - name: Run coverall if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} run: | coveralls coverage xml - python-codacy-coverage -r coverage.xml - - name: codacy-coverage-reporter + - 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 }} From 2381f55ce2b7c0a90c63211ae64c1a3a116adaa3 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 20:44:58 +0200 Subject: [PATCH 28/47] Add coveralls token --- .github/workflows/pythonpackage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 1b58706784..205e5439e1 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -98,6 +98,8 @@ jobs: # 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 }} + with: + coveralls_repo_token: ${{ secrets.COVERALLS_REPO_TOKEN }} run: | coveralls coverage xml From 9c3d7457c36584c361e10ec04f8ae3a834369392 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 21:09:31 +0200 Subject: [PATCH 29/47] Test with different coverage setup --- .github/workflows/pythonpackage.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 205e5439e1..3a07f42fb5 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -90,23 +90,20 @@ jobs: - 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 + - name: Send to Coveralls if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} + uses: coverallsapp/github-action@v1.1.1 with: - coveralls_repo_token: ${{ secrets.COVERALLS_REPO_TOKEN }} - run: | - coveralls - coverage xml + github-token: ${{ secrets.GITHUB_TOKEN }} # in-built, need not be set up manually + path-to-lcov: ./testing_mygame/.coverage - - name: Report coverage to codacy + - name: Send to Codacity 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 + coverage-reports: ./testing_mygame/.coverage From 01eef3041f9a6a369813f5d1e6785c11fdb82fd2 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 21:51:41 +0200 Subject: [PATCH 30/47] Further tests with coveralls --- .github/workflows/pythonpackage.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3a07f42fb5..3fe32e34b9 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -92,18 +92,19 @@ jobs: run: | 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 + coverage xml # we only want to run coverall once, so we only do it for one of the matrix combinations - name: Send to Coveralls - if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} - uses: coverallsapp/github-action@v1.1.1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} # in-built, need not be set up manually - path-to-lcov: ./testing_mygame/.coverage + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + cd testing_mygame + coveralls - name: Send to Codacity 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: ./testing_mygame/.coverage + coverage-reports: ./testing_mygame/coverage.xml From 83b926f3fd15ecebddb0b52e632a12bd5fd6676c Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 22:09:55 +0200 Subject: [PATCH 31/47] Add Codacy variant --- .github/workflows/pythonpackage.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3fe32e34b9..b39fe49bd0 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -74,6 +74,7 @@ jobs: pip install psycopg2-binary pip install mysqlclient pip install coveralls + pip install codacy-coverage pip install -e . - name: Install extra dependencies # Only develop branch right now @@ -92,19 +93,15 @@ jobs: run: | 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 - coverage xml # we only want to run coverall once, so we only do it for one of the matrix combinations - - name: Send to Coveralls + - name: Send data to Coveralls / Codacy + if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} run: | cd testing_mygame coveralls - - - name: Send to Codacity - 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: ./testing_mygame/coverage.xml + coverage xml + python-codacy-coverage -r coverage.xml From ae62044df97b91f97b5cca6b07a26462f7cf978f Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Sun, 17 May 2020 16:26:38 -0400 Subject: [PATCH 32/47] Make Puzzle's use command user-friendly. --- evennia/contrib/puzzles.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/evennia/contrib/puzzles.py b/evennia/contrib/puzzles.py index 5eef1f77e2..924addfc32 100644 --- a/evennia/contrib/puzzles.py +++ b/evennia/contrib/puzzles.py @@ -588,15 +588,30 @@ def _matching_puzzles(puzzles, puzzlename_tags_dict, puzzle_ingredients): class CmdUsePuzzleParts(MuxCommand): + """ + Use an object, or a group of objects at once. + + + Example: + You look around you and see a pole, a long string, and a needle. + + use pole, long string, needle + + Genius! You built a fishing pole. + + + Usage: + use [,obj2,...] + """ + + # Technical explanation """ Searches for all puzzles whose parts match the given set of objects. If there are matching puzzles, the result objects are spawned in their corresponding location if all parts have been passed in. - - Usage: - use ] """ + key = "use" aliases = "combine" locks = "cmd:pperm(use) or pperm(Player)" From a757dd95dcbe5c7b2ddfe3fe3e1ec1917b2c5e84 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 22:50:28 +0200 Subject: [PATCH 33/47] Test codacy action --- .github/workflows/pythonpackage.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index b39fe49bd0..a123e09462 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -39,6 +39,7 @@ jobs: # wait for db to activage, get logs from their start - name: Wait / sleep uses: jakejarvis/wait-action@v0.1.0 + if: ${{ matrix.TESTING_DB == 'postgresql' || matrix.TESTING_DB == 'mysql' }} with: time: '10s' - name: Database container logs @@ -93,15 +94,19 @@ jobs: run: | 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 + coverage xml # we only want to run coverall once, so we only do it for one of the matrix combinations - - name: Send data to Coveralls / Codacy + - name: Send data to Coveralls if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} run: | cd testing_mygame coveralls - coverage xml - python-codacy-coverage -r coverage.xml + - name: Send data 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: ./testing_mygame/coverage.xml From e448e0007a5b3edfc1e0cdd05cc7ea4dc95de543 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 22:54:39 +0200 Subject: [PATCH 34/47] Fix indent error --- .github/workflows/pythonpackage.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index a123e09462..fafafd1088 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -105,8 +105,8 @@ jobs: cd testing_mygame coveralls - name: Send data 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: ./testing_mygame/coverage.xml + 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: ./testing_mygame/coverage.xml From 85438f3ebba5751c00cd8bdc6c3670e27d4dff67 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:07:50 +0200 Subject: [PATCH 35/47] Test with cobertura file name --- .github/workflows/pythonpackage.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index fafafd1088..005dd33c62 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,8 +27,8 @@ jobs: if: ${{ matrix.TESTING_DB == 'postgresql' }} with: postgresql version: '10.7' + posgresql db: 'postgres' postgresql user: 'postgres' - postgresql password: 'postgres' - name: Set up MySQL server uses: mirromutth/mysql-action@v1.1 if: ${{ matrix.TESTING_DB == 'mysql'}} @@ -52,9 +52,9 @@ jobs: 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;" + psql -U postgres -d postgres -h localhost -c "CREATE DATABASE evennia;" + psql -U postgres -d postgres -h localhost -c "CREATE USER evennia WITH PASSWORD 'password';" + psql -U postgres -d postgres -h localhost -c "ALTER USER evennia CREATEDB;" - name: Setup MySQL database if: ${{ matrix.TESTING_DB == 'mysql' }} run: | @@ -95,6 +95,7 @@ jobs: 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 coverage xml + cp coverage.cml ../cobertura.xml # we only want to run coverall once, so we only do it for one of the matrix combinations - name: Send data to Coveralls @@ -109,4 +110,4 @@ jobs: uses: codacy/codacy-coverage-reporter-action@master with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ./testing_mygame/coverage.xml + # coverage-reports: ./testing_mygame/coverage.xml From 44c5dd13d52b92fef293c3e895a98fce2858d99c Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:09:29 +0200 Subject: [PATCH 36/47] Annoying typo --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 005dd33c62..cfb2a67363 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -95,7 +95,7 @@ jobs: 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 coverage xml - cp coverage.cml ../cobertura.xml + cp coverage.xml ../cobertura.xml # we only want to run coverall once, so we only do it for one of the matrix combinations - name: Send data to Coveralls From 3dc43a360b5345c13b9fd4af87dd761b265c4524 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:24:03 +0200 Subject: [PATCH 37/47] Testing to get mysql support --- .github/workflows/pythonpackage.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index cfb2a67363..03b198025b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -43,7 +43,7 @@ jobs: with: time: '10s' - name: Database container logs - # if: failure() + if: failure() uses: jwalton/gh-docker-logs@v1.0.0 - name: Check running containers run: docker ps -a @@ -59,9 +59,9 @@ jobs: 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';" + mysql -uroot -proot -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + mysql -uroot -proot -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" + mysql -uroot -proot -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 @@ -95,7 +95,6 @@ jobs: 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 coverage xml - cp coverage.xml ../cobertura.xml # we only want to run coverall once, so we only do it for one of the matrix combinations - name: Send data to Coveralls @@ -110,4 +109,4 @@ jobs: uses: codacy/codacy-coverage-reporter-action@master with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - # coverage-reports: ./testing_mygame/coverage.xml + coverage-reports: ./testing_mygame/coverage.xml From 4689af914f6711efc110d0e7f424cb1cf024ba54 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:30:21 +0200 Subject: [PATCH 38/47] Try in-built ubuntu mysql instead of action --- .github/workflows/pythonpackage.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 03b198025b..c584f4a984 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -29,13 +29,13 @@ jobs: postgresql version: '10.7' posgresql db: 'postgres' postgresql user: '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' - + # - 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 From c7c296938873e445b36dc99f424a024610483531 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:38:39 +0200 Subject: [PATCH 39/47] Alternative mysql action setup --- .github/workflows/pythonpackage.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c584f4a984..237f1a07e5 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -22,6 +22,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up PostgreSQL server uses: harmon758/postgresql-action@v1 if: ${{ matrix.TESTING_DB == 'postgresql' }} @@ -29,13 +30,17 @@ jobs: postgresql version: '10.7' posgresql db: 'postgres' postgresql user: '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' - # + - name: Shutdown Ubuntu MySQL + if: ${{ matrix.TESTING_DB == 'mysql'}} + run: sudo service mysql stop + - name: Set up MySQL server + uses: mirromutth/mysql-action@v1.1 + if: ${{ matrix.TESTING_DB == 'mysql'}} + with: + mysql version: '8.0' + mysql database: 'root' + mysql root password: 'root' + # wait for db to activage, get logs from their start - name: Wait / sleep uses: jakejarvis/wait-action@v0.1.0 From 73ff92f898989448e6f9435b410052bbf776d7fd Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:48:04 +0200 Subject: [PATCH 40/47] More github-action test with dbs --- .github/workflows/pythonpackage.yml | 44 ++++++++++++++++------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 237f1a07e5..0f4dd58601 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -28,8 +28,9 @@ jobs: if: ${{ matrix.TESTING_DB == 'postgresql' }} with: postgresql version: '10.7' - posgresql db: 'postgres' - postgresql user: 'postgres' + postgresql db: 'evennia' + postgresql user: 'evennia' + postgresql password: 'password' - name: Shutdown Ubuntu MySQL if: ${{ matrix.TESTING_DB == 'mysql'}} run: sudo service mysql stop @@ -38,8 +39,11 @@ jobs: if: ${{ matrix.TESTING_DB == 'mysql'}} with: mysql version: '8.0' - mysql database: 'root' - mysql root password: 'root' + mysql database: 'evennia' + character set server: 'utf8mb4' + collation server: 'utf8mb4_unicode_ci' + mysql_user: 'evennia' + mysql_password: 'password' # wait for db to activage, get logs from their start - name: Wait / sleep @@ -48,26 +52,26 @@ jobs: with: time: '10s' - name: Database container logs - if: failure() + # 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 -d postgres -h localhost -c "CREATE DATABASE evennia;" - psql -U postgres -d postgres -h localhost -c "CREATE USER evennia WITH PASSWORD 'password';" - psql -U postgres -d postgres -h localhost -c "ALTER USER evennia CREATEDB;" - - name: Setup MySQL database - if: ${{ matrix.TESTING_DB == 'mysql' }} - run: | - mysql --version - mysql -uroot -proot -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - mysql -uroot -proot -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" - mysql -uroot -proot -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" - + # - name: Setup PostgreSQL database + # if: ${{ matrix.TESTING_DB == 'postgresql' }} + # run: | + # psql --version + # psql -U postgres -d postgres -h localhost -c "CREATE DATABASE evennia;" + # psql -U postgres -d postgres -h localhost -c "CREATE USER evennia WITH PASSWORD 'password';" + # psql -U postgres -d postgres -h localhost -c "ALTER USER evennia CREATEDB;" + # - name: Setup MySQL database + # if: ${{ matrix.TESTING_DB == 'mysql' }} + # run: | + # mysql --version + # mysql -uroot -proot -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + # mysql -uroot -proot -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" + # mysql -uroot -proot -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" + # - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: From 856dcb32785d6f711c0366ae8eca82fd78f0c390 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 17 May 2020 23:50:50 +0200 Subject: [PATCH 41/47] Further test with mysql action --- .github/workflows/pythonpackage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 0f4dd58601..8927a46185 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -42,8 +42,8 @@ jobs: mysql database: 'evennia' character set server: 'utf8mb4' collation server: 'utf8mb4_unicode_ci' - mysql_user: 'evennia' - mysql_password: 'password' + mysql user: 'evennia' + mysql password: 'password' # wait for db to activage, get logs from their start - name: Wait / sleep From 357e60dc81d40ce1400c007b1f2077c09a69d6a1 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 00:12:18 +0200 Subject: [PATCH 42/47] Refactoring of actions --- .github/workflows/pythonpackage.yml | 41 ++++++++--------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 8927a46185..9bf146c9ed 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -10,18 +10,18 @@ on: branches: [ master, develop ] jobs: - build: + build: runs-on: ubuntu-latest strategy: matrix: python-version: [3.7, 3.8] TESTING_DB: ['sqlite3', 'postgresql', 'mysql'] - fail-fast: False + fail-fast: False - steps: + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Set up PostgreSQL server uses: harmon758/postgresql-action@v1 @@ -31,17 +31,14 @@ jobs: postgresql db: 'evennia' postgresql user: 'evennia' postgresql password: 'password' - - name: Shutdown Ubuntu MySQL - if: ${{ matrix.TESTING_DB == 'mysql'}} - run: sudo service mysql stop - name: Set up MySQL server uses: mirromutth/mysql-action@v1.1 if: ${{ matrix.TESTING_DB == 'mysql'}} - with: - mysql version: '8.0' - mysql database: 'evennia' + with: + mysql version: '5.7' character set server: 'utf8mb4' collation server: 'utf8mb4_unicode_ci' + mysql database: 'evennia' mysql user: 'evennia' mysql password: 'password' @@ -52,26 +49,10 @@ jobs: 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 -d postgres -h localhost -c "CREATE DATABASE evennia;" - # psql -U postgres -d postgres -h localhost -c "CREATE USER evennia WITH PASSWORD 'password';" - # psql -U postgres -d postgres -h localhost -c "ALTER USER evennia CREATEDB;" - # - name: Setup MySQL database - # if: ${{ matrix.TESTING_DB == 'mysql' }} - # run: | - # mysql --version - # mysql -uroot -proot -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - # mysql -uroot -proot -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" - # mysql -uroot -proot -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" - # - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -80,7 +61,7 @@ jobs: - name: Install package dependencies run: | python -m pip install --upgrade pip - pip install wheel + pip install wheel pip install psycopg2-binary pip install mysqlclient pip install coveralls @@ -99,9 +80,9 @@ jobs: evennia migrate evennia collectstatic --noinput - - name: Run test + - name: Run test suite run: | - cd testing_mygame + 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 coverage xml @@ -111,7 +92,7 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} run: | - cd testing_mygame + cd testing_mygame coveralls - name: Send data to Codacy if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} From 7aa56221e7845f38dea415dc43dc7bb144aa865c Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 00:15:59 +0200 Subject: [PATCH 43/47] Disabling github action for the mysql test for now At this time the mysql database spun up by github actions is not possible to connect to once evennia starts. It's unclear why this is. --- .github/workflows/pythonpackage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9bf146c9ed..145ce09e17 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,8 @@ jobs: strategy: matrix: python-version: [3.7, 3.8] - TESTING_DB: ['sqlite3', 'postgresql', 'mysql'] + # TODO: mysql disabled, not able to connect to it so far + TESTING_DB: ['sqlite3', 'postgresql'] # , 'mysql'] fail-fast: False steps: From 703b307c4021ef9c82cd7d258abc290a65c7cb0c Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 18:18:46 +0200 Subject: [PATCH 44/47] Remove unused /reset switch from CmdCopy. Resolves #2136 --- evennia/commands/default/building.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index a69d1cce15..ace7b7a7b7 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -251,20 +251,14 @@ class CmdCopy(ObjManipCommand): copy an object and its properties Usage: - copy[/reset] [= ][;alias;alias..] + copy [= ][;alias;alias..] [:] [, ...] - switch: - reset - make a 'clean' copy off the object, thus - removing any changes that might have been made to the original - since it was first created. - Create one or more copies of an object. If you don't supply any targets, one exact copy of the original object will be created with the name *_copy. """ key = "copy" - switch_options = ("reset",) locks = "cmd:perm(copy) or perm(Builder)" help_category = "Building" From ad1169d900b00555f8badaa078a773d35f8ce8e2 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 20:25:26 +0200 Subject: [PATCH 45/47] Fix get_tag error. Resolve #2128 --- evennia/typeclasses/managers.py | 100 +++++++++++++++++++++----------- evennia/typeclasses/tests.py | 59 +++++++++++++++---- 2 files changed, 115 insertions(+), 44 deletions(-) diff --git a/evennia/typeclasses/managers.py b/evennia/typeclasses/managers.py index b53755ad45..85f9a4b304 100644 --- a/evennia/typeclasses/managers.py +++ b/evennia/typeclasses/managers.py @@ -31,8 +31,14 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): # Attribute manager methods def get_attribute( - self, key=None, category=None, value=None, strvalue=None, obj=None, attrtype=None, **kwargs - + self, + key=None, + category=None, + value=None, + strvalue=None, + obj=None, + attrtype=None, + **kwargs ): """ Return Attribute objects by key, by category, by value, by @@ -76,9 +82,9 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): # no reason to make strvalue/value mutually exclusive at this level query.append(("attribute__db_value", value)) return Attribute.objects.filter( - pk__in=self.model.db_attributes.through.objects.filter(**dict(query)).values_list( - "attribute_id", flat=True - ) + pk__in=self.model.db_attributes.through.objects.filter( + **dict(query) + ).values_list("attribute_id", flat=True) ) def get_nick(self, key=None, category=None, value=None, strvalue=None, obj=None): @@ -104,8 +110,15 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): key=key, category=category, value=value, strvalue=strvalue, obj=obj ) - def get_by_attribute(self, key=None, category=None, value=None, - strvalue=None, attrtype=None, **kwargs): + def get_by_attribute( + self, + key=None, + category=None, + value=None, + strvalue=None, + attrtype=None, + **kwargs + ): """ Return objects having attributes with the given key, category, value, strvalue or combination of those criteria. @@ -132,7 +145,10 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): """ dbmodel = self.model.__dbclass__.__name__.lower() - query = [("db_attributes__db_attrtype", attrtype), ("db_attributes__db_model", dbmodel)] + query = [ + ("db_attributes__db_attrtype", attrtype), + ("db_attributes__db_model", dbmodel), + ] if key: query.append(("db_attributes__db_key", key)) if category: @@ -158,11 +174,15 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): obj (list): Objects having the matching Nicks. """ - return self.get_by_attribute(key=key, category=category, strvalue=nick, attrtype="nick") + return self.get_by_attribute( + key=key, category=category, strvalue=nick, attrtype="nick" + ) # Tag manager methods - def get_tag(self, key=None, category=None, obj=None, tagtype=None, global_search=False): + def get_tag( + self, key=None, category=None, obj=None, tagtype=None, global_search=False + ): """ Return Tag objects by key, by category, by object (it is stored on) or with a combination of those criteria. @@ -206,9 +226,9 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): if category: query.append(("tag__db_category", category)) return Tag.objects.filter( - pk__in=self.model.db_tags.through.objects.filter(**dict(query)).values_list( - "tag_id", flat=True - ) + pk__in=self.model.db_tags.through.objects.filter( + **dict(query) + ).values_list("tag_id", flat=True) ) def get_permission(self, key=None, category=None, obj=None): @@ -279,7 +299,7 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): if not _Tag: from evennia.typeclasses.models import Tag as _Tag - match = kwargs.get("match", "all").lower().strip() + anymatch = "any" == kwargs.get("match", "all").lower().strip() keys = make_iter(key) if key else [] categories = make_iter(category) if category else [] @@ -290,7 +310,9 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): dbmodel = self.model.__dbclass__.__name__.lower() query = ( - self.filter(db_tags__db_tagtype__iexact=tagtype, db_tags__db_model__iexact=dbmodel) + self.filter( + db_tags__db_tagtype__iexact=tagtype, db_tags__db_model__iexact=dbmodel + ) .distinct() .order_by("id") ) @@ -309,28 +331,30 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): ) clauses = Q() for ikey, key in enumerate(keys): - # Keep each key and category together, grouped by AND - clauses |= Q(db_key__iexact=key, db_category__iexact=categories[ikey]) - + # ANY mode; must match any one of the given tags/categories + clauses |= Q( + db_key__iexact=key, db_category__iexact=categories[ikey] + ) else: # only one or more categories given - # import evennia;evennia.set_trace() clauses = Q() + # ANY mode; must match any one of them for category in unique_categories: clauses |= Q(db_category__iexact=category) tags = _Tag.objects.filter(clauses) query = query.filter(db_tags__in=tags).annotate( - matches=Count("db_tags__pk", filter=Q(db_tags__in=tags), distinct=True) + matches=Count("db_tags__pk", filter=Q(db_tags__in=tags), + distinct=True) ) - # Default ALL: Match all of the tags and optionally more - if match == "all": - n_req_tags = tags.count() if n_keys > 0 else n_unique_categories - query = query.filter(matches__gte=n_req_tags) - # ANY: Match any single tag, ordered by weight - elif match == "any": + if anymatch: + # ANY: Match any single tag, ordered by weight query = query.order_by("-matches") + else: + # Default ALL: Match all of the tags and optionally more + n_req_tags = n_keys if n_keys > 0 else n_unique_categories + query = query.filter(matches__gte=n_req_tags) return query @@ -388,7 +412,9 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): # try to get old tag dbmodel = self.model.__dbclass__.__name__.lower() - tag = self.get_tag(key=key, category=category, tagtype=tagtype, global_search=True) + tag = self.get_tag( + key=key, category=category, tagtype=tagtype, global_search=True + ) if tag and data is not None: # get tag from list returned by get_tag tag = tag[0] @@ -402,7 +428,9 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): from evennia.typeclasses.models import Tag as _Tag tag = _Tag.objects.create( db_key=key.strip().lower() if key is not None else None, - db_category=category.strip().lower() if category and key is not None else None, + db_category=category.strip().lower() + if category and key is not None + else None, db_data=data, db_model=dbmodel, db_tagtype=tagtype.strip().lower() if tagtype is not None else None, @@ -511,7 +539,8 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): typeclass=F("db_typeclass_path"), # Calculate this class' percentage of total composition percent=ExpressionWrapper( - ((F("count") / float(self.count())) * 100.0), output_field=FloatField() + ((F("count") / float(self.count())) * 100.0), + output_field=FloatField(), ), ) .values("typeclass", "count", "percent") @@ -531,7 +560,9 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): stats = self.get_typeclass_totals().order_by("typeclass") return {x.get("typeclass"): x.get("count") for x in stats} - def typeclass_search(self, typeclass, include_children=False, include_parents=False): + def typeclass_search( + self, typeclass, include_children=False, include_parents=False + ): """ Searches through all objects returning those which has a certain typeclass. If location is set, limit search to objects @@ -806,7 +837,8 @@ class TypeclassManager(TypedObjectManager): """ paths = [self.model.path] + [ - "%s.%s" % (cls.__module__, cls.__name__) for cls in self._get_subclasses(self.model) + "%s.%s" % (cls.__module__, cls.__name__) + for cls in self._get_subclasses(self.model) ] kwargs.update({"db_typeclass_path__in": paths}) return super().get(**kwargs) @@ -828,7 +860,8 @@ class TypeclassManager(TypedObjectManager): """ # query, including all subclasses paths = [self.model.path] + [ - "%s.%s" % (cls.__module__, cls.__name__) for cls in self._get_subclasses(self.model) + "%s.%s" % (cls.__module__, cls.__name__) + for cls in self._get_subclasses(self.model) ] kwargs.update({"db_typeclass_path__in": paths}) return super().filter(*args, **kwargs) @@ -843,6 +876,7 @@ class TypeclassManager(TypedObjectManager): """ paths = [self.model.path] + [ - "%s.%s" % (cls.__module__, cls.__name__) for cls in self._get_subclasses(self.model) + "%s.%s" % (cls.__module__, cls.__name__) + for cls in self._get_subclasses(self.model) ] return super().all().filter(db_typeclass_path__in=paths) diff --git a/evennia/typeclasses/tests.py b/evennia/typeclasses/tests.py index 8632db5fc6..9730ec5dcf 100644 --- a/evennia/typeclasses/tests.py +++ b/evennia/typeclasses/tests.py @@ -58,12 +58,16 @@ class TestTypedObjectManager(EvenniaTest): self.obj2.tags.add("tag4") self.obj2.tags.add("tag2c") self.assertEqual(self._manager("get_by_tag", "tag1"), [self.obj1]) - self.assertEqual(set(self._manager("get_by_tag", "tag2")), set([self.obj1, self.obj2])) + self.assertEqual( + set(self._manager("get_by_tag", "tag2")), set([self.obj1, self.obj2]) + ) self.assertEqual(self._manager("get_by_tag", "tag2a"), [self.obj2]) self.assertEqual(self._manager("get_by_tag", "tag3 with spaces"), [self.obj2]) self.assertEqual(self._manager("get_by_tag", ["tag2a", "tag2b"]), [self.obj2]) self.assertEqual(self._manager("get_by_tag", ["tag2a", "tag1"]), []) - self.assertEqual(self._manager("get_by_tag", ["tag2a", "tag4", "tag2c"]), [self.obj2]) + self.assertEqual( + self._manager("get_by_tag", ["tag2a", "tag4", "tag2c"]), [self.obj2] + ) def test_get_by_tag_and_category(self): self.obj1.tags.add("tag5", "category1") @@ -79,24 +83,57 @@ class TestTypedObjectManager(EvenniaTest): self.obj1.tags.add("tag8", "category6") self.obj2.tags.add("tag9", "category6") - self.assertEqual(self._manager("get_by_tag", "tag5", "category1"), [self.obj1, self.obj2]) + self.assertEqual( + self._manager("get_by_tag", "tag5", "category1"), [self.obj1, self.obj2] + ) self.assertEqual(self._manager("get_by_tag", "tag6", "category1"), []) - self.assertEqual(self._manager("get_by_tag", "tag6", "category3"), [self.obj1, self.obj2]) + self.assertEqual( + self._manager("get_by_tag", "tag6", "category3"), [self.obj1, self.obj2] + ) self.assertEqual( self._manager("get_by_tag", ["tag5", "tag6"], ["category1", "category3"]), [self.obj1, self.obj2], ) self.assertEqual( - self._manager("get_by_tag", ["tag5", "tag7"], "category1"), [self.obj1, self.obj2] + self._manager("get_by_tag", ["tag5", "tag7"], "category1"), + [self.obj1, self.obj2], + ) + self.assertEqual( + self._manager("get_by_tag", category="category1"), [self.obj1, self.obj2] ) - self.assertEqual(self._manager("get_by_tag", category="category1"), [self.obj1, self.obj2]) self.assertEqual(self._manager("get_by_tag", category="category2"), [self.obj2]) self.assertEqual( - self._manager("get_by_tag", category=["category1", "category3"]), [self.obj1, self.obj2] + self._manager("get_by_tag", category=["category1", "category3"]), + [self.obj1, self.obj2], ) self.assertEqual( - self._manager("get_by_tag", category=["category1", "category2"]), [self.obj1, self.obj2] + self._manager("get_by_tag", category=["category1", "category2"]), + [self.obj1, self.obj2], + ) + self.assertEqual( + self._manager("get_by_tag", category=["category5", "category4"]), [] + ) + self.assertEqual( + self._manager("get_by_tag", category="category1"), [self.obj1, self.obj2] + ) + self.assertEqual( + self._manager("get_by_tag", category="category6"), [self.obj1, self.obj2] + ) + + def test_get_tag_with_all(self): + self.obj1.tags.add("tagA", "categoryA") + self.assertEqual( + self._manager( + "get_by_tag", ["tagA", "tagB"], ["categoryA", "categoryB"], match="all" + ), + [], + ) + + def test_get_tag_with_any(self): + self.obj1.tags.add("tagA", "categoryA") + self.assertEqual( + self._manager( + "get_by_tag", ["tagA", "tagB"], ["categoryA", "categoryB"], match="any" + ), + [self.obj1], ) - self.assertEqual(self._manager("get_by_tag", category=["category5", "category4"]), []) - self.assertEqual(self._manager("get_by_tag", category="category1"), [self.obj1, self.obj2]) - self.assertEqual(self._manager("get_by_tag", category="category6"), [self.obj1, self.obj2]) From ece9dd6b1dcaa77b56f73d9e12d14e8eda301e39 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 20:28:30 +0200 Subject: [PATCH 46/47] Add extra unittest --- evennia/typeclasses/tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/evennia/typeclasses/tests.py b/evennia/typeclasses/tests.py index 9730ec5dcf..a49f1d2645 100644 --- a/evennia/typeclasses/tests.py +++ b/evennia/typeclasses/tests.py @@ -137,3 +137,12 @@ class TestTypedObjectManager(EvenniaTest): ), [self.obj1], ) + + def test_get_tag_withnomatch(self): + self.obj1.tags.add("tagC", "categoryC") + self.assertEqual( + self._manager( + "get_by_tag", ["tagA", "tagB"], ["categoryA", "categoryB"], match="any" + ), + [], + ) From 935c2c6eff60a3c75be54fd459e9254c71565570 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 May 2020 20:38:04 +0200 Subject: [PATCH 47/47] Test tag error claim of #2139 --- evennia/locks/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/evennia/locks/tests.py b/evennia/locks/tests.py index dce0e28fff..c078b597ea 100644 --- a/evennia/locks/tests.py +++ b/evennia/locks/tests.py @@ -175,6 +175,16 @@ class TestLockfuncs(EvenniaTest): self.assertEqual(True, lockfuncs.objtag(None, self.obj2, "test2", "category1")) self.assertEqual(False, lockfuncs.objtag(None, self.obj2, "test2")) + def test_traverse_taglock(self): + self.obj2.tags.add("test1", "category1") + self.exit.locks.add("traverse:tag(test1,category1)") + self.assertEqual(self.exit.access(self.obj2, "traverse"), True) + + def test_traverse_taglock_fail(self): + self.obj2.tags.add("test1") # missing the category + self.exit.locks.add("traverse:tag(test1,category1)") + self.assertEqual(self.exit.access(self.obj2, "traverse"), False) + def test_inside_holds(self): self.assertEqual(True, lockfuncs.inside(self.char1, self.room1)) self.assertEqual(False, lockfuncs.inside(self.char1, self.room2))