Skip to content

Commit

Permalink
Improve caching in CI and fix flakey prometheus test
Browse files Browse the repository at this point in the history
  • Loading branch information
allada committed Jul 21, 2023
1 parent b30dfce commit ea33b6c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/main.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
# Which OS versions we will test on.
os_version: [ 20.04, 22.04 ]
os_version: [ 20.04 ]
steps:
- uses: actions/checkout@v3.5.3
with:
Expand All @@ -28,6 +28,10 @@ jobs:
build-args: |
OPT_LEVEL=fastbuild
OS_VERSION=${{ matrix.os_version }}
# The `builder` stage is pointless to be cached because any change to the
# PR invalidates it. So to save the limited cache space we skip it.
no-cache-filters: |
builder-final
target: builder-externals-built
load: true # This brings the build into `docker images` from buildx.
tags: allada/turbo-cache:test
Expand All @@ -41,7 +45,7 @@ jobs:
strategy:
matrix:
# Which OS versions we will test on.
os_version: [ 20.04, 22.04 ]
os_version: [ 20.04 ]
steps:
- uses: actions/checkout@v3.5.3
with:
Expand All @@ -58,7 +62,7 @@ jobs:
# The `builder` stage is pointless to be cached because any change to the
# PR invalidates it. So to save the limited cache space we skip it.
no-cache-filters: |
builder
builder-final
load: true # This brings the build into `docker images` from buildx.
tags: allada/turbo-cache:latest
cache-from: type=gha,scope=main
Expand All @@ -70,6 +74,10 @@ jobs:
asan-tests:
# 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: [ 20.04 ]
steps:
- uses: actions/checkout@v3.5.3
with:
Expand All @@ -82,6 +90,11 @@ jobs:
file: ./deployment-examples/docker-compose/Dockerfile
build-args: |
ADDITIONAL_BAZEL_FLAGS=--config=asan
OS_VERSION=${{ matrix.os_version }}
# The `builder` stage is pointless to be cached because any change to the
# PR invalidates it. So to save the limited cache space we skip it.
no-cache-filters: |
builder-final
target: builder-externals-built
load: true # This brings the build into `docker images` from buildx.
tags: allada/turbo-cache:asan-test
Expand Down
4 changes: 2 additions & 2 deletions deployment-examples/docker-compose/Dockerfile
Expand Up @@ -99,7 +99,7 @@ RUN bazel build -c ${OPT_LEVEL} ${ADDITIONAL_BAZEL_FLAGS} --target_pattern_file=


# Builder to do the remaining build. At this point most of our externals should be built.
FROM builder-externals-built as builder
FROM builder-externals-built as builder-final
ARG OPT_LEVEL
ARG CC
ARG ADDITIONAL_BAZEL_FLAGS
Expand All @@ -110,7 +110,7 @@ RUN bazel build -c ${OPT_LEVEL} ${ADDITIONAL_BAZEL_FLAGS} //cas && \

# Go back to a fresh ubuntu container and copy only the compiled binary.
FROM ubuntu:${OS_VERSION}
COPY --from=builder /root/turbo-cache-bin /usr/local/bin/turbo-cache
COPY --from=builder-final /root/turbo-cache-bin /usr/local/bin/turbo-cache
# Install runtime packages.
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/simple_prometheus_test.sh
Expand Up @@ -33,15 +33,15 @@ echo "$all_contents"
# Check static metrics in some of the stores. These settings are set
# in the config file of integration tests for the CAS.
echo 'Checking: turbo_cache_stores_AC_MAIN_STORE_evicting_map_max_bytes 500000000'
echo "$all_contents" | grep -q 'turbo_cache_stores_AC_MAIN_STORE_evicting_map_max_bytes 500000000'
grep -q 'turbo_cache_stores_AC_MAIN_STORE_evicting_map_max_bytes 500000000' <<< "$all_contents"
echo 'Checking: turbo_cache_stores_AC_MAIN_STORE_read_buff_size_bytes 32768'
echo "$all_contents" | grep -q 'turbo_cache_stores_AC_MAIN_STORE_read_buff_size_bytes 32768'
grep -q 'turbo_cache_stores_AC_MAIN_STORE_read_buff_size_bytes 32768' <<< "$all_contents"
echo 'Checking: turbo_cache_stores_CAS_MAIN_STORE_evicting_map_max_bytes 10000000000'
echo "$all_contents" | grep -q 'turbo_cache_stores_CAS_MAIN_STORE_evicting_map_max_bytes 10000000000'
grep -q 'turbo_cache_stores_CAS_MAIN_STORE_evicting_map_max_bytes 10000000000' <<< "$all_contents"

# Check dynamic metrics in some of the stores.
# These are the most stable settings to test that are dymaic.
echo 'Checking: turbo_cache_stores_AC_MAIN_STORE_evicting_map_item_size_bytes{quantile="0.99"}'
echo "$all_contents" | grep -q 'turbo_cache_stores_AC_MAIN_STORE_evicting_map_item_size_bytes{quantile="0.99"}'
grep -q 'turbo_cache_stores_AC_MAIN_STORE_evicting_map_item_size_bytes{quantile="0.99"}' <<< "$all_contents"
echo 'Checking: turbo_cache_stores_AC_MAIN_STORE_evicting_map_items_in_store_total 3'
echo "$all_contents" | grep -q 'turbo_cache_stores_AC_MAIN_STORE_evicting_map_items_in_store_total 3'
grep -q 'turbo_cache_stores_AC_MAIN_STORE_evicting_map_items_in_store_total 3' <<< "$all_contents"

0 comments on commit ea33b6c

Please sign in to comment.