Skip to content

Commit

Permalink
Try #873: --target aarch64-unknown-linux-gnu
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] committed Jun 27, 2022
2 parents 021a103 + 26d2a65 commit a6b54fe
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 28 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,31 @@ jobs:
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
shell: bash

# we should always have an artifact from a previous build.
remote:
needs: [shellcheck, test, check]
runs-on: ubuntu-latest
if: github.actor == 'bors[bot]'
env:
TARGET: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
- run: ./ci/remote.sh

bisect:
needs: [shellcheck, test, check]
runs-on: ubuntu-latest
if: github.actor == 'bors[bot]'
env:
TARGET: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
- run: ./ci/bisect.sh

publish:
needs: [build, check]
needs: [build, check, fmt, clippy, cargo-deny, remote, bisect]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
48 changes: 48 additions & 0 deletions ci/bisect.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# shellcheck disable=SC1091,SC1090

# test to see that custom toolchains work

set -x
set -eo pipefail

if [[ -z "${TARGET}" ]]; then
export TARGET="aarch64-unknown-linux-gnu"
fi

source=$(dirname "${BASH_SOURCE[0]}")
. "${source}"/shared.sh

main() {
local td=
local err=

retry cargo fetch
cargo install --force --path .
cargo install cargo-bisect-rustc

td="$(mktemp -d)"
git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"

pushd "${td}"
retry cargo fetch
echo '#!/usr/bin/env bash
export CROSS_CUSTOM_TOOLCHAIN=1
exec cross run --target '"${TARGET}" > bisect.sh
chmod +x bisect.sh

if ! err=$(cargo bisect-rustc --script=./bisect.sh --target "${TARGET}" 2>&1 >/dev/null); then
if [[ "${err}" != *"does not reproduce the regression"* ]]; then
echo "${err}"
exit 1
fi
else
echo "should have failed, instead succeeded" 1>&2
exit 1
fi
popd

rm -rf "${td}"
}

main
51 changes: 51 additions & 0 deletions ci/remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# shellcheck disable=SC1091,SC1090

# test to see that remote docker support works.

set -x
set -eo pipefail

export CROSS_REMOTE=1
if [[ -z "${TARGET}" ]]; then
export TARGET="aarch64-unknown-linux-gnu"
fi

source=$(dirname "${BASH_SOURCE[0]}")
. "${source}"/shared.sh

main() {
local err=

retry cargo fetch
cargo install --force --path .

# if the create volume fails, ensure it exists.
if ! err=$(cross-util volumes create 2>&1 >/dev/null); then
if [[ "${err}" != *"already exists"* ]]; then
echo "${err}"
exit 1
fi
fi
cross_test_cpp
cross-util volumes remove

# ensure the data volume was removed.
cross_test_cpp
}

cross_test_cpp() {
local td=
td="$(mktemp -d)"

git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"

pushd "${td}"
retry cargo fetch
cross run --target "${TARGET}"
popd

rm -rf "${td}"
}

main
23 changes: 23 additions & 0 deletions ci/shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

function retry {
local tries="${TRIES-5}"
local timeout="${TIMEOUT-1}"
local try=0
local exit_code=0

while (( try < tries )); do
if "${@}"; then
return 0
else
exit_code=$?
fi

sleep "${timeout}"
echo "Retrying ..." 1>&2
try=$(( try + 1 ))
timeout=$(( timeout * 2 ))
done

return ${exit_code}
}
25 changes: 3 additions & 22 deletions ci/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2086
# shellcheck disable=SC2086,SC1091,SC1090

set -x
set -euo pipefail
Expand All @@ -8,27 +8,8 @@ set -euo pipefail
# installed version on macOS. likewise, "${var[@]}" is an unbound
# error if var is an empty array.

function retry {
local tries="${TRIES-5}"
local timeout="${TIMEOUT-1}"
local try=0
local exit_code=0

while (( try < tries )); do
if "${@}"; then
return 0
else
exit_code=$?
fi

sleep "${timeout}"
echo "Retrying ..." 1>&2
try=$(( try + 1 ))
timeout=$(( timeout * 2 ))
done

return ${exit_code}
}
source=$(dirname "${BASH_SOURCE[0]}")
. "${source}"/shared.sh

workspace_test() {
"${CROSS[@]}" build --target "${TARGET}" --workspace "$@" ${CROSS_FLAGS}
Expand Down
8 changes: 3 additions & 5 deletions src/bin/commands/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ impl CreateVolume {

#[derive(Args, Debug)]
pub struct RemoveVolume {
/// Triple for the target platform.
#[clap(long)]
pub target: String,
/// If cross is running inside a container.
#[clap(short, long)]
pub docker_in_docker: bool,
Expand Down Expand Up @@ -372,16 +369,17 @@ pub fn create_persistent_volume(

pub fn remove_persistent_volume(
RemoveVolume {
target,
docker_in_docker,
verbose,
..
}: RemoveVolume,
engine: &docker::Engine,
channel: Option<&str>,
) -> cross::Result<()> {
// we only need a triple that needs docker: the actual target doesn't matter.
let triple = cross::Host::X86_64UnknownLinuxGnu.triple();
let (_, _, dirs) =
docker::get_package_info(engine, &target, channel, docker_in_docker, verbose)?;
docker::get_package_info(engine, triple, channel, docker_in_docker, verbose)?;
let volume = docker::remote::unique_toolchain_identifier(&dirs.sysroot)?;

if !docker::remote::volume_exists(engine, &volume, verbose)? {
Expand Down

0 comments on commit a6b54fe

Please sign in to comment.