Skip to content

Commit 4974183

Browse files
allisonallison
authored andcommitted
ci(linux): speed up builds/tests (#372)
## Summary Adds build caching so the CI workflows should hopefully complete way faster ## Changes <!-- What specific changes were made? --> ## Testing <!-- How did you test these changes? --> ## Checklist - [ ] No new warnings or clippy lints introduced - if so, explain why - [ ] Code works on all supported platforms (Linux, macOS, Windows) - tested on available platforms - [ ] Documentation added/updated where needed - [ ] If using generative AI assistance, disclosure is provided (co-authored-by tag or PR description) - see [here](CONTRIBUTING.md) Reviewed-on: https://codeberg.org/hummingbird/hummingbird/pulls/372
1 parent ffd8680 commit 4974183

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

.woodpecker/images/linux-ci.Dockerfile

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive
44
ENV APPIMAGE_EXTRACT_AND_RUN=1
55
ENV CARGO_TERM_COLOR=always
66
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
7+
ENV CARGO_TARGET_DIR=/opt/hummingbird/target
78

89
RUN dpkg --add-architecture arm64 \
910
&& apt-get update \
@@ -40,7 +41,10 @@ RUN dpkg --add-architecture arm64 \
4041
pkg-config \
4142
&& rm -rf /var/lib/apt/lists/*
4243

43-
RUN rustup component add --toolchain stable rustfmt clippy \
44+
RUN rustup toolchain install stable \
45+
&& rustup component add rustfmt clippy \
46+
&& rustup component add --toolchain stable rustfmt clippy \
47+
&& rustup target add aarch64-unknown-linux-gnu \
4448
&& rustup target add --toolchain stable aarch64-unknown-linux-gnu
4549

4650
RUN cargo install --git https://github.com/vicr123/contemporary-rs.git cargo-cntp-bundle \
@@ -53,4 +57,30 @@ RUN mkdir -p src \
5357
&& cargo fetch --locked \
5458
&& rm -rf /opt/hummingbird
5559

60+
# Pre-build all release dependencies for host (amd64)
61+
WORKDIR /opt/hummingbird
62+
COPY Cargo.toml Cargo.lock ./
63+
RUN mkdir -p src \
64+
&& echo 'fn main() {}' > src/main.rs \
65+
&& cargo build --release --locked -F update \
66+
&& cargo clean -p hummingbird \
67+
&& rm -rf src
68+
69+
# Pre-build all release dependencies for cross-target (arm64)
70+
RUN export PKG_CONFIG_ALLOW_CROSS=1 \
71+
&& export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig \
72+
&& export PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig \
73+
&& mkdir -p src \
74+
&& echo 'fn main() {}' > src/main.rs \
75+
&& cargo build --release --locked -F update --target aarch64-unknown-linux-gnu \
76+
&& cargo clean -p hummingbird --target aarch64-unknown-linux-gnu \
77+
&& rm -rf src
78+
79+
# Pre-build debug dependencies for cargo test
80+
RUN mkdir -p src \
81+
&& echo 'fn main() {}' > src/main.rs \
82+
&& cargo build --locked -F update \
83+
&& cargo clean -p hummingbird \
84+
&& rm -rf src
85+
5686
WORKDIR /woodpecker/src

.woodpecker/linux-arm64.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ steps:
88
pull: false
99
environment:
1010
CARGO_TERM_COLOR: always
11+
CARGO_TARGET_DIR: /opt/hummingbird/target
1112
APPIMAGE_EXTRACT_AND_RUN: 1
1213
LASTFM_API_KEY:
1314
from_secret: LASTFM_API_KEY

.woodpecker/linux.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ steps:
88
pull: false
99
environment:
1010
CARGO_TERM_COLOR: always
11+
CARGO_TARGET_DIR: /opt/hummingbird/target
1112
APPIMAGE_EXTRACT_AND_RUN: 1
1213
LASTFM_API_KEY:
1314
from_secret: LASTFM_API_KEY

.woodpecker/run-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ steps:
1010
pull: false
1111
environment:
1212
CARGO_TERM_COLOR: always
13+
CARGO_TARGET_DIR: /opt/hummingbird/target
1314
commands:
1415
- cargo test --all-features --locked

0 commit comments

Comments
 (0)