Browse Source

Merge pull request #14085 from ankush/ci_ubuntu_latest

ci: use ubuntu-latest for all jobs
version-14
Ankush Menat 3 years ago
committed by GitHub
parent
commit
4aced1cbe2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 37 deletions
  1. +2
    -1
      .github/helper/install.sh
  2. +1
    -1
      .github/workflows/patch-mariadb-tests.yml
  3. +2
    -2
      .github/workflows/server-mariadb-tests.yml
  4. +1
    -1
      .github/workflows/server-postgres-tests.yml
  5. +0
    -22
      .github/workflows/translation_linter.yml
  6. +1
    -1
      .github/workflows/ui-tests.yml
  7. +25
    -9
      frappe/tests/test_commands.py

+ 2
- 1
.github/helper/install.sh View File

@@ -17,6 +17,7 @@ if [ "$TYPE" == "server" ]; then
fi fi


if [ "$DB" == "mariadb" ];then if [ "$DB" == "mariadb" ];then
sudo apt install mariadb-client-10.3
mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL character_set_server = 'utf8mb4'"; mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL character_set_server = 'utf8mb4'";
mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"; mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";


@@ -58,4 +59,4 @@ cd ../..
bench start & bench start &
bench --site test_site reinstall --yes bench --site test_site reinstall --yes
if [ "$TYPE" == "server" ]; then bench --site test_site_producer reinstall --yes; fi if [ "$TYPE" == "server" ]; then bench --site test_site_producer reinstall --yes; fi
bench build --app frappe
bench build --app frappe

+ 1
- 1
.github/workflows/patch-mariadb-tests.yml View File

@@ -9,7 +9,7 @@ concurrency:


jobs: jobs:
test: test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest


name: Patch Test name: Patch Test




+ 2
- 2
.github/workflows/server-mariadb-tests.yml View File

@@ -13,7 +13,7 @@ concurrency:


jobs: jobs:
test: test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest


strategy: strategy:
fail-fast: false fail-fast: false
@@ -127,4 +127,4 @@ jobs:
name: MariaDB name: MariaDB
fail_ci_if_error: true fail_ci_if_error: true
files: /home/runner/frappe-bench/sites/coverage.xml files: /home/runner/frappe-bench/sites/coverage.xml
verbose: true
verbose: true

+ 1
- 1
.github/workflows/server-postgres-tests.yml View File

@@ -12,7 +12,7 @@ concurrency:


jobs: jobs:
test: test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest


strategy: strategy:
fail-fast: false fail-fast: false


+ 0
- 22
.github/workflows/translation_linter.yml View File

@@ -1,22 +0,0 @@
name: Frappe Linter
on:
pull_request:
branches:
- develop
- version-12-hotfix
- version-11-hotfix
jobs:
check_translation:
name: Translation Syntax Check
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup python3
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Validating Translation Syntax
run: |
git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF -q
files=$(git diff --name-only --diff-filter=d $GITHUB_BASE_REF)
python $GITHUB_WORKSPACE/.github/helper/translation.py $files

+ 1
- 1
.github/workflows/ui-tests.yml View File

@@ -12,7 +12,7 @@ concurrency:


jobs: jobs:
test: test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest


strategy: strategy:
fail-fast: false fail-fast: false


+ 25
- 9
frappe/tests/test_commands.py View File

@@ -63,15 +63,15 @@ def clean(value):
return value return value




def exists_in_backup(doctypes, file):
"""Checks if the list of doctypes exist in the database.sql.gz file supplied
def missing_in_backup(doctypes, file):
"""Returns list of missing doctypes in the backup.


Args: Args:
doctypes (list): List of DocTypes to be checked doctypes (list): List of DocTypes to be checked
file (str): Path of the database file file (str): Path of the database file


Returns: Returns:
bool: True if all tables exist
doctypes(list): doctypes that are missing in backup
""" """
predicate = ( predicate = (
'COPY public."tab{}"' 'COPY public."tab{}"'
@@ -79,8 +79,24 @@ def exists_in_backup(doctypes, file):
else "CREATE TABLE `tab{}`" else "CREATE TABLE `tab{}`"
) )
with gzip.open(file, "rb") as f: with gzip.open(file, "rb") as f:
content = f.read().decode("utf8")
return all(predicate.format(doctype).lower() in content.lower() for doctype in doctypes)
content = f.read().decode("utf8").lower()

return [doctype for doctype in doctypes
if predicate.format(doctype).lower() not in content]


def exists_in_backup(doctypes, file):
"""Checks if the list of doctypes exist in the database.sql.gz file supplied

Args:
doctypes (list): List of DocTypes to be checked
file (str): Path of the database file

Returns:
bool: True if all tables exist
"""
missing_doctypes = missing_in_backup(doctypes, file)
return len(missing_doctypes) == 0




class BaseTestCommands(unittest.TestCase): class BaseTestCommands(unittest.TestCase):
@@ -222,7 +238,7 @@ class TestCommands(BaseTestCommands):
self.execute("bench --site {site} backup --verbose") self.execute("bench --site {site} backup --verbose")
self.assertEqual(self.returncode, 0) self.assertEqual(self.returncode, 0)
database = fetch_latest_backups(partial=True)["database"] database = fetch_latest_backups(partial=True)["database"]
self.assertTrue(exists_in_backup(backup["includes"]["includes"], database))
self.assertEqual([], missing_in_backup(backup["includes"]["includes"], database))


# test 8: take a backup with frappe.conf.backup.excludes # test 8: take a backup with frappe.conf.backup.excludes
self.execute( self.execute(
@@ -233,7 +249,7 @@ class TestCommands(BaseTestCommands):
self.assertEqual(self.returncode, 0) self.assertEqual(self.returncode, 0)
database = fetch_latest_backups(partial=True)["database"] database = fetch_latest_backups(partial=True)["database"]
self.assertFalse(exists_in_backup(backup["excludes"]["excludes"], database)) self.assertFalse(exists_in_backup(backup["excludes"]["excludes"], database))
self.assertTrue(exists_in_backup(backup["includes"]["includes"], database))
self.assertEqual([], missing_in_backup(backup["includes"]["includes"], database))


# test 9: take a backup with --include (with frappe.conf.excludes still set) # test 9: take a backup with --include (with frappe.conf.excludes still set)
self.execute( self.execute(
@@ -242,7 +258,7 @@ class TestCommands(BaseTestCommands):
) )
self.assertEqual(self.returncode, 0) self.assertEqual(self.returncode, 0)
database = fetch_latest_backups(partial=True)["database"] database = fetch_latest_backups(partial=True)["database"]
self.assertTrue(exists_in_backup(backup["includes"]["includes"], database))
self.assertEqual([], missing_in_backup(backup["includes"]["includes"], database))


# test 10: take a backup with --exclude # test 10: take a backup with --exclude
self.execute( self.execute(
@@ -257,7 +273,7 @@ class TestCommands(BaseTestCommands):
self.execute("bench --site {site} backup --ignore-backup-conf") self.execute("bench --site {site} backup --ignore-backup-conf")
self.assertEqual(self.returncode, 0) self.assertEqual(self.returncode, 0)
database = fetch_latest_backups()["database"] database = fetch_latest_backups()["database"]
self.assertTrue(exists_in_backup(backup["excludes"]["excludes"], database))
self.assertEqual([], missing_in_backup(backup["excludes"]["excludes"], database))


def test_restore(self): def test_restore(self):
# step 0: create a site to run the test on # step 0: create a site to run the test on


Loading…
Cancel
Save