Skip to content

Commit 83b8c4b

Browse files
authored
Try #873: --target aarch64-unknown-linux-gnu
2 parents 74c3ba6 + d7e747e commit 83b8c4b

File tree

8 files changed

+407
-24
lines changed

8 files changed

+407
-24
lines changed

.github/workflows/ci.yml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,69 @@ jobs:
321321
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
322322
shell: bash
323323

324+
# we should always have an artifact from a previous build.
325+
remote:
326+
needs: [shellcheck, test, check]
327+
runs-on: ubuntu-latest
328+
if: github.actor == 'bors[bot]'
329+
steps:
330+
- uses: actions/checkout@v3
331+
- uses: ./.github/actions/setup-rust
332+
333+
- name: LLVM instrument coverage
334+
id: remote-cov
335+
uses: ./.github/actions/cargo-llvm-cov
336+
with:
337+
name: integration-remote
338+
339+
- name: Run Remote Test
340+
env:
341+
TARGET: aarch64-unknown-linux-gnu
342+
run: ./ci/test-remote.sh
343+
shell: bash
344+
345+
bisect:
346+
needs: [shellcheck, test, check]
347+
runs-on: ubuntu-latest
348+
if: github.actor == 'bors[bot]'
349+
steps:
350+
- uses: actions/checkout@v3
351+
- uses: ./.github/actions/setup-rust
352+
353+
- name: LLVM instrument coverage
354+
id: bisect-cov
355+
uses: ./.github/actions/cargo-llvm-cov
356+
with:
357+
name: integration-bisect
358+
359+
- name: Run Bisect Test
360+
env:
361+
TARGET: aarch64-unknown-linux-gnu
362+
run: ./ci/test-bisect.sh
363+
shell: bash
364+
365+
docker-in-docker:
366+
needs: [shellcheck, test, check]
367+
runs-on: ubuntu-latest
368+
if: github.actor == 'bors[bot]'
369+
steps:
370+
- uses: actions/checkout@v3
371+
- uses: ./.github/actions/setup-rust
372+
373+
- name: LLVM instrument coverage
374+
id: docker-in-docker-cov
375+
uses: ./.github/actions/cargo-llvm-cov
376+
with:
377+
name: integration-docker-in-docker
378+
379+
- name: Run Docker-in-Docker Test
380+
env:
381+
TARGET: aarch64-unknown-linux-gnu
382+
run: ./ci/test-docker-in-docker.sh
383+
shell: bash
384+
324385
publish:
325-
needs: [build, check]
386+
needs: [build, check, fmt, clippy, cargo-deny, remote, bisect, docker-in-docker]
326387
runs-on: ubuntu-latest
327388
steps:
328389
- uses: actions/checkout@v3

ci/shared.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
function retry {
4+
local tries="${TRIES-5}"
5+
local timeout="${TIMEOUT-1}"
6+
local try=0
7+
local exit_code=0
8+
9+
while (( try < tries )); do
10+
if "${@}"; then
11+
return 0
12+
else
13+
exit_code=$?
14+
fi
15+
16+
sleep "${timeout}"
17+
echo "Retrying ..." 1>&2
18+
try=$(( try + 1 ))
19+
timeout=$(( timeout * 2 ))
20+
done
21+
22+
return ${exit_code}
23+
}

ci/test-bisect.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1091,SC1090
3+
4+
# test to see that custom toolchains work
5+
6+
set -x
7+
set -eo pipefail
8+
9+
if [[ -z "${TARGET}" ]]; then
10+
export TARGET="aarch64-unknown-linux-gnu"
11+
fi
12+
13+
ci_dir=$(dirname "${BASH_SOURCE[0]}")
14+
ci_dir=$(realpath "${ci_dir}")
15+
. "${ci_dir}"/shared.sh
16+
project_home=$(dirname "${ci_dir}")
17+
18+
main() {
19+
local td=
20+
local err=
21+
22+
retry cargo fetch
23+
cargo build
24+
cargo install cargo-bisect-rustc --debug
25+
export CROSS="${project_home}/target/debug/cross"
26+
27+
td="$(mktemp -d)"
28+
git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"
29+
30+
pushd "${td}"
31+
retry cargo fetch
32+
# shellcheck disable=SC2016
33+
echo '#!/usr/bin/env bash
34+
export CROSS_CUSTOM_TOOLCHAIN=1
35+
exec "${CROSS}" run --target '"${TARGET}" > bisect.sh
36+
chmod +x bisect.sh
37+
38+
if ! err=$(cargo bisect-rustc --script=./bisect.sh --target "${TARGET}" 2>&1 >/dev/null); then
39+
if [[ "${err}" != *"does not reproduce the regression"* ]]; then
40+
echo "${err}"
41+
exit 1
42+
fi
43+
else
44+
echo "should have failed, instead succeeded" 1>&2
45+
exit 1
46+
fi
47+
popd
48+
49+
rm -rf "${td}"
50+
}
51+
52+
main

ci/test-docker-in-docker.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1004
3+
4+
# test to see that running docker-in-docker works
5+
6+
set -x
7+
set -eo pipefail
8+
9+
if [[ -z "${TARGET}" ]]; then
10+
export TARGET="aarch64-unknown-linux-gnu"
11+
fi
12+
13+
source=$(dirname "${BASH_SOURCE[0]}")
14+
source=$(realpath "${source}")
15+
home=$(dirname "${source}")
16+
17+
main() {
18+
docker run -v "${home}":/project -w /project \
19+
--rm -e TARGET -e RUSTFLAGS -e RUST_TEST_THREADS \
20+
-e LLVM_PROFILE_FILE -e CARGO_INCREMENTAL \
21+
-v /var/run/docker.sock:/var/run/docker.sock \
22+
docker:18.09-dind sh -c '
23+
#!/usr/bin/env sh
24+
set -x
25+
set -euo pipefail
26+
27+
apk add curl
28+
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
29+
source "${HOME}/.cargo/env"
30+
31+
# building on release is slow
32+
apk add libgcc gcc musl-dev
33+
cargo test --workspace
34+
cargo install --path . --force --debug
35+
36+
export CROSS_CONTAINER_IN_CONTAINER=1
37+
38+
apk add git
39+
td="$(mktemp -d)"
40+
git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"
41+
cd "${td}"
42+
cross run --target "${TARGET}" --verbose
43+
44+
td="$(mktemp -d)"
45+
git clone --depth 1 https://github.com/cross-rs/test-workspace "${td}"
46+
cd "${td}"
47+
cross build --target "${TARGET}" --workspace \
48+
--manifest-path="./workspace/Cargo.toml" --verbose
49+
cd workspace
50+
cross build --target "${TARGET}" --workspace --verbose
51+
cd binary
52+
cross run --target "${TARGET}" --verbose
53+
'
54+
}
55+
56+
main

ci/test-remote.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1091,SC1090
3+
4+
# test to see that remote docker support works.
5+
6+
set -x
7+
set -eo pipefail
8+
9+
export CROSS_REMOTE=1
10+
if [[ -z "${TARGET}" ]]; then
11+
export TARGET="aarch64-unknown-linux-gnu"
12+
fi
13+
14+
ci_dir=$(dirname "${BASH_SOURCE[0]}")
15+
ci_dir=$(realpath "${ci_dir}")
16+
. "${ci_dir}"/shared.sh
17+
project_home=$(dirname "${ci_dir}")
18+
19+
main() {
20+
local err=
21+
22+
retry cargo fetch
23+
cargo build
24+
export CROSS="${project_home}/target/debug/cross"
25+
export CROSS_UTIL="${project_home}/target/debug/cross-util"
26+
27+
# if the create volume fails, ensure it exists.
28+
if ! err=$("${CROSS_UTIL}" volumes create 2>&1 >/dev/null); then
29+
if [[ "${err}" != *"already exists"* ]]; then
30+
echo "${err}"
31+
exit 1
32+
fi
33+
fi
34+
cross_test_cpp
35+
"${CROSS_UTIL}" volumes remove
36+
37+
# ensure the data volume was removed.
38+
cross_test_cpp
39+
}
40+
41+
cross_test_cpp() {
42+
local td=
43+
td="$(mktemp -d)"
44+
45+
git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"
46+
47+
pushd "${td}"
48+
retry cargo fetch
49+
"${CROSS}" run --target "${TARGET}"
50+
popd
51+
52+
rm -rf "${td}"
53+
}
54+
55+
main

ci/test.sh

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# shellcheck disable=SC2086
2+
# shellcheck disable=SC2086,SC1091,SC1090
33

44
set -x
55
set -euo pipefail
@@ -10,30 +10,9 @@ set -euo pipefail
1010

1111
ci_dir=$(dirname "${BASH_SOURCE[0]}")
1212
ci_dir=$(realpath "${ci_dir}")
13+
. "${ci_dir}"/shared.sh
1314
project_home=$(dirname "${ci_dir}")
1415

15-
function retry {
16-
local tries="${TRIES-5}"
17-
local timeout="${TIMEOUT-1}"
18-
local try=0
19-
local exit_code=0
20-
21-
while (( try < tries )); do
22-
if "${@}"; then
23-
return 0
24-
else
25-
exit_code=$?
26-
fi
27-
28-
sleep "${timeout}"
29-
echo "Retrying ..." 1>&2
30-
try=$(( try + 1 ))
31-
timeout=$(( timeout * 2 ))
32-
done
33-
34-
return ${exit_code}
35-
}
36-
3716
workspace_test() {
3817
"${CROSS[@]}" build --target "${TARGET}" --workspace "$@" ${CROSS_FLAGS}
3918
"${CROSS[@]}" run --target "${TARGET}" -p binary "$@" ${CROSS_FLAGS}

src/bin/commands/containers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ pub fn remove_persistent_volume(
482482
engine: &docker::Engine,
483483
channel: Option<&str>,
484484
) -> cross::Result<()> {
485+
// we only need a triple that needs docker: the actual target doesn't matter.
485486
let msg_info = MessageInfo::create(verbose, quiet, color.as_deref())?;
486487
let triple = cross::Host::X86_64UnknownLinuxGnu.triple();
487488
let (_, _, dirs) =

0 commit comments

Comments
 (0)