Skip to content

Commit 36bf256

Browse files
committed
build: run build sanity for various archs
Performs builds across various archs to make sure build sanity is maintained across archs Signed-off-by: Aditya R <arajan@redhat.com>
1 parent c9ccfca commit 36bf256

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

.cirrus.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
# Save a little typing (path relative to $CIRRUS_WORKING_DIR)
1818
SCRIPT_BASE: "./contrib/cirrus"
1919
FEDORA_NAME: "fedora-35"
20-
IMAGE_SUFFIX: "c4560539387953152"
20+
IMAGE_SUFFIX: "c6118659411148800"
2121
FEDORA_NETAVARK_IMAGE: "fedora-netavark-${IMAGE_SUFFIX}"
2222

2323

@@ -113,6 +113,15 @@ unit_task:
113113
setup_script: *setup
114114
main_script: *main
115115

116+
build_cross_task:
117+
alias: "build_cross"
118+
depends_on:
119+
- "build"
120+
cargo_cache: *ro_cargo_cache
121+
targets_cache: *ro_targets_cache
122+
bin_cache: *ro_bin_cache
123+
setup_script: *setup
124+
main_script: *main
116125

117126
integration_task:
118127
alias: "integration"
@@ -152,6 +161,7 @@ success_task:
152161
alias: success
153162
depends_on:
154163
- "build"
164+
- "build_cross"
155165
- "validate"
156166
- "verify_vendor"
157167
- "unit"

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ test: unit integration
7575
build_unit: $(CARGO_TARGET_DIR)
7676
cargo test --no-run
7777

78+
# Test build cross-architecture
79+
.PHONY: build_cross
80+
build_cross: $(CARGO_TARGET_DIR)
81+
cargo install cross
82+
rustup target add aarch64-unknown-linux-gnu
83+
rustup target add arm-unknown-linux-gnueabi
84+
cross build --target aarch64-unknown-linux-gnu
85+
cross build --target arm-unknown-linux-gnueabi
86+
7887
.PHONY: unit
7988
unit: $(CARGO_TARGET_DIR)
8089
cargo test

contrib/cirrus/lib.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ SECRET_ENV_RE='(ACCOUNT)|(GC[EP]..+)|(SSH)|(PASSWORD)|(TOKEN)'
2929
if [[ -r "/etc/ci_environment" ]]; then
3030
source /etc/ci_environment
3131
else # set default values - see make_cienv() below
32-
# Install rust packages globally instead of per-user
33-
CARGO_HOME="${CARGO_HOME:-/usr/local/cargo}"
34-
# Ensure cargo packages can be executed
35-
PATH="$PATH:$CARGO_HOME/bin"
32+
# VM Images are built with this setup
33+
CARGO_HOME="${CARGO_HOME:-/var/cache/cargo}"
34+
source $CARGO_HOME/env
3635
fi
3736

3837
# END Global export of all variables

contrib/cirrus/runner.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ EOF
3535
}
3636

3737
_run_validate() {
38+
rustup install stable
39+
rustup default stable
3840
make validate
3941
}
4042

43+
_run_build_cross() {
44+
make build_cross
45+
}
46+
4147
_run_verify_vendor() {
4248
# N/B: current repo. dir. contents produced by _run_build() above.
4349
if ! git diff --no-ext-diff --quiet --exit-code; then

contrib/cirrus/setup.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@ if [[ -r "/etc/ci_environment" ]]; then
1414
fi
1515
trap "complete_setup" EXIT
1616

17+
1718
msg "************************************************************"
1819
msg "Setting up runtime environment"
1920
msg "************************************************************"
21+
22+
dnf -y install make automake gcc gcc-c++ kernel-devel
23+
2024
show_env_vars
25+
26+
if [[ "$CIRRUS_TASK_NAME" == "build_cross" ]]; then
27+
# Setup short-name for rustembedded/cross
28+
# TODO: We can move this to quay.io if we reach rate-limits, hopefully that's not gonna happen for netavark
29+
echo ' "rustembedded/cross" = "docker.io/rustembedded/cross"' >> /etc/containers/registries.conf.d/000-shortnames.conf
30+
fi

0 commit comments

Comments
 (0)