Skip to content

Commit

Permalink
Various small fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
eranrund committed Feb 27, 2024
1 parent 0f5cd44 commit bce06bd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
39 changes: 31 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,44 @@
default:
@just --list --unsorted --color=always

_build channel:
docker build --build-arg CHANNEL="{{channel}}" -t clux/muslrust:temp .
# Build the stable container locally tagged as :temp
build-stable: (_build "stable")
# Build the nightly container locally tagged as :temp
build-nightly: (_build "nightly")
_build channel ar platform ext:
docker build --build-arg CHANNEL="{{channel}}" --build-arg AR="{{ar}}" --platform="{{platform}}" -t rustmusl-temp . -f Dockerfile.{{ext}}
# Build the stable x86 container
build-stable-amd: (_build "stable" "amd64" "linux/amd64" "x86_64")
# Build the nightly x86 container
build-nightly-amd: (_build "nightly" "amd64" "linux/amd64" "x86_64")
# Build the stable arm container
build-stable-arm: (_build "stable" "arm64" "linux/arm64" "arm64")
# Build the nightly arm container
build-nightly-arm: (_build "nightly" "arm64" "linux/arm64" "arm64")

# Shell into the built container
run:
docker run -v $PWD/test:/volume -w /volume -it clux/muslrust:temp /bin/bash
docker run -v $PWD/test:/volume -w /volume -it rustmusl-temp /bin/bash

# Test an individual crate against built containr
test-setup:
docker build -t test-runner . -f Dockerfile.test-runner

# Test an individual crate against built container
_t crate:
./test.sh {{crate}}

# when running locally use one of these instead of _t
_t_amd crate:
#!/bin/bash
# TODO: make a variant for arm here, or do platform inference
export PLATFORM="linux/amd64"
export TARGET_DIR="x86_64-unknown-linux-musl"
export AR="amd64"
./test.sh {{crate}}
_t_arm crate:
#!/bin/bash
export PLATFORM="linux/arm64"
export TARGET_DIR="aarch64-unknown-linux-musl"
export AR="arm64"
./test.sh {{crate}}


# Test all crates against built container
test: (_t "plain") (_t "ssl") (_t "rustls") (_t "pq") (_t "serde") (_t "curl") (_t "zlib") (_t "hyper") (_t "dieselpg") (_t "dieselsqlite")

Expand Down
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ docker_build() {
-v cargo-cache:/root/.cargo/registry \
-e RUST_BACKTRACE=1 \
-e AR=ar \
--platform $PLATFORM \
--platform "${PLATFORM}" \
rustmusl-temp \
cargo build

Expand All @@ -24,7 +24,7 @@ docker_build() {
docker run --rm \
-v "$PWD:/volume" \
-e RUST_BACKTRACE=1 \
--platform $PLATFORM \
--platform "${PLATFORM}" \
test-runner \
bash -c "cd volume; ./target/$TARGET_DIR/debug/${crate} && file ./target/$TARGET_DIR/debug/${crate} && file /volume/target/$TARGET_DIR/debug/${crate} 2>&1 | grep -qE 'static-pie linked|statically linked' && echo ${crate} is a static executable"
}
Expand Down

0 comments on commit bce06bd

Please sign in to comment.