Skip to content

Commit

Permalink
Support remote build execution on main and read-only remote cache on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
bclark8923 committed Aug 23, 2024
1 parent 5903a8e commit 0cec6c5
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 7 deletions.
1 change: 1 addition & 0 deletions .bazelrc.lre
1 change: 1 addition & 0 deletions .container
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
299166832260.dkr.ecr.us-east-2.amazonaws.com/nativelink-rbe:v0.3 HASH
49 changes: 42 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

# Controls when the workflow will run.
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
Expand All @@ -19,8 +20,10 @@ jobs:
nativelink-dot-com-build-on-main-test:
runs-on: ubuntu-22.04
environment: production
# Only run on main branch.
if: github.ref == 'refs/heads/main'
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
Expand All @@ -34,12 +37,44 @@ jobs:
shell: bash
run: |
bazel test \
--remote_cache=${{ vars.NATIVELINK_COM_REMOTE_CACHE_URL }} \
--remote_header=${{ secrets.NATIVELINK_COM_API_HEADER }} \
--bes_backend=${{ vars.NATIVELINK_COM_BES_URL }} \
--bes_header=${{ secrets.NATIVELINK_COM_API_HEADER }} \
--bes_results_url=${{ vars.NATIVELINK_COM_BES_RESULTS_URL }} \
--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 \
--verbose_failures \
--platform_suffix=${{ github.run_id }}-${{ github.run_attempt }} \
//...
docker-compose-compiles-nativelink:
Expand Down
32 changes: 32 additions & 0 deletions tools/toolchain-nativelink/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/secrets.dev.yaml
**/values.dev.yaml
/bin
/target
LICENSE
README.md
20 changes: 20 additions & 0 deletions tools/toolchain-nativelink/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:22.04

# Set shell to bash and enable pipefail
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Get Ubuntu packages
RUN apt-get update && apt-get install --no-install-recommends -y \
gcc=4:11.2.0-1ubuntu1 \
g++=4:11.2.0-1ubuntu1 \
python3=3.10.6-1~22.04 \
python3-minimal=3.10.6-1~22.04 \
libpython3-stdlib=3.10.6-1~22.04 \
curl=7.81.0-1ubuntu1.17 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Get Rust
RUN curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.79.0

RUN echo "source \"$HOME/.cargo/env\"" >> "$HOME/.bashrc"

0 comments on commit 0cec6c5

Please sign in to comment.