Skip to content

Commit

Permalink
Try #878: --target cross
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Jun 28, 2022
2 parents eb2b8ad + 6f5b904 commit 7d110bb
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ jobs:
- { target: thumbv7em-none-eabi, os: ubuntu-latest, std: 1 }
- { target: thumbv7em-none-eabihf, os: ubuntu-latest, std: 1 }
- { target: thumbv7m-none-eabi, os: ubuntu-latest, std: 1 }
- { target: cross, os: ubuntu-latest }
build:
name: target (${{ matrix.pretty }},${{ matrix.os }})
Expand Down Expand Up @@ -261,7 +262,7 @@ jobs:
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
shell: bash
- name: Set Docker image for test
if: steps.prepare-meta.outputs.has-image
if: steps.prepare-meta.outputs.has-image && ${{ matrix.target }} != 'cross'
run: |
TARGET_VAR="cross_target_${TARGET//-/_}_image"
echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}"
Expand All @@ -270,7 +271,7 @@ jobs:
IMAGE: ${{ steps.build-docker-image.outputs.image }}
shell: bash
- name: Test Image
if: steps.prepare-meta.outputs.has-image && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying')
if: (steps.prepare-meta.outputs.has-image && (github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying')) && ${{ matrix.target }} != 'cross'
run: ./ci/test.sh
env:
TARGET: ${{ matrix.target }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - ReleaseDate

### Added

- #878 - added a dockerfile containing cross.

### Changed

- #869 - ensure cargo configuration environment variable flags are passed to the docker container.
Expand Down
11 changes: 11 additions & 0 deletions docker/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM docker:20.10-dind

RUN apk add curl bash libgcc gcc musl-dev git

RUN curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# need to ensure cargo is in the path when we run this command,
# since we won't be sourcing the profile.
RUN PATH="$HOME/.cargo/bin:$PATH" cargo install cross --git https://github.com/cross-rs/cross --locked

COPY cross-entry.sh /
ENTRYPOINT ["/cross-entry.sh"]
7 changes: 7 additions & 0 deletions docker/cross-entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# shellcheck disable=SC1090
. ~/.cargo/env
export CROSS_CONTAINER_IN_CONTAINER=1

exec "${@}"
14 changes: 14 additions & 0 deletions docker/cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

main() {
apk add gcc curl musl-dev

curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
PATH="$HOME/.cargo/bin:$PATH" cargo install cross --git https://github.com/cross-rs/cross --locked

apk del gcc curl musl-dev

rm -rf "${0}"
}

main "${@}"

0 comments on commit 7d110bb

Please sign in to comment.