2021-06-01 02:58:50 +02:00
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
2021-07-02 14:26:26 +02:00
|
|
|
- publish artifacts
|
|
|
|
- release nightly
|
2021-05-13 09:57:11 +02:00
|
|
|
|
2021-03-13 20:00:13 +01:00
|
|
|
variables:
|
|
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
2021-05-13 09:57:11 +02:00
|
|
|
FF_USE_FASTZIP: 1
|
2021-07-02 14:26:26 +02:00
|
|
|
CACHE_COMPRESSION_LEVEL: fastest
|
2021-03-13 20:00:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
test:cargo:
|
2021-06-01 02:58:50 +02:00
|
|
|
stage: "test"
|
|
|
|
needs: []
|
|
|
|
image: "rust:latest"
|
|
|
|
variables:
|
|
|
|
CARGO_HOME: "cargohome"
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- cargohome
|
|
|
|
key: test_cache
|
|
|
|
interruptible: true
|
|
|
|
before_script:
|
|
|
|
- mkdir -p $CARGO_HOME && echo "using $CARGO_HOME to cache cargo deps"
|
|
|
|
- apt-get update -yqq
|
|
|
|
- apt-get install -yqq --no-install-recommends build-essential libssl-dev pkg-config
|
|
|
|
- rustup component add clippy rustfmt
|
2021-03-13 20:00:13 +01:00
|
|
|
script:
|
|
|
|
- rustc --version && cargo --version # Print version info for debugging
|
|
|
|
- cargo test --workspace --verbose --locked
|
2021-05-05 18:48:44 +02:00
|
|
|
- cargo fmt --all -- --check
|
2021-05-05 19:44:32 +02:00
|
|
|
- cargo clippy
|
2021-06-01 02:58:50 +02:00
|
|
|
|
2021-07-02 14:26:26 +02:00
|
|
|
# --------------------------------------------------------------------- #
|
|
|
|
# Cargo: Compiling for different architectures #
|
|
|
|
# --------------------------------------------------------------------- #
|
2021-06-01 02:58:50 +02:00
|
|
|
|
2021-07-02 14:26:26 +02:00
|
|
|
.build-cargo-shared-settings:
|
2021-06-01 02:58:50 +02:00
|
|
|
stage: "build"
|
|
|
|
needs: []
|
2021-07-02 14:26:26 +02:00
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
2021-06-01 02:58:50 +02:00
|
|
|
interruptible: true
|
|
|
|
image: "rust:latest"
|
|
|
|
cache:
|
|
|
|
paths:
|
2021-07-02 14:26:26 +02:00
|
|
|
- cargohome
|
2021-06-01 02:58:50 +02:00
|
|
|
- target/
|
|
|
|
key: "build_cache-$TARGET"
|
2021-07-02 14:26:26 +02:00
|
|
|
before_script:
|
|
|
|
- 'echo "Building for target $TARGET"'
|
|
|
|
- 'mkdir -p cargohome && CARGOHOME="cargohome"'
|
|
|
|
- "cat /etc/*-release && rustc --version && cargo --version" # Print version info for debugging
|
|
|
|
- 'apt-get update -yqq'
|
|
|
|
- 'echo "Installing packages: $NEEDED_PACKAGES"'
|
|
|
|
- "apt-get install -yqq --no-install-recommends $NEEDED_PACKAGES"
|
|
|
|
- "rustup target add $TARGET"
|
|
|
|
script:
|
|
|
|
- time cargo build --target $TARGET --release
|
|
|
|
- 'mv "target/$TARGET/release/conduit" "conduit-$TARGET"'
|
|
|
|
artifacts:
|
|
|
|
name: "conduit-$TARGET"
|
|
|
|
expose_as: "Binary"
|
|
|
|
paths:
|
|
|
|
- "conduit-$TARGET"
|
|
|
|
|
|
|
|
build:cargo:x86_64-unknown-linux-gnu:
|
|
|
|
extends: .build-cargo-shared-settings
|
2021-06-01 02:58:50 +02:00
|
|
|
variables:
|
2021-07-02 14:26:26 +02:00
|
|
|
TARGET: "x86_64-unknown-linux-gnu"
|
|
|
|
|
|
|
|
build:cargo:armv7-unknown-linux-gnueabihf:
|
|
|
|
extends: .build-cargo-shared-settings
|
|
|
|
variables:
|
|
|
|
TARGET: "armv7-unknown-linux-gnueabihf"
|
|
|
|
NEEDED_PACKAGES: "build-essential gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross"
|
2021-06-01 02:58:50 +02:00
|
|
|
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
|
|
|
|
CC_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
|
|
|
|
CXX_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-g++
|
2021-07-02 14:26:26 +02:00
|
|
|
|
|
|
|
build:cargo:aarch64-unknown-linux-gnu:
|
|
|
|
extends: .build-cargo-shared-settings
|
|
|
|
variables:
|
|
|
|
TARGET: "aarch64-unknown-linux-gnu"
|
|
|
|
NEEDED_PACKAGES: "build-essential gcc-8-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross"
|
2021-06-01 02:58:50 +02:00
|
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
|
|
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
|
|
|
|
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
|
2021-07-02 14:26:26 +02:00
|
|
|
TARGET_CC: "/usr/bin/aarch64-linux-gnu-gcc-8"
|
|
|
|
TARGET_AR: "/usr/bin/aarch64-linux-gnu-gcc-ar-8"
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------- #
|
|
|
|
# Cargo: Compiling deb packages for different architectures #
|
|
|
|
# --------------------------------------------------------------------- #
|
|
|
|
|
|
|
|
|
|
|
|
.build-cargo-deb-shared-settings:
|
|
|
|
stage: "build"
|
|
|
|
needs: []
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
|
|
interruptible: true
|
|
|
|
image: "rust:latest"
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- cargohome
|
|
|
|
- target/
|
|
|
|
key: "build_cache-deb-$TARGET"
|
2021-06-01 02:58:50 +02:00
|
|
|
before_script:
|
2021-07-02 14:26:26 +02:00
|
|
|
- 'echo "Building debian package for target $TARGET"'
|
|
|
|
- 'mkdir -p cargohome && CARGOHOME="cargohome"'
|
|
|
|
- "cat /etc/*-release && rustc --version && cargo --version" # Print version info for debugging
|
|
|
|
- 'apt-get update -yqq'
|
|
|
|
- 'echo "Installing packages: $NEEDED_PACKAGES"'
|
2021-06-01 02:58:50 +02:00
|
|
|
- "apt-get install -yqq --no-install-recommends $NEEDED_PACKAGES"
|
|
|
|
- "rustup target add $TARGET"
|
2021-07-02 14:26:26 +02:00
|
|
|
- "cargo install cargo-deb"
|
2021-06-01 02:58:50 +02:00
|
|
|
script:
|
2021-07-02 14:26:26 +02:00
|
|
|
- time cargo deb --target $TARGET
|
|
|
|
- 'mv target/$TARGET/debian/*.deb "conduit-$TARGET.deb"'
|
2021-06-01 02:58:50 +02:00
|
|
|
artifacts:
|
2021-07-02 14:26:26 +02:00
|
|
|
name: "conduit-$TARGET.deb"
|
|
|
|
expose_as: "Debian Package"
|
2021-06-01 02:58:50 +02:00
|
|
|
paths:
|
2021-07-02 14:26:26 +02:00
|
|
|
- "conduit-$TARGET.deb"
|
2021-06-01 02:58:50 +02:00
|
|
|
|
2021-07-02 14:26:26 +02:00
|
|
|
build:cargo-deb:x86_64-unknown-linux-gnu:
|
|
|
|
extends: .build-cargo-deb-shared-settings
|
|
|
|
variables:
|
|
|
|
TARGET: "x86_64-unknown-linux-gnu"
|
|
|
|
NEEDED_PACKAGES: ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --------------------------------------------------------------------- #
|
|
|
|
# Storing and releasing compiled binaries #
|
|
|
|
# --------------------------------------------------------------------- #
|
2021-06-01 02:58:50 +02:00
|
|
|
|
|
|
|
publish:package:
|
2021-07-02 14:26:26 +02:00
|
|
|
stage: "publish artifacts"
|
|
|
|
needs:
|
|
|
|
- "build:cargo:x86_64-unknown-linux-gnu"
|
|
|
|
- "build:cargo:armv7-unknown-linux-gnueabihf"
|
|
|
|
- "build:cargo:aarch64-unknown-linux-gnu"
|
|
|
|
- "build:cargo-deb:x86_64-unknown-linux-gnu"
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
2021-06-01 02:58:50 +02:00
|
|
|
image: curlimages/curl:latest
|
2021-07-02 14:26:26 +02:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: "none" # Don't need a clean copy of the code, we just operate on artifacts
|
2021-06-01 02:58:50 +02:00
|
|
|
script:
|
2021-07-02 14:26:26 +02:00
|
|
|
- 'BASE_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conduit-${CI_COMMIT_REF_SLUG}/build-${CI_PIPELINE_ID}"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file conduit-x86_64-unknown-linux-gnu "${BASE_URL}/conduit-x86_64-unknown-linux-gnu"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file conduit-armv7-unknown-linux-gnueabihf "${BASE_URL}/conduit-armv7-unknown-linux-gnueabihf"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file conduit-aarch64-unknown-linux-gnu "${BASE_URL}/conduit-aarch64-unknown-linux-gnu"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file conduit-x86_64-unknown-linux-gnu.deb "${BASE_URL}/conduit-x86_64-unknown-linux-gnu.deb"'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
publish:nightly:
|
|
|
|
stage: "release nightly"
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
needs:
|
|
|
|
- job: "publish:package"
|
|
|
|
artifacts: false
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: "none" # Don't need a clean copy of the code, we just operate on artifacts
|
|
|
|
script: "echo 'Releasing current state as release'"
|
|
|
|
rules:
|
|
|
|
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" # Run this job on the main branch
|
|
|
|
release:
|
|
|
|
name: 'Nightly'
|
|
|
|
description: '⚠️ The latest development version of the day, fresh from the repository. Use at your own risk!'
|
|
|
|
tag_name: '$CI_COMMIT_REF_SLUG'
|
|
|
|
assets:
|
|
|
|
links:
|
|
|
|
- name: 'conduit-x86_64-unknown-linux-gnu'
|
|
|
|
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conduit-${CI_COMMIT_REF_SLUG}/build-${CI_PIPELINE_ID}/conduit-x86_64-unknown-linux-gnu"
|
|
|
|
- name: 'conduit-armv7-unknown-linux-gnueabihf'
|
|
|
|
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conduit-${CI_COMMIT_REF_SLUG}/build-${CI_PIPELINE_ID}/conduit-armv7-unknown-linux-gnueabihf"
|
|
|
|
- name: 'conduit-aarch64-unknown-linux-gnu'
|
|
|
|
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conduit-${CI_COMMIT_REF_SLUG}/build-${CI_PIPELINE_ID}/conduit-aarch64-unknown-linux-gnu"
|
|
|
|
- name: 'conduit-x86_64-unknown-linux-gnu.deb'
|
|
|
|
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conduit-${CI_COMMIT_REF_SLUG}/build-${CI_PIPELINE_ID}/conduit-x86_64-unknown-linux-gnu.deb"
|