Giter Club home page Giter Club logo

bazel-examples's Introduction

bazel-examples

Bazel hello-world examples for C++, Go, Python, including custom toolchain setups for embedded C++ (KR260 and STM32 with ARM processors), pybind11 and gRPC server/clients running in various languages on Intel and/or ARM processors. The background and motiviation of this project can be found at bazel-discuss@.

Instructions

Download this repo

git clone https://github.com/thx123/bazel-examples.git
cd bazel-examples

Additional steps for MacOS

Ubuntu on Intel processors are supported out of the box. However, since not all C++ toolchains exist to cross-compile KR260 and STM32 targets from the MacOS, you'd have to run a docker container on Mac to build inside an Ubuntu image running on Intel processors.

  1. Start a long running container based on an multi-platform image that supports both Linux and MacOS:
docker run -itd -v $(realpath .):/home/builder/workspace --name bazel-examples thx123/ubuntu-with-bazelisk:latest

More information about the Docker image can be found at dockerhub.

  1. Connect to the container:
docker exec -it bazel-examples /bin/bash

Build and Test

To build and test:

bazel build //...
bazel test //...

Gitlab-Runner Integration

If your source code lives on a GitLab instance, the following can be added for CI/CD, e.g. e.g. in .gitlab-ci.yml:

stages:
  - build
  - test

.bazel-common:
  variables:
    GIT_SUBMODULE_STRATEGY: none
  before_script:
    - echo "Using ./bazel-common ..."

bazel-build:
  image:
    name: thx123/ubuntu-with-bazelisk:1.5
    entrypoint: [""]
  stage: build
  extends: .bazel-common
  script:
    - bazel --bazelrc=./cfg-bazel/bazelrc/gitlab-runner.aws.rc info
    - bazel --bazelrc=./cfg-bazel/bazelrc/gitlab-runner.aws.rc build //...

bazel-test:
  image:
    name: thx123/ubuntu-with-bazelisk:1.5
    entrypoint: [""]
  stage: test
  extends: .bazel-common
  script:
    - bazel --bazelrc=./cfg-bazel/bazelrc/gitlab-runner.aws.rc info
    - bazel --bazelrc=./cfg-bazel/bazelrc/gitlab-runner.aws.rc test //...

bazel-examples's People

Contributors

thx123 avatar

Stargazers

plops avatar Stanimir Mladenov avatar  avatar  avatar Bruno Romero de Azevedo avatar Diego Ortin avatar Filip Filmar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.