# Official language image. Look for the different tagged releases at: # https://hub.docker.com/r/library/rust/tags/ image: "rust:latest" # Optional: Pick zero or more services to be used on all builds. # Only needed when using a docker container to run your tests in. # Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service # services: # - mysql:latest # - redis:latest # - postgres:latest variables: GIT_SUBMODULE_STRATEGY: recursive # CARGO_HOME: $CI_PROJECT_DIR/cargo APT_CACHE_DIR: $CI_PROJECT_DIR/apt # install build dependencies before_script: - apt-get update -y - apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -y --no-install-recommends capnproto build-essential cmake clang libclang-dev libgsasl7-dev - rustup update - rustup component add rustfmt - rustup component add clippy # Use clippy to lint the project lint:clippy: allow_failure: true script: - rustc --version && cargo --version # Print version info for debugging - cargo clippy -- -D warnings only: - master - development - merge_requests tags: - linux - docker # Use rustfmt to check formating of the project lint:fmt: allow_failure: true script: - rustc --version && cargo --version # Print version info for debugging - cargo fmt -- --check # TODO: Do we want to enforce formating? only: - master - development - merge_requests tags: - linux - docker # Use cargo to test the project test:cargo: script: - rustc --version && cargo --version # Print version info for debugging - cargo test --workspace --verbose only: - master - development - merge_requests tags: - linux - docker build:docker-master: image: name: gcr.io/kaniko-project/executor:v1.6.0-debug entrypoint: [""] before_script: - '' script: - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - /kaniko/executor --force --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest only: - master tags: - linux - docker build:docker-releases: image: name: gcr.io/kaniko-project/executor:v1.6.0-debug entrypoint: [""] before_script: - '' script: - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - /kaniko/executor --force --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG only: - tags tags: - linux - docker build:binary-development: image: rust:latest before_script: - cp cargo-cross-config /usr/local/cargo/config - dpkg --add-architecture armhf - dpkg --add-architecture armel - apt-get update -y - apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -y libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armel-cross libc6-dev-armel-cross gcc-arm-linux-gnueabi g++-arm-linux-gnueabi - apt-get install -o dir::cache::archives="$APT_CACHE_DIR" -y --no-install-recommends capnproto build-essential cmake clang libclang-dev libgsasl7-dev libgsasl7-dev:armhf libssl-dev:armhf libgsasl7-dev:armel libssl-dev:armel - rustup target add armv7-unknown-linux-gnueabihf - rustup target add arm-unknown-linux-gnueabihf script: - cargo update - cargo build --target arm-unknown-linux-gnueabihf - cargo build --target armv7-unknown-linux-gnueabihf - cargo build --target x86_64-unknown-linux-gnu - ls target/armv7-unknown-linux-gnueabihf - ls target/x86_64-unknown-linux-gnu artifacts: paths: - target/armv7-unknown-linux-gnueabihf/debug - target/x86_64-unknown-linux-gnu/debug - target/arm-unknown-linux-gnueabihf/debug # only: # - development tags: - linux - docker # cache dependencies and build environment to speed up setup cache: key: "$CI_COMMIT_REF_SLUG" paths: - apt/ # - cargo/ - target/