Merge pull request #6911 from mensinda/ciBionic

ci: Add Ubuntu Bionic image
This commit is contained in:
Jussi Pakkanen 2020-04-29 18:23:23 +03:00 committed by GitHub
commit 6e794c380b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 145 additions and 21 deletions

View File

@ -31,6 +31,7 @@ jobs:
- { name: CUDA (on Arch), id: cuda }
- { name: Fedora, id: fedora }
- { name: OpenSUSE, id: opensuse }
- { name: Ubuntu Bionic, id: bionic }
- { name: Ubuntu Eoan, id: eoan }
steps:
- uses: actions/checkout@v2

View File

@ -11,7 +11,7 @@ jobs:
name: Ubuntu 16.04
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Install Dependencies
run: |
sudo apt update -yq
@ -39,9 +39,10 @@ jobs:
- { name: CUDA (on Arch), id: cuda }
- { name: Fedora, id: fedora }
- { name: OpenSUSE, id: opensuse }
- { name: Ubuntu Bionic, id: bionic }
container: mesonbuild/${{ matrix.cfg.id }}:latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Run tests
# All environment variables are stored inside the docker image in /ci/env_vars.sh
# They are defined in the `env` section in each image.json. CI_ARGS should be set

View File

@ -0,0 +1,8 @@
{
"base_image": "ubuntu:bionic",
"env": {
"CI": "1",
"SKIP_SCIENTIFIC": "1",
"DC": "gdc"
}
}

58
ci/ciimage/bionic/install.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
set -e
export DEBIAN_FRONTEND=noninteractive
export LANG='C.UTF-8'
export DC=gdc
pkgs=(
python3-pytest-xdist
python3-pip libxml2-dev libxslt1-dev libyaml-dev libjson-glib-dev
wget unzip cmake doxygen
clang
pkg-config-arm-linux-gnueabihf
qt4-linguist-tools qt5-default qtbase5-private-dev
python-dev
libomp-dev
ldc
libclang-dev
libgcrypt20-dev
libgpgme-dev
libhdf5-dev openssh-server
libboost-python-dev libboost-regex-dev
libblocksruntime-dev
libperl-dev libscalapack-mpi-dev libncurses-dev
)
boost_pkgs=(atomic chrono date-time filesystem log regex serialization system test thread)
sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
apt-get -y update
apt-get -y upgrade
apt-get -y install eatmydata
# Base stuff
eatmydata apt-get -y build-dep meson
# Add boost packages
for i in "${boost_pkgs[@]}"; do
for j in "1.62.0" "1.65.1"; do
pkgs+=("libboost-${i}${j}")
done
done
# packages
eatmydata apt-get -y install "${pkgs[@]}"
eatmydata python3 -m pip install codecov jsonschema
# Install the ninja 0.10
wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
unzip ninja-linux.zip -d /ci
# cleanup
apt-get -y remove ninja-build
apt-get -y clean
apt-get -y autoclean
rm ninja-linux.zip

View File

@ -71,6 +71,9 @@ class Builder(BuilderBase):
for key, val in self.image_def.env.items():
out_data += f'export {key}="{val}"\n'
# Also add /ci to PATH
out_data += 'export PATH="/ci:$PATH"\n'
out_file.write_text(out_data)
# make it executable
@ -157,7 +160,7 @@ class ImageTester(BuilderBase):
test_cmd = [
self.docker, 'run', '--rm', '-t', 'meson_test_image',
'/usr/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py $CI_ARGS'
'/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py $CI_ARGS'
]
if subprocess.run(test_cmd).returncode != 0:
raise RuntimeError('Running tests failed')

View File

@ -17,7 +17,7 @@ pkgs=(
libxml2-devel libxslt-devel libyaml-devel glib2-devel json-glib-devel
boost-devel libboost_date_time-devel libboost_filesystem-devel libboost_locale-devel libboost_system-devel
libboost_test-devel libboost_log-devel libboost_regex-devel
libboost_python-py3-1_71_0-devel libboost_regex-devel
libboost_python3-devel libboost_regex-devel
)
# Sys update

View File

@ -174,7 +174,7 @@ contents of an additional file into the CI log on failure.
Projects needed by unit tests are in the `test cases/unit`
subdirectory. They are not run as part of `./run_project_tests.py`.
#### Configuring project tests
### Configuring project tests
The (optional) `test.json` file, in the root of a test case, is used
for configuring the test. All of the following root entries in the `test.json`
@ -209,17 +209,20 @@ Exanple `test.json`:
{ "opt1": "qwert", "opt2": "false" },
{ "opt1": "bad" }
]
},
"tools": {
"cmake": ">=3.11"
}
}
```
##### env
#### env
The `env` key contains a dictionary which specifies additional
environment variables to be set during the configure step of the test. `@ROOT@`
is replaced with the absolute path of the source directory.
##### installed
#### installed
The `installed` dict contains a list of dicts, describing which files are expected
to be installed. Each dict contains the following keys:
@ -277,7 +280,7 @@ the platform matches. The following values for `platform` are currently supporte
| `cygwin` | Matches when the platform is cygwin |
| `!cygwin` | Not `cygwin` |
##### matrix
#### matrix
The `matrix` section can be used to define a test matrix to run project tests
with different meson options.
@ -318,12 +321,19 @@ The above example will produce the following matrix entries:
- `opt1=qwert`
- `opt1=qwert opt2=true`
##### do_not_set_opts
#### do_not_set_opts
Currently supported values are:
- `prefix`
- `libdir`
#### tools
This section specifies a list of tool requirements in a simple key-value format.
If a tool is specified, it has to be present in the environment, and the version
requirement must be fulfilled match. Otherwise, the entire test is skipped
(including every element in the test matrix).
### Skipping integration tests
Meson uses several continuous integration testing systems that have slightly

View File

@ -190,7 +190,7 @@ class TestDef:
self.skip = skip
self.env = os.environ.copy()
self.installed_files = [] # type: T.List[InstalledFile]
self.do_not_set_opts = [] # type: T.List[str]
self.do_not_set_opts = [] # type: T.List[str]
def __repr__(self) -> str:
return '<{}: {:<48} [{}: {}] -- {}>'.format(type(self).__name__, str(self.path), self.name, self.args, self.skip)
@ -233,6 +233,7 @@ no_meson_log_msg = 'No meson-log.txt found.'
system_compiler = None
compiler_id_map = {} # type: T.Dict[str, str]
tool_vers_map = {} # type: T.Dict[str, str]
class StopException(Exception):
def __init__(self):
@ -568,6 +569,15 @@ def gather_tests(testdir: Path) -> T.List[TestDef]:
# Handle the do_not_set_opts list
do_not_set_opts = test_def.get('do_not_set_opts', []) # type: T.List[str]
# Skip tests if the tool requirements are not met
if 'tools' in test_def:
assert isinstance(test_def['tools'], dict)
for tool, vers_req in test_def['tools'].items():
if tool not in tool_vers_map:
t.skip = True
elif not mesonlib.version_compare(tool_vers_map[tool], vers_req):
t.skip = True
# Skip the matrix code and just update the existing test
if 'matrix' not in test_def:
t.env.update(env)
@ -639,7 +649,7 @@ def gather_tests(testdir: Path) -> T.List[TestDef]:
name = ' '.join([x[0] for x in i if x[0] is not None])
opts = ['-D' + x[0] for x in i if x[0] is not None]
skip = any([x[1] for x in i])
test = TestDef(t.path, name, opts, skip)
test = TestDef(t.path, name, opts, skip or t.skip)
test.env.update(env)
test.installed_files = installed
test.do_not_set_opts = do_not_set_opts
@ -1102,12 +1112,24 @@ def detect_system_compiler(options):
def print_tool_versions():
tools = [
{
'tool': 'ninja',
'args': ['--version'],
'regex': re.compile(r'^([0-9]+(\.[0-9]+)*(-[a-z0-9]+)?)$'),
'match_group': 1,
},
{
'tool': 'cmake',
'args': ['--version'],
'regex': re.compile(r'^cmake version ([0-9]+(\.[0-9]+)*(-[a-z0-9]+)?)$'),
'match_group': 1,
},
{
'tool': 'hotdoc',
'args': ['--version'],
'regex': re.compile(r'^([0-9]+(\.[0-9]+)*(-[a-z0-9]+)?)$'),
'match_group': 1,
},
]
def get_version(t: dict) -> str:
@ -1123,6 +1145,7 @@ def print_tool_versions():
i = i.strip('\n\r\t ')
m = t['regex'].match(i)
if m is not None:
tool_vers_map[t['tool']] = m.group(t['match_group'])
return '{} ({})'.format(exe, m.group(t['match_group']))
return '{} (unknown)'.format(exe)

View File

@ -4,5 +4,8 @@
{"type": "implib", "platform": "cygwin", "file": "usr/lib/libcm_cmModLib"},
{"type": "implib", "platform": "!cygwin", "file": "usr/bin/libcm_cmModLib"},
{"type": "exe", "file": "usr/bin/cm_testEXE"}
]
],
"tools": {
"cmake": ">=3.11"
}
}

View File

@ -8,5 +8,8 @@
{"type": "exe", "file": "usr/bin/cm_testEXE"},
{"type": "pdb", "file": "usr/bin/cm_testEXE2"},
{"type": "exe", "file": "usr/bin/cm_testEXE2"}
]
],
"tools": {
"cmake": ">=3.11"
}
}

View File

@ -314,5 +314,8 @@
{"type": "file", "file": "usr/share/doc/foobar/html/assets/fonts/dumped.trie"},
{"type": "file", "file": "usr/share/doc/foobar/html/assets/images/home.svg"},
{"type": "file", "file": "usr/share/doc/foobar/html/assets/images/dumped.trie"}
]
],
"tools": {
"hotdoc": ">=0.1.0"
}
}

View File

@ -0,0 +1,6 @@
#!/bin/bash
VERS=$(cmake --version | grep "cmake version")
VERS=${VERS//cmake version/}
echo -n $VERS

View File

@ -6,6 +6,9 @@ if not find_program('cmake', required: false).found()
error('MESON_SKIP_TEST cmake binary not available.')
endif
# CMake version
cm_vers = run_command(find_program('./cmVers.sh')).stdout().strip()
# Zlib is probably on all dev machines.
dep = dependency('ZLIB', version : '>=1.2', method : 'cmake')
@ -48,14 +51,16 @@ depm1 = dependency('SomethingLikeZLIB', required : true, components : 'required_
depm2 = dependency('SomethingLikeZLIB', required : true, components : 'required_comp', method : 'cmake', cmake_module_path : ['cmake'])
depm3 = dependency('SomethingLikeZLIB', required : true, components : ['required_comp'], cmake_module_path : 'cmake')
# Test some edge cases with spaces, etc.
# Test some edge cases with spaces, etc. (but only for CMake >= 3.15)
testDep1 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'mesonTestLibDefs')
testDep2 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules : ['MesonTest::TestLibDefs'])
testFlagSet1 = executable('testFlagSet1', ['testFlagSet.c'], dependencies: [testDep1])
testFlagSet2 = executable('testFlagSet2', ['testFlagSet.c'], dependencies: [testDep2])
test('testFlagSetTest1', testFlagSet1)
test('testFlagSetTest2', testFlagSet2)
if cm_vers.version_compare('>=3.15')
testDep1 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'mesonTestLibDefs')
testDep2 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules : ['MesonTest::TestLibDefs'])
testFlagSet1 = executable('testFlagSet1', ['testFlagSet.c'], dependencies: [testDep1])
testFlagSet2 = executable('testFlagSet2', ['testFlagSet.c'], dependencies: [testDep2])
test('testFlagSetTest1', testFlagSet1)
test('testFlagSetTest2', testFlagSet2)
endif
# Try to compile a test that takes a dep and an include_directories