diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-04-29 18:23:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 18:23:23 +0300 |
commit | 6e794c380ba2febe67f563c3388797b8b4482f82 (patch) | |
tree | eacb4e6f629d7292d9e22825be10f915b3f9ca10 | |
parent | 1cf7f40e8542acf3b65ec18e1414edb65113fe42 (diff) | |
parent | eefc7d450c7839db63df2d8a6e4bcc991205a058 (diff) | |
download | meson-6e794c380ba2febe67f563c3388797b8b4482f82.zip meson-6e794c380ba2febe67f563c3388797b8b4482f82.tar.gz meson-6e794c380ba2febe67f563c3388797b8b4482f82.tar.bz2 |
Merge pull request #6911 from mensinda/ciBionic
ci: Add Ubuntu Bionic image
-rw-r--r-- | .github/workflows/images.yml | 1 | ||||
-rw-r--r-- | .github/workflows/os_comp.yml | 5 | ||||
-rw-r--r-- | ci/ciimage/bionic/image.json | 8 | ||||
-rwxr-xr-x | ci/ciimage/bionic/install.sh | 58 | ||||
-rwxr-xr-x | ci/ciimage/build.py | 5 | ||||
-rwxr-xr-x | ci/ciimage/opensuse/install.sh | 2 | ||||
-rw-r--r-- | docs/markdown/Contributing.md | 20 | ||||
-rwxr-xr-x | run_project_tests.py | 27 | ||||
-rw-r--r-- | test cases/cmake/2 advanced/test.json | 5 | ||||
-rw-r--r-- | test cases/cmake/3 advanced no dep/test.json | 5 | ||||
-rw-r--r-- | test cases/frameworks/23 hotdoc/test.json | 5 | ||||
-rwxr-xr-x | test cases/linuxlike/13 cmake dependency/cmVers.sh | 6 | ||||
-rw-r--r-- | test cases/linuxlike/13 cmake dependency/meson.build | 19 |
13 files changed, 145 insertions, 21 deletions
diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index bde2223..0cf9156 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -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 diff --git a/.github/workflows/os_comp.yml b/.github/workflows/os_comp.yml index 7f3437e..a5abf7d 100644 --- a/.github/workflows/os_comp.yml +++ b/.github/workflows/os_comp.yml @@ -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 diff --git a/ci/ciimage/bionic/image.json b/ci/ciimage/bionic/image.json new file mode 100644 index 0000000..6a3d723 --- /dev/null +++ b/ci/ciimage/bionic/image.json @@ -0,0 +1,8 @@ +{ + "base_image": "ubuntu:bionic", + "env": { + "CI": "1", + "SKIP_SCIENTIFIC": "1", + "DC": "gdc" + } +} diff --git a/ci/ciimage/bionic/install.sh b/ci/ciimage/bionic/install.sh new file mode 100755 index 0000000..47deb2a --- /dev/null +++ b/ci/ciimage/bionic/install.sh @@ -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 diff --git a/ci/ciimage/build.py b/ci/ciimage/build.py index 34a92fa..e623a7e 100755 --- a/ci/ciimage/build.py +++ b/ci/ciimage/build.py @@ -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') diff --git a/ci/ciimage/opensuse/install.sh b/ci/ciimage/opensuse/install.sh index 7c90ec3..b9e440d 100755 --- a/ci/ciimage/opensuse/install.sh +++ b/ci/ciimage/opensuse/install.sh @@ -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 diff --git a/docs/markdown/Contributing.md b/docs/markdown/Contributing.md index 5332938..8a24e0b 100644 --- a/docs/markdown/Contributing.md +++ b/docs/markdown/Contributing.md @@ -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 diff --git a/run_project_tests.py b/run_project_tests.py index 875a522..8cbf989 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -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 @@ -1103,11 +1113,23 @@ 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) diff --git a/test cases/cmake/2 advanced/test.json b/test cases/cmake/2 advanced/test.json index 11aad94..e12f530 100644 --- a/test cases/cmake/2 advanced/test.json +++ b/test cases/cmake/2 advanced/test.json @@ -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" + } } diff --git a/test cases/cmake/3 advanced no dep/test.json b/test cases/cmake/3 advanced no dep/test.json index 24c89c4..98a1719 100644 --- a/test cases/cmake/3 advanced no dep/test.json +++ b/test cases/cmake/3 advanced no dep/test.json @@ -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" + } } diff --git a/test cases/frameworks/23 hotdoc/test.json b/test cases/frameworks/23 hotdoc/test.json index e2d4992..8dd07e0 100644 --- a/test cases/frameworks/23 hotdoc/test.json +++ b/test cases/frameworks/23 hotdoc/test.json @@ -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" + } } diff --git a/test cases/linuxlike/13 cmake dependency/cmVers.sh b/test cases/linuxlike/13 cmake dependency/cmVers.sh new file mode 100755 index 0000000..70809de --- /dev/null +++ b/test cases/linuxlike/13 cmake dependency/cmVers.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +VERS=$(cmake --version | grep "cmake version") +VERS=${VERS//cmake version/} + +echo -n $VERS diff --git a/test cases/linuxlike/13 cmake dependency/meson.build b/test cases/linuxlike/13 cmake dependency/meson.build index 79acc83..93824ab 100644 --- a/test cases/linuxlike/13 cmake dependency/meson.build +++ b/test cases/linuxlike/13 cmake dependency/meson.build @@ -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 |