1fd4e5da5Sopenharmony_ci#!/bin/bash 2fd4e5da5Sopenharmony_ci# Copyright (c) 2018 Google LLC. 3fd4e5da5Sopenharmony_ci# 4fd4e5da5Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 5fd4e5da5Sopenharmony_ci# you may not use this file except in compliance with the License. 6fd4e5da5Sopenharmony_ci# You may obtain a copy of the License at 7fd4e5da5Sopenharmony_ci# 8fd4e5da5Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 9fd4e5da5Sopenharmony_ci# 10fd4e5da5Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 11fd4e5da5Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 12fd4e5da5Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13fd4e5da5Sopenharmony_ci# See the License for the specific language governing permissions and 14fd4e5da5Sopenharmony_ci# limitations under the License. 15fd4e5da5Sopenharmony_ci# 16fd4e5da5Sopenharmony_ci# MacOS Build Script. 17fd4e5da5Sopenharmony_ci 18fd4e5da5Sopenharmony_ci# Fail on any error. 19fd4e5da5Sopenharmony_ciset -e 20fd4e5da5Sopenharmony_ci# Display commands being run. 21fd4e5da5Sopenharmony_ciset -x 22fd4e5da5Sopenharmony_ci 23fd4e5da5Sopenharmony_ciBUILD_ROOT=$PWD 24fd4e5da5Sopenharmony_ciSRC=$PWD/github/SPIRV-Tools 25fd4e5da5Sopenharmony_ciBUILD_TYPE=$1 26fd4e5da5Sopenharmony_ci 27fd4e5da5Sopenharmony_ci# This is required to run any git command in the docker since owner will 28fd4e5da5Sopenharmony_ci# have changed between the clone environment, and the docker container. 29fd4e5da5Sopenharmony_ci# Marking the root of the repo as safe for ownership changes. 30fd4e5da5Sopenharmony_cigit config --global --add safe.directory $SRC 31fd4e5da5Sopenharmony_ci 32fd4e5da5Sopenharmony_ci# Get NINJA. 33fd4e5da5Sopenharmony_ciwget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip 34fd4e5da5Sopenharmony_ciunzip -q ninja-mac.zip 35fd4e5da5Sopenharmony_cichmod +x ninja 36fd4e5da5Sopenharmony_ciexport PATH="$PWD:$PATH" 37fd4e5da5Sopenharmony_ci 38fd4e5da5Sopenharmony_cicd $SRC 39fd4e5da5Sopenharmony_cipython3 utils/git-sync-deps --treeless 40fd4e5da5Sopenharmony_ci 41fd4e5da5Sopenharmony_cimkdir build && cd $SRC/build 42fd4e5da5Sopenharmony_ci 43fd4e5da5Sopenharmony_ci# Invoke the build. 44fd4e5da5Sopenharmony_ciBUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} 45fd4e5da5Sopenharmony_ciecho $(date): Starting build... 46fd4e5da5Sopenharmony_cicmake \ 47fd4e5da5Sopenharmony_ci -GNinja \ 48fd4e5da5Sopenharmony_ci -DCMAKE_INSTALL_PREFIX=$KOKORO_ARTIFACTS_DIR/install \ 49fd4e5da5Sopenharmony_ci -DCMAKE_C_COMPILER=clang \ 50fd4e5da5Sopenharmony_ci -DCMAKE_CXX_COMPILER=clang++ \ 51fd4e5da5Sopenharmony_ci -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 52fd4e5da5Sopenharmony_ci -DSPIRV_BUILD_FUZZER=ON \ 53fd4e5da5Sopenharmony_ci .. 54fd4e5da5Sopenharmony_ci 55fd4e5da5Sopenharmony_ciecho $(date): Build everything... 56fd4e5da5Sopenharmony_cininja 57fd4e5da5Sopenharmony_ciecho $(date): Build completed. 58fd4e5da5Sopenharmony_ci 59fd4e5da5Sopenharmony_ciecho $(date): Starting ctest... 60fd4e5da5Sopenharmony_cictest -j4 --output-on-failure --timeout 300 61fd4e5da5Sopenharmony_ciecho $(date): ctest completed. 62fd4e5da5Sopenharmony_ci 63fd4e5da5Sopenharmony_ci# Package the build. 64fd4e5da5Sopenharmony_cininja install 65fd4e5da5Sopenharmony_cicd $KOKORO_ARTIFACTS_DIR 66fd4e5da5Sopenharmony_citar czf install.tgz install 67fd4e5da5Sopenharmony_ci 68