Commit 8e10cf66 authored by Claude Paroz's avatar Claude Paroz

Add GitLab CI configuration

parent b0549767
Pipeline #12529 passed with stage
in 2 minutes and 32 seconds
image: python:latest
before_script:
- apt update -qq && apt install -y -qq libicu-dev python3-icu gettext intltool itstool gnome-doc-utils
- pip install -r requirements.txt
test:
script:
- python manage.py compile-trans --settings=damnedlies.settings_tests
- python manage.py test --settings=damnedlies.settings_tests
......@@ -176,7 +176,7 @@ GITLAB_TOKEN = 'fill_with_real_token'
try:
from .local_settings import *
except ImportError:
raise ImportError("The damnedlies/local_settings.py file is mandatory. See the README file.")
pass
# Allowing local_settings to override template loaders (not cached on dev)
try:
......
import os
from .settings import *
SECRET_KEY = 'shRc(?sk+sW3Wqn-lBvs=r52a@#hgC9g'
SCRATCHDIR = os.path.join(BASE_DIR, 'scratch')
POTDIR = os.path.join(SCRATCHDIR, "POT")
......@@ -122,6 +122,7 @@ class ModuleTestCase(TestCase):
help_domain.save()
self.assertEqual(list(self.branch.get_domains().keys()), ['po'])
@test_scratchdir
def test_domain_linguas(self):
help_domain = self.branch.get_domains()['help']
help_domain.linguas_location = "help/Makefile.am"
......@@ -132,15 +133,13 @@ class ModuleTestCase(TestCase):
})
help_domain.linguas_location = "help/Makefile.am#HELP_LINGUAS"
self.assertEqual(help_domain.get_linguas(self.branch), {
'langs': ['cs', 'da', 'de', 'el', 'eo', 'es', 'fr', 'ja', 'oc', 'os',
'pl', 'pt_BR', 'sl', 'sv', 'uk', 'zh_CN'],
'langs': ['de', 'fr'],
'error': 'Entry for this language is not present in HELP_LINGUAS variable in '
'help/Makefile.am file.',
})
help_domain.linguas_location = ''
self.assertEqual(help_domain.get_linguas(self.branch), {
'langs': ['cs', 'da', 'de', 'el', 'eo', 'es', 'fr', 'ja', 'oc', 'os',
'pl', 'pt_BR', 'sl', 'sv', 'uk', 'zh_CN'],
'langs': ['de', 'fr'],
'error': 'DOC_LINGUAS list doesn’t include this language.',
})
......@@ -149,7 +148,8 @@ class ModuleTestCase(TestCase):
self.assertEqual(
domain.get_xgettext_command(self.branch),
(['xgettext', '--files-from', 'POTFILES.in', '--directory',
'/home/claude/www/damned-lies/cvs/git/gnome-hello', '--from-code', 'utf-8',
os.path.join(settings.SCRATCHDIR, 'git', 'gnome-hello'),
'--from-code', 'utf-8',
'--add-comments', '--output', 'gnome-hello.pot', '--msgid-bugs-address',
'https://bugzilla.gnome.org/enter_bug.cgi?product=test&keywords=I18N+L10N&component=test'],
{'GETTEXTDATADIRS': os.path.dirname(utils.ITS_DATA_DIR)}
......@@ -177,9 +177,13 @@ class ModuleTestCase(TestCase):
self.assertEqual(it_po_stat.full_po, it_po_stat.part_po)
pot_doc_stat = Statistics.objects.get(branch=self.branch, domain__name='help', language=None)
self.assertEqual(pot_doc_stat.untranslated(), 43)
self.assertEqual(len(pot_doc_stat.full_po.figures), 2)
fr_doc_stat = Statistics.objects.get(branch=self.branch, domain__name='help', language__locale='fr')
self.assertEqual(fr_doc_stat.translated(), 41)
# Depending on the itstool version, the "GNOME Hello" string may or may
# not have a msgctxt marker. Allowing both here.
self.assertIn(fr_doc_stat.fuzzy(), [1, 2])
self.assertIn(fr_doc_stat.translated(), [41, 42])
self.assertEqual(len(pot_doc_stat.full_po.figures), len(fr_doc_stat.full_po.figures))
self.assertEqual(fr_doc_stat.po_url(), "/POT/gnome-hello.master/docs/gnome-hello-help.master.fr.po")
with self.assertRaises(Statistics.DoesNotExist):
......@@ -372,6 +376,12 @@ class ModuleTestCase(TestCase):
"""
domain = self.mod.domain_set.get(name='po')
commit_dir = self.branch.co_path
run_shell_command(
['git', 'config', 'user.name', 'John Doe'], cwd=commit_dir,
)
run_shell_command(
['git', 'config', 'user.email', 'john@example.org'], cwd=commit_dir,
)
run_shell_command(
['git', 'checkout', '-b', 'gnome-3-18', 'origin/master'], cwd=commit_dir, raise_on_error=True
)
......
......@@ -411,6 +411,7 @@ class VertimusTest(TeamsAndRolesTests):
)
)
@test_scratchdir
def test_action_ci_no_fullname(self):
"""
Test that a commit works even when nobody has full name, but without --author flag.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment