diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-03-31 14:18:44 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-04-04 09:17:47 +0000 |
commit | 54c4287b2832cadfbc3cb449027bcc4d1d91ab97 (patch) | |
tree | da00721a09dc25de845d17d8eb1bd905ed7cba88 | |
parent | a0e92167410f3de46deea526b8aaf27653e4f0f7 (diff) |
Add Coin CI instructions for Linux and macOS
The instructions create a python virtual environment,
install dependencies and run make test which runs
mypy, flake8, black and pytest on Linux and macOS
hosts.
The Windows instructions also work, except for the fact that make
fails to run on Windows because the Makefile contains
globs like *.py inside, which jom doesn't like.
That will be fixed later.
Change-Id: I930dacb979978e4781cb247e8d1adb4d4affcea9
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
-rw-r--r-- | coin/instructions/prepare_env.yaml | 97 | ||||
-rw-r--r-- | coin/module_config.yaml | 53 | ||||
-rw-r--r-- | dependencies.yaml | 2 |
3 files changed, 152 insertions, 0 deletions
diff --git a/coin/instructions/prepare_env.yaml b/coin/instructions/prepare_env.yaml new file mode 100644 index 0000000..daec4fe --- /dev/null +++ b/coin/instructions/prepare_env.yaml @@ -0,0 +1,97 @@ +type: Group +instructions: + # Set path separator based on host platform. + # \ on Windows (double \\ for escaping the backslash) + # / on UNIX + - type: EnvironmentVariable + variableName: CI_PATH_SEP + variableValue: "\\" + enable_if: + condition: property + property: host.os + equals_value: Windows + - type: EnvironmentVariable + variableName: CI_PATH_SEP + variableValue: "/" + disable_if: + condition: property + property: host.os + equals_value: Windows + + # Windows .exe suffix + - type: EnvironmentVariable + variableName: CI_EXECUTABLE_SUFFIX + variableValue: ".exe" + enable_if: + condition: property + property: host.os + equals_value: Windows + + # Find jom + - type: AppendToEnvironmentVariable + variableName: PATH + variableValue: ;%CI_JOM_PATH% + enable_if: + condition: property + property: host.os + equals_value: Windows + + # Adjust PATH to find appropriate Python 3 for macOS and Windows + - type: PrependToEnvironmentVariable + variableName: PATH + variableValue: "{{.Env.PYTHON3_PATH}}/bin:" + enable_if: + condition: property + property: host.os + equals_value: MacOS + - type: PrependToEnvironmentVariable + variableName: PATH + variableValue: "${PYTHON3.8.1-64_PATH};" + enable_if: + condition: property + property: host.os + equals_value: Windows + + # Set python executable name depending on host OS + - type: EnvironmentVariable + variableName: CI_PYTHON_EXECUTABLE + variableValue: "python.exe" + enable_if: + condition: property + property: host.os + equals_value: Windows + - type: EnvironmentVariable + variableName: CI_PYTHON_EXECUTABLE + variableValue: "python3.8" + enable_if: + condition: property + property: host.os + equals_value: Linux + - type: EnvironmentVariable + variableName: CI_PYTHON_EXECUTABLE + variableValue: "python3" + enable_if: + condition: property + property: host.os + equals_value: MacOS + + # Set make tool + - type: EnvironmentVariable + variableName: CI_MAKE_TOOL + variableValue: "jom" + enable_if: + condition: property + property: host.os + equals_value: Windows + - type: EnvironmentVariable + variableName: CI_MAKE_TOOL + variableValue: "make" + disable_if: + condition: property + property: host.os + equals_value: Windows + + # Clear the multiple -j flags, to avoid the make output being inter-leaved + - type: EnvironmentVariable + variableName: MAKEFLAGS + variableValue: "" diff --git a/coin/module_config.yaml b/coin/module_config.yaml new file mode 100644 index 0000000..c96ef2f --- /dev/null +++ b/coin/module_config.yaml @@ -0,0 +1,53 @@ +version: 2 +accept_configuration: + condition: property + property: features + not_contains_value: Disable + +instructions: + Build: + - !include "{{qt/qmake2cmake}}/prepare_env.yaml" + + # Create a virtual environment + - type: ExecuteCommand + command: "{{.Env.CI_PYTHON_EXECUTABLE}} -m venv env --prompt ci_env_qmake2cmake" + ignoreExitCode: false + maxTimeInSeconds: 7200 + maxTimeBetweenOutput: 900 + userMessageOnFailure: > + python3 -m venv env failed. + + # Add the virtualenv bin / Scripts dir to PATH, so the virtual env pip is used and + # also for make to find the tools it needs + - type: PrependToEnvironmentVariable + variableName: PATH + variableValue: "{{.BuildDir}}{{.Env.CI_PATH_SEP}}env{{.Env.CI_PATH_SEP}}bin:" + disable_if: + condition: property + property: host.os + equals_value: Windows + - type: PrependToEnvironmentVariable + variableName: PATH + variableValue: "{{.BuildDir}}{{.Env.CI_PATH_SEP}}env{{.Env.CI_PATH_SEP}}Scripts;" + enable_if: + condition: property + property: host.os + equals_value: Windows + + # Install dependencies + - type: ExecuteCommand + command: "pip{{.Env.CI_EXECUTABLE_SUFFIX}} install -r requirements.txt" + ignoreExitCode: false + maxTimeInSeconds: 7200 + maxTimeBetweenOutput: 900 + userMessageOnFailure: > + pip install requirements failed. + + # Run style checker, linter, tests + - type: ExecuteCommand + command: "{{.Env.CI_MAKE_TOOL}} test" + ignoreExitCode: false + maxTimeInSeconds: 7200 + maxTimeBetweenOutput: 900 + userMessageOnFailure: > + qmake2cmake make test failed. diff --git a/dependencies.yaml b/dependencies.yaml new file mode 100644 index 0000000..86cc401 --- /dev/null +++ b/dependencies.yaml @@ -0,0 +1,2 @@ +# Make sure we have an empty list of dependencies, so we don't trigger building Qt deps in CI +dependencies: {} |