Skip to content

Commit 896494f

Browse files
authored
Try #878: --target cross
2 parents eb2b8ad + 9feaad7 commit 896494f

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ jobs:
204204
- { target: thumbv7em-none-eabi, os: ubuntu-latest, std: 1 }
205205
- { target: thumbv7em-none-eabihf, os: ubuntu-latest, std: 1 }
206206
- { target: thumbv7m-none-eabi, os: ubuntu-latest, std: 1 }
207+
- { target: cross, os: ubuntu-latest }
207208
208209
build:
209210
name: target (${{ matrix.pretty }},${{ matrix.os }})

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased] - ReleaseDate
99

10+
### Added
11+
12+
- #878 - added a dockerfile containing cross.
13+
1014
### Changed
1115

1216
- #869 - ensure cargo configuration environment variable flags are passed to the docker container.

ci/test.sh

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ set -euo pipefail
88
# installed version on macOS. likewise, "${var[@]}" is an unbound
99
# error if var is an empty array.
1010

11+
if [[ "${TARGET}" == "cross" ]]; then
12+
exit 0
13+
fi
14+
1115
function retry {
1216
local tries="${TRIES-5}"
1317
local timeout="${TIMEOUT-1}"

docker/Dockerfile.cross

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM docker:20.10-dind
2+
3+
RUN apk add curl bash libgcc gcc musl-dev git
4+
5+
RUN curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
6+
# need to ensure cargo is in the path when we run this command,
7+
# since we won't be sourcing the profile.
8+
RUN PATH="$HOME/.cargo/bin:$PATH" cargo install cross --git https://github.com/cross-rs/cross --locked
9+
10+
COPY cross-entry.sh /
11+
ENTRYPOINT ["/cross-entry.sh"]

docker/cross-entry.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# shellcheck disable=SC1090
4+
. ~/.cargo/env
5+
export CROSS_CONTAINER_IN_CONTAINER=1
6+
7+
exec "${@}"

docker/cross.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
main() {
4+
apk add gcc curl musl-dev
5+
6+
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
7+
PATH="$HOME/.cargo/bin:$PATH" cargo install cross --git https://github.com/cross-rs/cross --locked
8+
9+
apk del gcc curl musl-dev
10+
11+
rm -rf "${0}"
12+
}
13+
14+
main "${@}"

0 commit comments

Comments
 (0)