Skip to content

Commit 813ee46

Browse files
committed
Run macOS jobs on GHA when neither Travis nor AZP are enabled
1 parent 1e57056 commit 813ee46

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

bincrafters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.29.4'
1+
__version__ = '0.30.0'

bincrafters/generate_ci_jobs.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
from bincrafters.utils import *
88

99

10+
def _run_macos_jobs_on_gha():
11+
if utils_file_contains("azure-pipelines.yml", "name: bincrafters/templates")\
12+
and utils_file_contains("azure-pipelines.yml", "template: .ci/azure.yml@templates"):
13+
return False
14+
15+
if utils_file_contains(".travis.yml", "import: bincrafters/templates:.ci/travis"):
16+
return False
17+
18+
return True
19+
20+
1021
def generate_ci_jobs(platform: str, recipe_type: str = autodetect(), split_by_build_types: bool = False) -> str:
1122
if platform != "gha" and platform != "azp":
1223
return ""
@@ -19,6 +30,7 @@ def generate_ci_jobs(platform: str, recipe_type: str = autodetect(), split_by_bu
1930
split_by_build_types = get_bool_from_env("BPT_SPLIT_BY_BUILD_TYPES", get_bool_from_env("splitByBuildTypes", False))
2031

2132
if platform == "gha":
33+
run_macos = _run_macos_jobs_on_gha()
2234
if recipe_type == "installer":
2335
matrix["config"] = [
2436
{"name": "Installer Linux", "compiler": "GCC", "version": "7", "os": "ubuntu-18.04", "dockerImage": "conanio/gcc7-centos6"},
@@ -62,12 +74,25 @@ def generate_ci_jobs(platform: str, recipe_type: str = autodetect(), split_by_bu
6274
{"name": "CLANG 9 Debug", "compiler": "CLANG", "version": "9", "os": "ubuntu-18.04", "buildType": "Debug"},
6375
{"name": "CLANG 9 Release", "compiler": "CLANG", "version": "9", "os": "ubuntu-18.04", "buildType": "Release"}
6476
]
77+
if run_macos:
78+
matrix["config"] += [
79+
{"name": "macOS Apple-Clang 10 Release", "compiler": "APPLE_CLANG", "version": "10.0", "os": "macOS-10.14", "buildType": "Release"},
80+
{"name": "macOS Apple-Clang 10 Debug", "compiler": "APPLE_CLANG", "version": "10.0", "os": "macOS-10.14", "buildType": "Debug"},
81+
{"name": "macOS Apple-Clang 11 Release", "compiler": "APPLE_CLANG", "version": "11.0", "os": "macOS-10.15", "buildType": "Release"},
82+
{"name": "macOS Apple-Clang 11 Debug", "compiler": "APPLE_CLANG", "version": "11.0", "os": "macOS-10.15", "buildType": "Debug"},
83+
]
6584
matrix_minimal["config"] = [
6685
{"name": "GCC 7 Debug", "compiler": "GCC", "version": "7", "os": "ubuntu-18.04", "buildType": "Debug"},
6786
{"name": "GCC 7 Release", "compiler": "GCC", "version": "7", "os": "ubuntu-18.04", "buildType": "Release"},
6887
{"name": "CLANG 8 Debug", "compiler": "CLANG", "version": "8", "os": "ubuntu-18.04", "buildType": "Debug"},
6988
{"name": "CLANG 8 Release", "compiler": "CLANG", "version": "8", "os": "ubuntu-18.04", "buildType": "Release"},
7089
]
90+
if run_macos:
91+
matrix_minimal["config"] += [
92+
{"name": "macOS Apple-Clang 11 Debug", "compiler": "APPLE_CLANG", "version": "11.0", "os": "macOS-10.15", "buildType": "Debug"},
93+
{"name": "macOS Apple-Clang 11 Release", "compiler": "APPLE_CLANG", "version": "11.0", "os": "macOS-10.15", "buildType": "Release"},
94+
]
95+
7196
else:
7297
matrix["config"] = [
7398
{"name": "GCC 4.9", "compiler": "GCC", "version": "4.9", "os": "ubuntu-18.04"},
@@ -84,10 +109,19 @@ def generate_ci_jobs(platform: str, recipe_type: str = autodetect(), split_by_bu
84109
{"name": "CLANG 8", "compiler": "CLANG", "version": "8", "os": "ubuntu-18.04"},
85110
{"name": "CLANG 9", "compiler": "CLANG", "version": "9", "os": "ubuntu-18.04"},
86111
]
112+
if run_macos:
113+
matrix["config"] += [
114+
{"name": "macOS Apple-Clang 10", "compiler": "APPLE_CLANG", "version": "10.0", "os": "macOS-10.14"},
115+
{"name": "macOS Apple-Clang 11", "compiler": "APPLE_CLANG", "version": "11.0", "os": "macOS-10.15"},
116+
]
87117
matrix_minimal["config"] = [
88118
{"name": "GCC 7", "compiler": "GCC", "version": "7", "os": "ubuntu-18.04"},
89119
{"name": "CLANG 8", "compiler": "CLANG", "version": "8", "os": "ubuntu-18.04"},
90120
]
121+
if run_macos:
122+
matrix_minimal["config"] += [
123+
{"name": "macOS Apple-Clang 11", "compiler": "APPLE_CLANG", "version": "11.0", "os": "macOS-10.15"},
124+
]
91125
elif platform == "azp":
92126
if split_by_build_types:
93127
matrix["config"] = [

bincrafters/utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,19 @@ def utils_git_get_changed_dirs(base: str, head: str = None) -> list:
4747
remove_newlines=False)
4848

4949
return dirs.splitlines()
50+
51+
52+
def utils_file_contains(file, word):
53+
""" Read file and search for word
54+
55+
:param file: File path to be read
56+
:param word: word to be found
57+
:return: True if found. Otherwise, False
58+
"""
59+
if os.path.isfile(file):
60+
with open(file) as ifd:
61+
content = ifd.read()
62+
if word in content:
63+
return True
64+
return False
65+

0 commit comments

Comments
 (0)