mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-25 23:49:37 -05:00
ci: use github actions cache to speedup bazel builds (#1444)
* ci: use github actions cache to speedup bazel builds * ci: warm bazel repo cache daily
This commit is contained in:
parent
5a82c3cef2
commit
6f16e0b6fd
15
.github/actions/setup_bazel/action.yml
vendored
15
.github/actions/setup_bazel/action.yml
vendored
@ -26,6 +26,19 @@ runs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
- name: Bazel repository cache (Linux)
|
||||||
|
uses: actions/cache/restore@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||||
|
if: runner.os == 'Linux' && (inputs.useCache == 'true' || inputs.useCache == 'readonly')
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/tools/pseudo-version
|
||||||
|
/home/runner/.cache/bazel
|
||||||
|
/home/runner/.cache/shared_bazel_repository_cache
|
||||||
|
/home/runner/.cache/shared_bazel_action_cache
|
||||||
|
/tmp/bazel-zig-cc
|
||||||
|
key: bazel
|
||||||
|
|
||||||
- name: Configure Bazel
|
- name: Configure Bazel
|
||||||
shell: bash
|
shell: bash
|
||||||
if: inputs.useCache == 'true' || inputs.useCache == 'readonly'
|
if: inputs.useCache == 'true' || inputs.useCache == 'readonly'
|
||||||
@ -43,6 +56,7 @@ runs:
|
|||||||
build --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_ORG_API_KEY}
|
build --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_ORG_API_KEY}
|
||||||
EOF
|
EOF
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Configure Bazel (readonly)
|
- name: Configure Bazel (readonly)
|
||||||
shell: bash
|
shell: bash
|
||||||
if: inputs.useCache == 'readonly'
|
if: inputs.useCache == 'readonly'
|
||||||
@ -50,6 +64,7 @@ runs:
|
|||||||
echo "::group::Configure Bazel (readonly)"
|
echo "::group::Configure Bazel (readonly)"
|
||||||
echo "build --remote_upload_local_results=false" >> ~/.bazelrc
|
echo "build --remote_upload_local_results=false" >> ~/.bazelrc
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
- name: Check bazel version
|
- name: Check bazel version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: bazel version
|
run: bazel version
|
||||||
|
53
.github/workflows/warm-bazel-cache.yml
vendored
Normal file
53
.github/workflows/warm-bazel-cache.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
name: Warm bazel cache
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "5 6 * * *" # At 06:05 every day.
|
||||||
|
|
||||||
|
env:
|
||||||
|
CACHE_KEY: bazel
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
warm-bazel-cache:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
with:
|
||||||
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
||||||
|
|
||||||
|
- name: Build common targets
|
||||||
|
run: |
|
||||||
|
bazel build \
|
||||||
|
//bootstrapper/cmd/bootstrapper:bootstrapper_linux_amd64 \
|
||||||
|
//cli:cli_oss_linux_amd64 \
|
||||||
|
//cli:cli_oss_darwin_amd64 \
|
||||||
|
//debugd/cmd/cdbg:cdbg_linux_amd64 \
|
||||||
|
//debugd/cmd/cdbg:cdbg_darwin_amd64 \
|
||||||
|
//disk-mapper/cmd:disk-mapper_linux_amd64 \
|
||||||
|
//measurement-reader/cmd:measurement-reader_linux_amd64 \
|
||||||
|
//upgrade-agent/cmd:upgrade_agent_linux_amd64
|
||||||
|
|
||||||
|
- name: clear
|
||||||
|
continue-on-error: true
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
gh extension install actions/gh-actions-cache || true
|
||||||
|
gh actions-cache delete "${CACHE_KEY}" --confirm || true
|
||||||
|
|
||||||
|
- name: save
|
||||||
|
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/tools/pseudo-version
|
||||||
|
/home/runner/.cache/bazel
|
||||||
|
/home/runner/.cache/shared_bazel_repository_cache
|
||||||
|
/home/runner/.cache/shared_bazel_action_cache
|
||||||
|
/tmp/bazel-zig-cc
|
||||||
|
key: ${{ env.CACHE_KEY }}
|
Loading…
Reference in New Issue
Block a user