Skip to content

Commit 14d95f4

Browse files
authored
Try #878: --target cross
2 parents eb2b8ad + 06c143e commit 14d95f4

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

.github/workflows/ci.yml

+3-2
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 }})
@@ -261,7 +262,7 @@ jobs:
261262
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
262263
shell: bash
263264
- name: Set Docker image for test
264-
if: steps.prepare-meta.outputs.has-image
265+
if: steps.prepare-meta.outputs.has-image && ${{ matrix.target != 'cross' }}
265266
run: |
266267
TARGET_VAR="cross_target_${TARGET//-/_}_image"
267268
echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}"
@@ -270,7 +271,7 @@ jobs:
270271
IMAGE: ${{ steps.build-docker-image.outputs.image }}
271272
shell: bash
272273
- name: Test Image
273-
if: steps.prepare-meta.outputs.has-image && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying')
274+
if: (steps.prepare-meta.outputs.has-image && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying')) && ${{ matrix.target != 'cross' }}
274275
run: ./ci/test.sh
275276
env:
276277
TARGET: ${{ matrix.target }}

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.

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)