Skip to content

Support remote build execution on main and read-only remote cache on PRs #3820

Support remote build execution on main and read-only remote cache on PRs

Support remote build execution on main and read-only remote cache on PRs #3820

Workflow file for this run

name: CI
# Controls when the workflow will run.
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
nativelink-dot-com-build-on-main-test:
runs-on: ubuntu-22.04
environment: production
env:
NL_COM_API_KEY: ${{ secrets.NATIVELINK_COM_API_HEADER || '065f02f53f26a12331d5cfd00a778fb243bfb4e857b8fcd4c99273edfb15deae' }}
NL_COM_RO_FLAGS: ${{ github.ref == 'refs/heads/main' && ' ' || '--nogenerate_json_trace_profile --remote_upload_local_results=false' }}
NL_COM_RE_FLAGS: ${{ github.ref == 'refs/heads/main' && '--remote_executor=grpcs://scheduler-tracemachina-shared.build-faster.nativelink.net:443 --remote_default_exec_properties=container-image=docker://default' || ' ' }}
steps:
- name: Checkout
uses: >- # v4.1.1
actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Bazelisk
uses: >- # v0.8.1
bazel-contrib/setup-bazel@b388b84bb637e50cdae241d0f255670d4bd79f29
with:
bazelisk-cache: true
- name: Run Bazel tests
shell: bash
run: |
bazel test \
--remote_cache=grpcs://cas-tracemachina-shared.build-faster.nativelink.net \
--remote_header=x-nativelink-api-key=${NL_COM_API_KEY} \
--remote_instance_name=main \
--bes_backend=grpcs://bes-tracemachina-shared.build-faster.nativelink.net \
--bes_header=x-nativelink-api-key=${NL_COM_API_KEY} \
--bes_results_url=https://app.nativelink.com/a/e3b1e0e0-4b73-45d6-85bc-5cb7b02edea5/build \
--remote_header=x-nativelink-project=nativelink-ci \
${NL_COM_RE_FLAGS} \
${NL_COM_RO_FLAGS} \
//...
nativelink-dot-com-rbe-test:
runs-on: ubuntu-22.04
environment: production
steps:
- name: Checkout
uses: >- # v4.1.1
actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Bazelisk
uses: >- # v0.8.1
bazel-contrib/setup-bazel@b388b84bb637e50cdae241d0f255670d4bd79f29
with:
bazelisk-cache: true
- name: Run Bazel tests
shell: bash
run: |
bazel test \
--remote_cache=grpcs://cas-bclark8923-d21fad.build-faster.nativelink.net \
--remote_header=x-nativelink-api-key=05929e1fb5253a96df099dbdd41a6304b4c9feef9fecfdbdcbbb02f105600053 \
--remote_instance_name=main \
--bes_backend=grpcs://bes-bclark8923-d21fad.build-faster.nativelink.net \
--bes_header=x-nativelink-api-key=05929e1fb5253a96df099dbdd41a6304b4c9feef9fecfdbdcbbb02f105600053 \
--bes_results_url=https://app.nativelink.com/a/bclark8923/build \
--remote_header=x-nativelink-project=nativelink-ci \
--remote_executor=grpcs://scheduler-bclark8923-d21fad.build-faster.nativelink.net:443 \
--remote_default_exec_properties=container-image=docker://default \
//...
docker-compose-compiles-nativelink:
# The type of runner that the job will run on.
runs-on: ubuntu-22.04
strategy:
matrix:
# Which OS versions we will test on.
os_version: [ 22.04 ]
steps:
- name: Checkout
uses: >- # v4.1.1
actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Docker Buildx
uses: >- # v3.2.0
docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20
- name: Build Nativelink image
uses: >- # v5.3.0
docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
file: ./deployment-examples/docker-compose/Dockerfile
build-args: |
OPT_LEVEL=opt
OS_VERSION=${{ matrix.os_version }}
ADDITIONAL_SETUP_WORKER_CMD=apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gcc g++ lld pkg-config python3
load: true # This brings the build into `docker images` from buildx.
tags: trace_machina/nativelink:latest
- name: Build builder image
uses: >- # v5.3.0
docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
file: ./deployment-examples/docker-compose/Dockerfile
build-args: |
OPT_LEVEL=opt
OS_VERSION=${{ matrix.os_version }}
load: true # This brings the build into `docker images` from buildx.
tags: trace_machina/nativelink:builder
target: builder
- name: Compile NativeLink with NativeLink
run: |
mkdir -p ~/.cache && \
cd deployment-examples/docker-compose && \
(docker-compose up -d || docker compose up -d) && \
cd ../../ && \
docker run --rm --net=host -w /root/nativelink -v $PWD:/root/nativelink trace_machina/nativelink:builder sh -c ' \
bazel clean && \
bazel test //... \
--remote_instance_name=main \
--remote_cache=grpc://127.0.0.1:50051 \
--remote_executor=grpc://127.0.0.1:50052 \
--remote_default_exec_properties=cpu_count=1 \
' && \
docker run --rm --net=host -w /root/nativelink -v $PWD:/root/nativelink trace_machina/nativelink:builder sh -c ' \
bazel clean && \
bazel test //... \
--remote_instance_name=main \
--remote_cache=grpc://127.0.0.1:50051 \
--remote_executor=grpc://127.0.0.1:50052 \
--remote_default_exec_properties=cpu_count=1 \
' 2>&1 | ( ! grep ' PASSED in ' ) # If we get PASSED without (cache) it means there's a cache issue.
integration-tests:
runs-on: ubuntu-22.04
strategy:
matrix:
# Which OS versions we will test on.
os_version: [ 22.04 ]
steps:
- name: Checkout
uses: >- # v4.1.1
actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Docker Buildx
uses: >- # v3.2.0
docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20
- name: Build image
uses: >- # v5.3.0
docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
file: ./deployment-examples/docker-compose/Dockerfile
build-args: |
OPT_LEVEL=fastbuild
OS_VERSION=${{ matrix.os_version }}
load: true # This brings the build into `docker images` from buildx.
tags: trace_machina/nativelink:latest
- name: Run tests
run: ./run_integration_tests.sh