Skip to content

Commit

Permalink
Mark git directories as safe for our docker_ci container and fix carg…
Browse files Browse the repository at this point in the history
…o caching (#1187)

* Mark git directories as safe for our docker_ci container
* New cargo packages means a new cache key
* Add CACHE_KEY everywhere and Only update cache from 1 location
  • Loading branch information
jleibs authored Feb 10, 2023
1 parent 2049301 commit cd80c7c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,26 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
# Sets TAGGED_OR_MAIN if this workflow is running on a tag or the main branch.
- name: Set TAGGED_OR_MAIN
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
run: echo "TAGGED_OR_MAIN=1" >> $GITHUB_ENV
# Sets TAGGED_OR_MAIN if this workflow is running on a tag or the main branch.
- name: Set TAGGED_OR_MAIN
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
run: echo "TAGGED_OR_MAIN=1" >> $GITHUB_ENV

- id: set-matrix
shell: bash
run: |
matrix=()
- id: set-matrix
shell: bash
run: |
matrix=()
if [[ $TAGGED_OR_MAIN ]]; then
# MacOS build is really slow (>30 mins); uses up a lot of CI minutes
matrix+=('{"platform": "macos", "runs_on": "macos-latest"},')
fi
matrix+=('{"platform": "windows", "runs_on": "windows-latest-8-cores"},')
matrix+=('{"platform": "linux", "runs_on": "ubuntu-latest-16-cores"}')
if [[ $TAGGED_OR_MAIN ]]; then
# MacOS build is really slow (>30 mins); uses up a lot of CI minutes
matrix+=('{"platform": "macos", "runs_on": "macos-latest"},')
fi
matrix+=('{"platform": "windows", "runs_on": "windows-latest-8-cores"},')
matrix+=('{"platform": "linux", "runs_on": "ubuntu-latest-16-cores"}')
echo "Matrix values: ${matrix[@]}"
echo "Matrix values: ${matrix[@]}"
echo "matrix={\"include\":[${matrix[@]}]}" >> $GITHUB_OUTPUT
echo "matrix={\"include\":[${matrix[@]}]}" >> $GITHUB_OUTPUT
wheels:
name: Build Python Wheels
Expand All @@ -108,8 +108,11 @@ jobs:
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
# See: https://github.com/rerun-io/rerun/pull/497
save-if: ${{ github.event_name == 'push'}}
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
# Don't update the cache -- it will be updated by the lint job
# TODO(jleibs): this job will likely run before rust.yml updates
# the cache. Better cross-job sequencing would be nice here
save-if: False

- name: Setup python
uses: actions/setup-python@v4
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
save-if: ${{ github.event_name == 'push'}}
# Don't update the cache -- it will be updated by the lint job
# TODO(jleibs): this job will likely run before rust.yml updates
# the cache. Better cross-job sequencing would be nice here
save-if: false

- name: Run benchmark
# Use bash shell so we get pipefail behavior with tee
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/toml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
# See: https://github.com/rerun-io/rerun/pull/497
save-if: ${{ github.event_name == 'push'}}
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
# Don't update the cache -- it will be updated by the lint job
# TODO(jleibs): this job will likely run before rust.yml updates
# the cache. Better cross-job sequencing would be nice here
save-if: false

- name: Install taplo-cli
uses: baptiste0928/cargo-install@v1
Expand Down
9 changes: 7 additions & 2 deletions ci_docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM rust:1.67
LABEL maintainer="[email protected]"
LABEL version="0.1"
# Remember to update the version in publish.sh
# TODO(jleibs) use this version in the publish.sh script and below in the CACHE_KEY
LABEL version="0.4"
LABEL description="Docker image used for the CI of https://github.com/rerun-io/rerun"

# Install some cargo tools we know we'll always need
Expand Down Expand Up @@ -34,4 +36,7 @@ RUN pip install -r requirements-build.txt
RUN cargo install [email protected]

# Increment this to invalidate cache
ENV CACHE_KEY=rerun_docker_v0.1
ENV CACHE_KEY=rerun_docker_v0.4

# See: https://github.com/actions/runner-images/issues/6775#issuecomment-1410270956
RUN git config --system --add safe.directory '*'
8 changes: 5 additions & 3 deletions ci_docker/publish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=0.4 # Bump on each new version. Maybe it should also match the version in ci_docker/Dockerfile ?
VERSION=0.4 # Bump on each new version. Remember to update the version in the Dockerfile too.

# The build needs to run from top of repo to access the requirments.txt
cd `git rev-parse --show-toplevel`
Expand All @@ -7,8 +7,10 @@ cd `git rev-parse --show-toplevel`
docker pull rerunio/ci_docker

# Build the image
# docker build -t ci_docker -f ci_docker/Dockerfile .
docker buildx build --platform=linux/amd64 -t ci_docker -f ci_docker/Dockerfile .
docker build -t ci_docker -f ci_docker/Dockerfile .
# This is necessary to build on mac, but is doing something weird with the Cache
# TODO(jleibs): Make this all work portably with caching
# docker buildx build --platform=linux/amd64 -t ci_docker -f ci_docker/Dockerfile .

# Tag latest and version
docker tag ci_docker rerunio/ci_docker
Expand Down

1 comment on commit cd80c7c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: cd80c7c Previous: 2049301 Ratio
datastore/insert/batch/rects/insert 550840 ns/iter (± 3466) 562610 ns/iter (± 12001) 0.98
datastore/latest_at/batch/rects/query 1809 ns/iter (± 7) 1834 ns/iter (± 4) 0.99
datastore/latest_at/missing_components/primary 352 ns/iter (± 2) 351 ns/iter (± 1) 1.00
datastore/latest_at/missing_components/secondaries 422 ns/iter (± 1) 422 ns/iter (± 0) 1
datastore/range/batch/rects/query 155921 ns/iter (± 414) 156214 ns/iter (± 634) 1.00
mono_points_arrow/generate_message_bundles 48993118 ns/iter (± 1875450) 52718935 ns/iter (± 613584) 0.93
mono_points_arrow/generate_messages 136339827 ns/iter (± 1533141) 139566089 ns/iter (± 1244840) 0.98
mono_points_arrow/encode_log_msg 163088564 ns/iter (± 2717103) 172950171 ns/iter (± 1682377) 0.94
mono_points_arrow/encode_total 354755335 ns/iter (± 3307321) 366399742 ns/iter (± 2462862) 0.97
mono_points_arrow/decode_log_msg 183472531 ns/iter (± 1671618) 188288487 ns/iter (± 1221365) 0.97
mono_points_arrow/decode_message_bundles 73907511 ns/iter (± 1279687) 76702234 ns/iter (± 1069860) 0.96
mono_points_arrow/decode_total 253995374 ns/iter (± 2431737) 260025844 ns/iter (± 1957717) 0.98
batch_points_arrow/generate_message_bundles 289985 ns/iter (± 1143) 290093 ns/iter (± 629) 1.00
batch_points_arrow/generate_messages 6246 ns/iter (± 26) 6212 ns/iter (± 9) 1.01
batch_points_arrow/encode_log_msg 372436 ns/iter (± 2457) 374885 ns/iter (± 2082) 0.99
batch_points_arrow/encode_total 693389 ns/iter (± 6650) 697574 ns/iter (± 2342) 0.99
batch_points_arrow/decode_log_msg 348403 ns/iter (± 1888) 352413 ns/iter (± 1415) 0.99
batch_points_arrow/decode_message_bundles 2062 ns/iter (± 12) 2063 ns/iter (± 11) 1.00
batch_points_arrow/decode_total 353638 ns/iter (± 2495) 352488 ns/iter (± 2030) 1.00
arrow_mono_points/insert 6984339506 ns/iter (± 23997054) 7119545196 ns/iter (± 36936775) 0.98
arrow_mono_points/query 1713788 ns/iter (± 26313) 1781497 ns/iter (± 24493) 0.96
arrow_batch_points/insert 2685233 ns/iter (± 39864) 2710106 ns/iter (± 47996) 0.99
arrow_batch_points/query 16990 ns/iter (± 58) 16881 ns/iter (± 26) 1.01
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.