.rust-template: &rust-template
image: "rust:1.28.0"
variables:
GIT_SUBMODULE_STRATEGY: recursive
CARGO_HOME: $CI_PROJECT_DIR/cargo
before_script:
- rustc --version && cargo --version
cache:
paths:
- target/
- $CARGO_HOME
compile-test:
<<: *rust-template
stage: build
script:
- cargo build --verbose --all
- cargo test --verbose --all
generate-docs:
<<: *rust-template
stage: build
script:
- cargo doc --all
- cp -R target/doc ./crate-docs
- echo "<meta http-equiv=refresh content=0;url=anpp/index.html>" > ./crate-docs/index.html
artifacts:
paths:
- crate-docs
only:
- master
generate-benchmarks:
<<: *rust-template
stage: build
script:
- apt-get update && apt-get install -y gnuplot
- cargo bench
- cp -R target/criterion ./benchmarks
- echo "<meta http-equiv=refresh content=0;url=report/index.html>" > ./benchmarks/index.html
artifacts:
paths:
- benchmarks
only:
- master
pages:
stage: deploy
dependencies:
- generate-docs
- generate-benchmarks
only:
- master
script:
- mkdir public
- mv benchmarks public
- mv crate-docs public
- echo "<meta http-equiv=refresh content=0;url=crate-docs/index.html>" > ./public/index.html
artifacts:
paths:
- public