Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 68 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,74 @@
version: 2
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/configuration-reference/#jobs
jobs:
build:
run-tests-with-bitrise-build-cache:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: us.gcr.io/livegrep/ci:11
- image: cimg/base:stable
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
- checkout
- run:
name: "Install Bazelisk"
command: |
sudo curl -Lo /usr/local/bin/bazelisk "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64"
sudo chmod +x /usr/local/bin/bazelisk
sudo ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
bazel --version
- run:
name: "Enable Build Cache for Bazel"
command: |
cat \<<EOF > ~/.bazelrc
build --remote_cache=grpcs://pluggable.services.bitrise.io
build --remote_header=x-org-id=$BITRISE_BUILD_CACHE_WORKSPACE_ID
build --remote_header=authorization="Bearer $BITRISE_BUILD_CACHE_AUTH_TOKEN"
build --remote_header=x-flare-buildtool=bazel
build --remote_header=x-flare-builduser=circleci
EOF
- run:
name: "bazel test //..."
command: |
bazel test //...
- run:
name: "bazel build //..."
command: |
bazel build //...

run-tests-without-build-cache:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/base:stable
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
- checkout
- restore_cache:
keys:
- bazel-cache
- run:
name: "Install Bazelisk"
command: |
sudo curl -Lo /usr/local/bin/bazelisk "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64"
sudo chmod +x /usr/local/bin/bazelisk
sudo ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
bazel --version
- run:
name: "bazel test //..."
command: |
bazel test //...
- run:
name: "bazel build //..."
command: |
bazel build //...

- run: ./.circleci/build.sh
- save_cache:
key: bazel-cache
paths:
- /root/.cache/bazel
# Orchestrate jobs using workflows
# See: https://circleci.com/docs/configuration-reference/#workflows
workflows:
tests:
jobs:
- run-tests-with-bitrise-build-cache
- run-tests-without-build-cache