Skip to content
Open
Show file tree
Hide file tree
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
42 changes: 42 additions & 0 deletions .github/actions/mount-bazel-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Mount Bazel Cache'

inputs:
# Effectively, "bazel build --config=<this> ..."
bazel-build-config-name:
required: false
default: "default"

# Whether or not to update the cache. This is expected to be true in postsubmit when we are intentionally updating the cache for future PRs.
writable:
required: false
default: "false"

runs:
using: "composite"
steps:
- name: Load cache config
run: |
cat .config/cache-config.env >> $GITHUB_ENV

- name: Restore cache
if: inputs.writable != 'true'
uses: actions/cache/restore@v5
with:
path: "~/bazel-disk-cache"
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-config-{3}-{4}-{5}', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name, github.ref_name, github.sha) }}
restore-keys: |
${{ format('{0}-{1}-bazel-disk-cache-{2}-config-{3}-{4}', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name, github.ref_name) || '' }}
${{ format('{0}-{1}-bazel-disk-cache-{2}-config-{3}-main-', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name) || '' }}
${{ format('{0}-{1}-bazel-disk-cache-{2}-config-{3}', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name) || '' }}

- name: Restore cache and save cache
if: inputs.writable == 'true'
uses: actions/cache@v5
with:
path: "~/bazel-disk-cache"
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-build-{3}-{4}-{5}-{6}', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name, github.ref_name, github.sha, github.event_name) }}
restore-keys: |
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-config-{3}-{4}-{5}', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name, github.ref_name, github.sha) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-config-{3}-{4}', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name, github.ref_name) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-config-{3}-main-', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-config-', runner.os, runner.arch, env.CACHE_VERSION, inputs.bazel-build-config-name) || '' }}
71 changes: 50 additions & 21 deletions .github/workflows/postsubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,83 @@ jobs:
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: true

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Install bazel
run: sudo bash toolchain/bazel/install_bazel.sh

- name: Install toolchain dependencies
run: sudo bash toolchain/bazel/install_toolchain_dependencies.sh

- name: Mount Bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
bazel-build-config-name: "default"
writable: true

- name: Build
run: |
bazel build ... \
--disk_cache=$HOME/bazel-disk-cache \
--graphics_drivers=gles_angle_vulkan_swiftshader \
--verbose_failures

postsubmit-populate-bazel-cache-asan:
runs-on: ubuntu-22.04
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: true

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Install bazel
run: sudo bash toolchain/bazel/install_bazel.sh

- name: Install toolchain dependencies
run: sudo bash toolchain/bazel/install_toolchain_dependencies.sh
- name: Load cache config
run: cat .config/cache-config.env >> $GITHUB_ENV
- name: Mount bazel cache
uses: actions/cache@v5

- name: Mount Bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
path: "~/bazel-disk-cache"
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-{4}-{5}', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha, github.event_name) }}
restore-keys: |
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-{3}-{4}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-{3}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-main-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
bazel-build-config-name: "asan"
writable: true

- name: Build
run: |
bazel build ... \
--config=asan \
--disk_cache=$HOME/bazel-disk-cache \
--graphics_drivers=gles_angle_vulkan_swiftshader \
--verbose_failures

postsubmit-populate-bazel-cache-arm:
runs-on: ubuntu-22.04-arm
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: true

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Install bazel
run: sudo bash toolchain/bazel/install_bazel.sh

- name: Install toolchain dependencies
run: sudo bash toolchain/bazel/install_toolchain_dependencies.sh
- name: Load cache config
run: cat .config/cache-config.env >> $GITHUB_ENV
- name: Mount bazel cache
uses: actions/cache@v5

- name: Mount Bazel cache
uses: ./.github/actions/mount-bazel-cache
with:
path: "~/bazel-disk-cache"
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-debian-package-{3}-{4}-{5}', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha, github.event_name) }}
restore-keys: |
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-debian-package-{3}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-debian-package-main-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
${{ github.event_name == 'push' && format('{0}-{1}-bazel-disk-cache-{2}-debian-package-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
bazel-build-config-name: "default"
writable: true

- name: Build
run: |
bazel build ... \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
# TODO(b/475886246): fix and remove `detect_leaks=0`
# TODO(b/475885975): fix and remove `detect_odr_violation=0`
additional-bazel-args: --config=asan --test_env="ASAN_OPTIONS=detect_leaks=0:detect_odr_violation=0"
bazel-build-config-name: "asan"
runner: ubuntu-22.04

run-gfxstream-bazel-tests-arm:
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/presubmit_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
type: string
default: ''

# Which build config is used (i.e. what is in the `bazel build --config=<this>`).
bazel-build-config-name:
type: string
default: 'default'

# Whether or not to run the `bazel test` step:
run-tests:
type: boolean
Expand All @@ -39,18 +44,10 @@ jobs:
- name: Install runtime dependencies
run: sudo apt-get install -y libvulkan1

- name: Load cache config
run: cat .config/cache-config.env >> $GITHUB_ENV

- name: Mount Bazel cache
uses: actions/cache/restore@v5
uses: ./.github/actions/mount-bazel-cache
with:
path: "~/bazel-disk-cache"
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-{4}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha) }}
restore-keys: |
${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name) || '' }}
${{ format('{0}-{1}-bazel-disk-cache-{2}-main-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
${{ format('{0}-{1}-bazel-disk-cache-{2}-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
bazel-build-config: ${{ inputs.bazel-build-config-name }}

- name: Build
run: |
Expand Down
Loading