Skip to content

Commit c91182c

Browse files
emilkjleibs
andauthored
Switch to faster GitHub Actions CI runners (#480)
* Switch to ubuntu-latest-16-cores and windows-latest-8-cores * Introduce custom Dockerfile for managing build Co-authored-by: Jeremy Leibs <jeremy@rerun.io>
1 parent 2990e7a commit c91182c

File tree

4 files changed

+98
-51
lines changed

4 files changed

+98
-51
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
venv/
2+
**/*.so
3+
examples/
4+
target
5+
target*

.github/workflows/rust.yml

+37-51
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,26 @@ env:
2222
jobs:
2323
rs-lints:
2424
name: Rust lints (fmt, check, cranky, tests, doc)
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-latest-16-cores
26+
container:
27+
image: rerunio/ci_docker:0.1
28+
env:
29+
RUSTFLAGS: ${{env.RUSTFLAGS}}
30+
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
2631
steps:
2732
- uses: actions/checkout@v2
2833

29-
- uses: actions-rs/toolchain@v1
30-
with:
31-
profile: minimal
32-
toolchain: 1.65.0
33-
override: true
34-
components: rustfmt, clippy
35-
36-
- run: |
37-
sudo apt-get update
38-
sudo apt-get install libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev # eframe reqs
39-
4034
- name: Set up cargo cache
4135
uses: Swatinem/rust-cache@v2
36+
with:
37+
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
4238

4339
- name: Rustfmt
4440
uses: actions-rs/cargo@v1
4541
with:
4642
command: fmt
4743
args: --all -- --check
4844

49-
- name: Install cargo-cranky
50-
uses: baptiste0928/cargo-install@v1
51-
with:
52-
crate: cargo-cranky
53-
5445
- name: Cranky
5546
uses: actions-rs/cargo@v1
5647
with:
@@ -93,10 +84,16 @@ jobs:
9384
command: test
9485
args: --all-features --lib
9586

87+
# ---------------------------------------------------------------------------
9688

9789
rs-check-wasm:
9890
name: Check Rust web build (wasm32 + wasm-bindgen)
99-
runs-on: ubuntu-latest
91+
runs-on: ubuntu-latest-16-cores
92+
container:
93+
image: rerunio/ci_docker:0.1
94+
env:
95+
RUSTFLAGS: ${{env.RUSTFLAGS}}
96+
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
10097
steps:
10198
- uses: actions/checkout@v2
10299

@@ -107,10 +104,10 @@ jobs:
107104
target: wasm32-unknown-unknown
108105
override: true
109106

110-
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev
111-
112107
- name: Set up cargo cache
113108
uses: Swatinem/rust-cache@v2
109+
with:
110+
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
114111

115112
- name: Check re_viewer wasm32
116113
uses: actions-rs/cargo@v1
@@ -124,62 +121,50 @@ jobs:
124121
command: check
125122
args: --target wasm32-unknown-unknown -p re_renderer --examples
126123

127-
- name: wasm-bindgen
128-
uses: jetli/wasm-bindgen-action@v0.1.0
129-
with:
130-
version: "0.2.83"
131-
132124
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
133125

126+
# ---------------------------------------------------------------------------
134127

135128
rs-cargo-deny:
136129
name: Check Rust dependencies (cargo-deny)
137-
runs-on: ubuntu-latest
130+
runs-on: ubuntu-latest-16-cores
131+
container:
132+
image: rerunio/ci_docker:0.1
133+
env:
134+
RUSTFLAGS: ${{env.RUSTFLAGS}}
135+
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
138136
steps:
139137
- uses: actions/checkout@v2
140138

141-
- uses: EmbarkStudios/cargo-deny-action@v1
139+
- name: cargo deny
140+
uses: actions-rs/cargo@v1
142141
with:
143-
rust-version: "1.65.0"
144-
arguments: --log-level error
142+
command: deny
143+
args: --log-level=error check
145144

145+
# ---------------------------------------------------------------------------
146146

147147
rs-maturin-linux:
148148
name: Build Rust SDK Maturin Wheel (Linux)
149-
runs-on: ubuntu-latest
149+
runs-on: ubuntu-latest-16-cores
150+
container:
151+
image: rerunio/ci_docker:0.1
150152
steps:
151153
- uses: actions/checkout@v2
152154

153-
- uses: actions-rs/toolchain@v1
154-
with:
155-
profile: minimal
156-
toolchain: 1.65.0
157-
override: true
158-
components: rustfmt
159-
160-
- run: |
161-
sudo apt-get update
162-
sudo apt-get install libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev # eframe reqs
163-
164155
- name: Set up cargo cache
165156
uses: Swatinem/rust-cache@v2
166-
167-
- name: Setup python for building wheel
168-
uses: actions/setup-python@v4
169157
with:
170-
python-version: "3.8"
171-
cache: "pip"
172-
cache-dependency-path: "rerun_py/requirements-build.txt"
173-
174-
- run: pip install -r rerun_py/requirements-build.txt
158+
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
175159

176160
- name: Build wheels
177161
run: maturin build -m rerun_py/Cargo.toml -o dist
178162

163+
# ---------------------------------------------------------------------------
179164

180165
rs-maturin-windows:
181166
name: Build Rust SDK Maturin Wheel (Windows)
182-
runs-on: windows-latest
167+
runs-on: windows-latest-8-cores
183168
steps:
184169
- uses: actions/checkout@v3
185170

@@ -199,11 +184,12 @@ jobs:
199184
command: build
200185
args: -m rerun_py/Cargo.toml -o dist
201186

187+
# ---------------------------------------------------------------------------
202188

203189
rs-maturin-macos:
204190
name: Build Rust SDK Maturin Wheel (macOS)
205191
runs-on: macos-latest
206-
if: "startsWith(github.ref, 'refs/tags/')" # slow; uses up a lot of CI minutes
192+
if: "startsWith(github.ref, 'refs/tags/')" # slow and uses up a lot of CI minutes (charged 10x of ubuntu!)
207193
steps:
208194
- uses: actions/checkout@v3
209195

ci_docker/Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM rust:1.65
2+
LABEL maintainer="opensource@rerun.io"
3+
LABEL version="0.1"
4+
LABEL description="Docker image used for the CI of https://github.com/rerun-io/rerun"
5+
6+
# Install some cargo tools we know we'll always need
7+
# We do this first in its own layer because the layer is quite large (500MB+)
8+
# And updating the crates.io index is one of the slower steps
9+
RUN cargo install cargo-deny && \
10+
cargo install cargo-cranky
11+
12+
# Install the ubuntu package dependencies
13+
ENV DEBIAN_FRONTEND=noninteractive
14+
RUN apt-get update && apt-get install -y --no-install-recommends \
15+
libatk-bridge2.0 \
16+
libfontconfig1-dev \
17+
libfreetype6-dev \
18+
libglib2.0-dev \
19+
libgtk-3-dev \
20+
libspeechd-dev \
21+
libssl-dev \
22+
libxcb-render0-dev \
23+
libxcb-shape0-dev \
24+
libxcb-xfixes0-dev \
25+
libxkbcommon-dev \
26+
patchelf \
27+
python3-pip && \
28+
rm -rf /var/lib/apt/lists/*
29+
30+
# Install the python build dependencies
31+
ADD rerun_py/requirements-build.txt requirements-build.txt
32+
RUN pip install -r requirements-build.txt
33+
34+
# Install some additional versioned cargo tools
35+
RUN cargo install wasm-bindgen-cli@0.2.83
36+
37+
# Increment this to invalidate cache
38+
ENV CACHE_KEY=rerun_docker_v0.1

ci_docker/publish.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
VERSION=0.1
2+
3+
# The build needs to run from top of repo to access the requirments.txt
4+
cd `git rev-parse --show-toplevel`
5+
6+
# Pull :latest so we have the correct cache
7+
docker pull rerunio/ci_docker
8+
9+
# Build the image
10+
docker build -t ci_docker -f ci_docker/Dockerfile .
11+
12+
# Tag latest and version
13+
docker tag ci_docker rerunio/ci_docker
14+
docker tag ci_docker rerunio/ci_docker:$VERSION
15+
16+
# Push the images back up
17+
docker push rerunio/ci_docker
18+
docker push rerunio/ci_docker:$VERSION

0 commit comments

Comments
 (0)