image: "rust:slim"
stages:
- check
- build
- test
- release
variables:
RUST_VERSION: stable
RUST_TARGET: x86_64-unknown-linux-gnu
cache:
key: "$CI_PIPELINE_ID-$RUST_VERSION"
paths:
- /usr/local/cargo/registry/
- /usr/local/rustup/toolchains/
- /usr/local/rustup/update-hashes/
- target/
before_script:
- apt-get update
- apt-get install -y --no-install-recommends xorg-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev python3
- |
rustup install $RUST_VERSION
rustup default $RUST_VERSION
- |
rustc --version
cargo --version
.check-base: &check-base
stage: check
script:
- cargo update
- cargo check --verbose
- cargo check --no-default-features --verbose
- cargo check --no-default-features --features osc52 --verbose
- cargo check --no-default-features --features x11-bin --verbose
- cargo check --no-default-features --features x11-fork --verbose
- cargo check --no-default-features --features wayland-bin --verbose
check-stable:
<<: *check-base
check-beta:
<<: *check-base
variables:
RUST_VERSION: beta
check-nightly:
<<: *check-base
variables:
RUST_VERSION: nightly
check-old:
<<: *check-base
variables:
RUST_VERSION: "1.57.0"
build-x86_64-linux-gnu:
stage: build
needs:
- check-stable
script:
- cargo build --target=$RUST_TARGET --release --verbose
test-cargo:
stage: test
needs:
- check-stable
dependencies: []
script:
- apt-get install -y --no-install-recommends libx11-xcb-dev libgl1-mesa-dev
- cargo test --verbose
release-crate:
stage: release
dependencies: []
only:
- /^v(\d+\.)*\d+$/
script:
- echo "Creating release crate to publish on crates.io..."
- echo $CARGO_TOKEN | cargo login
- echo "Publishing crate to crates.io..."
- cargo publish --verbose --allow-dirty