aboutsummaryrefslogtreecommitdiff
path: root/infra/ci
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-11 05:09:55 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-11 05:09:55 +0000
commit25ab32037e9f68384964b20f678dc75c4184bf24 (patch)
treeaab00ff7a7202a49d2afaa9084f260c2e519653b /infra/ci
parent8dd31c7112ba7b07fcafe02c83dc9ef3808cdab7 (diff)
parent964a594e4219fae93e07d1546c905a01e3bf8e3e (diff)
downloadoss-fuzz-aml_net_331412000.tar.gz
Change-Id: I80a4ac7c1910948d2da016ba661e9b715e51402f
Diffstat (limited to 'infra/ci')
-rwxr-xr-xinfra/ci/build.py20
-rw-r--r--infra/ci/requirements.txt2
2 files changed, 16 insertions, 6 deletions
diff --git a/infra/ci/build.py b/infra/ci/build.py
index addeb7879..7a02d6001 100755
--- a/infra/ci/build.py
+++ b/infra/ci/build.py
@@ -25,20 +25,22 @@ import sys
import subprocess
import yaml
+# pylint: disable=wrong-import-position,import-error
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import constants
+
CANARY_PROJECT = 'skcms'
DEFAULT_ARCHITECTURES = ['x86_64']
DEFAULT_ENGINES = ['afl', 'honggfuzz', 'libfuzzer']
DEFAULT_SANITIZERS = ['address', 'undefined']
-# Languages from project.yaml that have code coverage support.
-LANGUAGES_WITH_COVERAGE_SUPPORT = ['c', 'c++', 'go', 'rust']
-
def get_changed_files_output():
"""Returns the output of a git command that discovers changed files."""
branch_commit_hash = subprocess.check_output(
- ['git', 'merge-base', 'FETCH_HEAD', 'origin/HEAD']).strip().decode()
+ ['git', 'merge-base', 'HEAD', 'origin/HEAD']).strip().decode()
return subprocess.check_output(
['git', 'diff', '--name-only', branch_commit_hash + '..']).decode()
@@ -112,7 +114,7 @@ def should_build_coverage(project_yaml):
return False
language = project_yaml.get('language')
- if language not in LANGUAGES_WITH_COVERAGE_SUPPORT:
+ if language not in constants.LANGUAGES_WITH_COVERAGE_SUPPORT:
print(('Project is written in "{language}", '
'coverage is not supported yet.').format(language=language))
return False
@@ -213,11 +215,16 @@ def build_base_images():
images = [
'base-image',
'base-builder',
+ 'base-builder-go',
+ 'base-builder-jvm',
+ 'base-builder-python',
+ 'base-builder-rust',
+ 'base-builder-swift',
'base-runner',
]
for image in images:
try:
- execute_helper_command(['build_image', image, '--no-pull'])
+ execute_helper_command(['build_image', image, '--no-pull', '--cache'])
except subprocess.CalledProcessError:
return 1
@@ -239,6 +246,7 @@ def build_canary_project():
def main():
"""Build modified projects or canary project."""
+ os.environ['OSS_FUZZ_CI'] = '1'
infra_changed = is_infra_changed()
if infra_changed:
print('Pulling and building base images first.')
diff --git a/infra/ci/requirements.txt b/infra/ci/requirements.txt
index f0a8be0b5..310ba53e8 100644
--- a/infra/ci/requirements.txt
+++ b/infra/ci/requirements.txt
@@ -6,3 +6,5 @@ pytest==6.2.1
pytest-xdist==2.2.0
PyYAML==5.4
yapf==0.30.0
+# Needed for cifuzz tests.
+Jinja2==2.11.3