image: "rust:latest"
stages:
- check
- test
- deploy-examples
- publish
- post-run
clean-code:
stage: check
script:
- rustup component add rustfmt-preview
- cargo fmt --all -- --check
allow_failure: true
check:
stage: check
script:
- cargo check
unittests:
stage: test
script:
- cargo test --release
benchmarktests:
stage: test
script:
- cargo bench
linux-optimized:
stage: deploy-examples
script:
- cargo build --examples --release
- rm -r -f files
- mkdir files
when: on_success
artifacts:
paths:
- files
expire_in: 2 weeks
windows-optimized:
stage: deploy-examples
script:
- apt-get update
- apt-get install gcc -y
- apt-get install gcc-mingw-w64-x86-64 -y
- rustup component add rust-std --target=x86_64-pc-windows-gnu
- mkdir .cargo
- touch .cargo/config
- echo [target.x86_64-pc-windows-gnu] >> .cargo/config
- echo linker = \"x86_64-w64-mingw32-gcc\" >> .cargo/config
- echo ar = \"x86_64-w64-mingw32-gcc-ar\" >> .cargo/config
- cargo build --examples --release --target=x86_64-pc-windows-gnu
- rm -r -f files
- mkdir files
when: on_success
artifacts:
paths:
- files
expire_in: 2 weeks
cratesio:
stage: publish
script:
- rm -r -f files
- cargo login $CARGO_LOGIN
- cargo package
- cargo publish
when: on_success
only:
refs:
- stable
allow_failure: true
clippy:
stage: post-run
script:
- rustup component add clippy-preview
- cargo clippy
allow_failure: true