From 9785f582e816ff6e08b83ede14bd85a7afa356ce Mon Sep 17 00:00:00 2001 From: VSuryaprasad-HCL Date: Tue, 7 Jan 2025 06:33:57 +0000 Subject: [PATCH] Testsing pre-submit checks --- .github/workflows/ci.yml | 42 ++++++++++++++++++----- install_dependencies.sh | 74 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 8 deletions(-) create mode 100755 install_dependencies.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcd7b42..0716e5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,11 +7,37 @@ on: jobs: build: name: Bazel Build and Test - run: | - grep -r 'butter\|financial\|exchange\|stock\|market\|trading\|GCPTP\|CME\|bubble\|coarse-grained equalization\|CGE\|coarse' * - if [ $? -eq 0 ] - then - echo "Keyword Check Failed. Pl. check and fix it" - else - echo "Keyword check Passed." - fi + # We use Ubuntu 20.04 as it comes with GCC v9.3 by default. + runs-on: ubuntu-20.04 + env: + BAZEL_CACHE_USER: github + BAZEL_CACHE_PWD: ${{ secrets.BAZEL_CACHE_PWD }} + BAZEL_CACHE_URL: pins-bazel-cache.onf.dev:9090 + + steps: + - uses: actions/checkout@v2 + + - name: Mount bazel cache + uses: actions/cache@v2 + with: + # See https://docs.bazel.build/versions/master/output_directories.html + path: "/tmp/repo-cache" + # See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + key: bazel-repo-cache-v1-${{ runner.os }}-${{ hashFiles('**/*_deps.bzl', '.bazelrc', '.bazelversion', 'WORKSPACE.bazel') }} + restore-keys: | + bazel-repo-cache-v1-${{ runner.os }}- + + - name: Install system dependencies + run: ./install_dependencies.sh + + - name: Install bazelisk + run: | + ARCH=$(dpkg --print-architecture) + sudo curl -fsSL -o /usr/local/bin/bazel \ + https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-${ARCH} + sudo chmod +x /usr/local/bin/bazel + + # Authentication is enabled for R/W access for builds on main and branch PRs + # Unauthenticated reads are allowed for PRs from forks + - name: Build and Test + run: bazel build ... diff --git a/install_dependencies.sh b/install_dependencies.sh new file mode 100755 index 0000000..907aba7 --- /dev/null +++ b/install_dependencies.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# Copyright 2021 Google LLC +# +# Please read carefully before adding new dependencies: +# +# System dependencies are disallowed by default, and the bar for exceptions is +# high. +# +# pins-infra strives for a hermetic build, i.e. one that is insensitive to the +# libraries and other software installed on your machine, other than Bazel and +# the compilers. This ensure the build is reproducible and portable. +# +# Before adding a new system dependency, consider the following: +# +# 1. Please read the note on dependencies in pins_infra_deps.bzl. +# +# 2. Can the dependency be avoided altogether? Consider that there is a +# non-trival cost to maintaining dependencies over time. +# +# 3. Can the dependency be built with Bazel instead? +# - For many libraries, there are existing Bazel BUILD files. Try a quick +# Google search. +# - If there is no existing BUILD file, can you write your own BUILD file? +# See the bazel/ folder for examples. Ideally, we strive to upstream such +# BUILD files so everyone can benefit and share the maintenance burden. +# - If it's too hard to write a native BUILD file, try writing a BUILD file +# using rules_foreign_cc (https://github.com/bazelbuild/rules_foreign_cc). +#. See the bazel/ folder for examples. + +# Please read carefully before adding new dependencies: +# +# System dependencies are disallowed by default, and the bar for exceptions is +# high. +# +# pins-infra strives for a hermetic build, i.e. one that is insensitive to the +# libraries and other software installed on your machine, other than Bazel and +# the compilers. This ensure the build is reproducible and portable. +# +# Before adding a new system dependency, consider the following: +# +# 1. Please read the note on dependencies in pins_infra_deps.bzl. +# +# 2. Can the dependency be avoided altogether? Consider that there is a +# non-trival cost to maintaining dependencies over time. +# +# 3. Can the dependency be built with Bazel instead? +# - For many libraries, there are existing Bazel BUILD files. Try a quick +# Google search. +# - If there is no existing BUILD file, can you write your own BUILD file? +# See the bazel/ folder for examples. Ideally, we strive to upstream such +# BUILD files so everyone can benefit and share the maintenance burden. +# - If it's too hard to write a native BUILD file, try writing a BUILD file +# using rules_foreign_cc (https://github.com/bazelbuild/rules_foreign_cc). +#. See the bazel/ folder for examples. + +# TODO: Avoid system dependencies like libnl, currently these are +# coming because Sonic swss common depends on them. +sudo apt-get update +sudo apt-get install \ + bison \ + flex \ + libfl-dev \ + libgmp-dev \ + libhiredis-dev \ + libnl-3-dev \ + libnl-genl-3-dev \ + libnl-route-3-dev \ + libnl-nf-3-dev \ + libboost-dev \ + libboost-serialization-dev \ + libyang-dev \ + libzmq3-dev \ + uuid-dev \ + nlohmann-json3-dev