Skip to content

Commit

Permalink
use cross on linux
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Prendes <[email protected]>
  • Loading branch information
jprendes committed Oct 4, 2023
1 parent 2ef1c0c commit 4f5f18b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/action-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ jobs:
shell: bash
- uses: actions-rust-lang/setup-rust-toolchain@v1
env:
RUST_CACHE_KEY_OS: ${{ inputs.os }}
RUST_CACHE_KEY_OS: ${{ inputs.os }}-musl
with:
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
- name: Setup cross
run: ./scripts/setup-cross.sh
shell: bash
- name: Build
run: make build-${{ inputs.runtime }}
- name: Validate docs
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/action-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
./scripts/setup-$os.sh
shell: bash
- name: Setup cross
run: ./scripts/setup-cross.sh
shell: bash
- run:
# needed to run rustfmt in nightly toolchain
rustup toolchain install nightly --component rustfmt
Expand Down
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ install: $(RUNTIMES:%=install-%);

install-%: build-%
mkdir -p $(PREFIX)/bin
$(INSTALL) target/$(OPT_PROFILE)/containerd-shim-$*-v1 $(PREFIX)/bin/
$(INSTALL) target/$(TARGET)/$(OPT_PROFILE)/containerd-shim-$*-v1 $(PREFIX)/bin/
$(LN) ./containerd-shim-$*-v1 $(PREFIX)/bin/containerd-shim-$*d-v1
$(LN) ./containerd-shim-$*-v1 $(PREFIX)/bin/containerd-$*d

Expand Down
2 changes: 1 addition & 1 deletion crates/containerd-shim-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ wat = { workspace = true }
[target.'cfg(unix)'.dependencies]
caps = "0.5"
dbus = { version = "*", features = ["vendored"] }
libcontainer = { workspace = true, features = ["systemd", "v1", "v2"]}
libcontainer = { workspace = true, features = ["libseccomp", "systemd", "v1", "v2"]}
nix = { workspace = true, features = ["sched", "mount"] }

[target.'cfg(windows)'.dependencies]
Expand Down
4 changes: 3 additions & 1 deletion cross/Dockerfile.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ FROM $CROSS_BASE_IMAGE
ARG CROSS_DEB_ARCH
RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && \
apt-get -y update && \
apt-get install -y pkg-config libseccomp-dev:${CROSS_DEB_ARCH}
apt-get install -y \
pkg-config protobuf-compiler \
libseccomp-dev:${CROSS_DEB_ARCH}
2 changes: 1 addition & 1 deletion cross/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ rustflags = ["-Clink-arg=-lgcc"]
EOF

RUN apt-get -y update && \
apt-get install -y pkg-config
apt-get install -y pkg-config protobuf-compiler
5 changes: 5 additions & 0 deletions scripts/setup-cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
cargo install cross --git https://github.com/cross-rs/cross
TARGET=$(cargo version -v | grep '^host:' | sed -E 's|host: (.*)|\1|;s|-gnu|-musl|')
echo "TARGET=$TARGET" >> $GITHUB_ENV
echo "CARGO=cross" >> $GITHUB_ENV

0 comments on commit 4f5f18b

Please sign in to comment.