1fd4e5da5Sopenharmony_ci#!/bin/bash
2fd4e5da5Sopenharmony_ci# Copyright (c) 2019 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# Linux 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_ciCC=clang
24fd4e5da5Sopenharmony_ciCXX=clang++
25fd4e5da5Sopenharmony_ciSRC=$PWD/github/SPIRV-Tools
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_cicd $SRC
33fd4e5da5Sopenharmony_ci/usr/bin/python3 utils/git-sync-deps --treeless
34fd4e5da5Sopenharmony_ci
35fd4e5da5Sopenharmony_ci# Get bazel 5.0.0
36fd4e5da5Sopenharmony_cigsutil cp gs://bazel/5.0.0/release/bazel-5.0.0-darwin-x86_64 .
37fd4e5da5Sopenharmony_cichmod +x bazel-5.0.0-darwin-x86_64
38fd4e5da5Sopenharmony_ci
39fd4e5da5Sopenharmony_ciecho $(date): Build everything...
40fd4e5da5Sopenharmony_ci./bazel-5.0.0-darwin-x86_64 build --cxxopt=-std=c++17 :all
41fd4e5da5Sopenharmony_ciecho $(date): Build completed.
42fd4e5da5Sopenharmony_ci
43fd4e5da5Sopenharmony_ciecho $(date): Starting bazel test...
44fd4e5da5Sopenharmony_ci./bazel-5.0.0-darwin-x86_64 test --cxxopt=-std=c++17 :all
45fd4e5da5Sopenharmony_ciecho $(date): Bazel test completed.
46