Newer
Older
variables:
GIT_DEPTH: "3"
SIMPLECOV: "true"
RUST_BACKTRACE: "1"
RUSTFLAGS: " -C link-arg=-s"
GIT_STRATEGY: pull
GIT_SUBMODULE_STRATEGY: recursive
CARGO_TARGET: x86_64-unknown-linux-gnu
key: "$CI_BUILD_STAGE-$CI_BUILD_REF_NAME"
.test_tags: &test_tags #branches and tags for test stage
.no_git: &no_git # disable git strategy
variables:
GIT_STRATEGY: none
GIT_SUBMODULE_STRATEGY: none
.releaseable_branches: # list of git refs for building GitLab artifacts (think "pre-release binaries")
only: &releaseable_branches
- stable
- beta
- tags
- schedules
- master
.collect_artifacts: &collect_artifacts
artifacts:
name: "${CI_JOB_NAME}_${SCHEDULE_TAG:-${CI_COMMIT_REF_NAME}}"
when: on_success
expire_in: 12 mos
paths:
- artifacts/
<<: *test_tags
- echo 'Building in release mode' && echo -en 'gitlab_fold:start:build.release'
- time cargo build --release && strip target/release/pbtc
- echo 'gitlab_fold:end:build.release'
- echo 'Running regtests from ./tools/regtests.sh' && echo -en 'gitlab_fold:start:regtests'
- time ./tools/regtests.sh
- echo -en 'gitlab_fold:end:regtests'
- echo 'Running bench from ./tools/bench.sh' && echo -en 'gitlab_fold:start:bench'
- time ./tools/bench.sh
- echo -en 'gitlab_fold:end:bench'
- echo 'Running tests' && echo -en 'gitlab_fold:start:tests'
- time cargo test --all
- echo -en 'gitlab_fold:end:tests'
<<: *test_tags
script:
- rustup default beta
- echo 'Running check'
<<: *test_tags
only: *releaseable_branches
script:
- git submodule update --init
- echo 'Building in release mode' && echo -en 'gitlab_fold:start:build.release'
- time cargo build --target $CARGO_TARGET -p pbtc --release
- md5sum target/$CARGO_TARGET/release/pbtc > pbtc.md5
- echo -en 'gitlab_fold:end:build.release'
- echo 'Running regtests from ./tools/regtests.sh' && echo -en 'gitlab_fold:start:regtests'
- echo -en 'gitlab_fold:end:regtests'
- echo 'Running bench from ./tools/bench.sh' && echo -en 'gitlab_fold:start:bench'
- ./tools/bench.sh
- echo -en 'gitlab_fold:end:bench'
- sh tools/deb_build.sh amd64
- cp target/$CARGO_TARGET/release/pbtc deb/usr/bin/pbtc
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
- dpkg-deb -b deb "pbtc_"$VER"_amd64.deb"
- md5sum "pbtc_"$VER"_amd64.deb" > "pbtc_"$VER"_amd64.deb.md5"
- echo "_____ Post-processing binaries _____"
- rm -rf artifacts/*
- mkdir -p artifacts/$CARGO_TARGET
- cd artifacts/$CARGO_TARGET
- cp -v ../../target/$CARGO_TARGET/release/pbtc pbtc
- cp -v ../../pbtc_"$VER"_amd64.deb pbtc_"$VER"_amd64.deb
- cp -v ../../pbtc.md5 pbtc.md5
- cp -v ../../pbtc_"$VER"_amd64.deb.md5 pbtc_"$VER"_amd64.deb.md5
tags:
- linux-docker
<<: *collect_artifacts
stage: publish
only: *releaseable_branches
<<: *no_git
cache: {}
dependencies:
- build-linux