Update GitLab CI configuration
This commit is contained in:
parent
3ebc936b10
commit
3c8e8453e6
105
.gitlab-ci.yml
105
.gitlab-ci.yml
|
@ -1,37 +1,98 @@
|
||||||
image: "rust:latest"
|
image: "debian:stretch-slim"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- prepare
|
||||||
- deploy
|
- build
|
||||||
|
- publish
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
CARGO_HOME: $CI_PROJECT_DIR/.cargo
|
RUSTUP_HOME: "$CI_PROJECT_DIR/.rustup"
|
||||||
|
CARGO_HOME: "$CI_PROJECT_DIR/.cargo"
|
||||||
|
|
||||||
.cached: &cached
|
.write_cache:
|
||||||
cache:
|
cache:
|
||||||
key: $CI_COMMIT_REF_NAME
|
key: "$CI_COMMIT_REF_SLUG-rustup"
|
||||||
untracked: true
|
|
||||||
paths:
|
paths:
|
||||||
- target/
|
- .rustup
|
||||||
- .cargo/
|
- .cargo
|
||||||
|
|
||||||
.test_job: &test_job
|
.read_cache:
|
||||||
<<: *cached
|
cache:
|
||||||
environment: test
|
key: "$CI_COMMIT_REF_SLUG-rustup"
|
||||||
stage: test
|
paths:
|
||||||
|
- .rustup
|
||||||
|
- .cargo
|
||||||
|
policy: pull
|
||||||
|
|
||||||
.deploy_job: &deploy_job
|
.toolchain-stable:
|
||||||
<<: *cached
|
extends: .read_cache
|
||||||
environment: deploy
|
before_script:
|
||||||
stage: deploy
|
- apt-get update
|
||||||
|
- apt-get install -y --no-install-recommends ca-certificates libssl-dev libc6-dev pkg-config gcc
|
||||||
|
- export PATH="$CARGO_HOME/bin:$PATH"
|
||||||
|
- rustup default stable
|
||||||
|
|
||||||
test:rust-stable:
|
.toolchain-nightly:
|
||||||
<<: *test_job
|
extends: .read_cache
|
||||||
|
allow_failure: true
|
||||||
|
before_script:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y --no-install-recommends ca-certificates libssl-dev libc6-dev pkg-config gcc
|
||||||
|
- export PATH="$CARGO_HOME/bin:$PATH"
|
||||||
|
- rustup default nightly
|
||||||
|
|
||||||
|
.build-only-when-changes: &build-only-when-changes
|
||||||
|
only:
|
||||||
|
changes:
|
||||||
|
- Cargo.toml
|
||||||
|
- Cargo.lock
|
||||||
|
- src/**/*.rs
|
||||||
|
|
||||||
|
####### Jobs #######
|
||||||
|
|
||||||
|
install-rust:
|
||||||
|
extends: .write_cache
|
||||||
|
stage: prepare
|
||||||
script:
|
script:
|
||||||
- cargo test --all
|
- apt-get update
|
||||||
|
- apt-get install -y --no-install-recommends ca-certificates curl
|
||||||
|
- curl https://sh.rustup.rs > rustup.sh
|
||||||
|
- sh rustup.sh -y --default-host x86_64-unknown-linux-gnu
|
||||||
|
- export PATH="$CARGO_HOME/bin:$PATH"
|
||||||
|
- rustup install stable
|
||||||
|
- rustup install nightly
|
||||||
|
<<: *build-only-when-changes
|
||||||
|
|
||||||
deploy:crates-io:
|
build-stable-no-default-features:
|
||||||
<<: *deploy_job
|
extends: .toolchain-stable
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- cargo test --tests --no-default-features
|
||||||
|
<<: *build-only-when-changes
|
||||||
|
|
||||||
|
build-stable-features-rich_presence:
|
||||||
|
extends: .toolchain-stable
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- cargo test --tests --no-default-features
|
||||||
|
--features "rich_presence"
|
||||||
|
- cargo test --no-default-features
|
||||||
|
--features "rich_presence"
|
||||||
|
--example "discord_presence"
|
||||||
|
--example "discord_presence_subscribe"
|
||||||
|
<<: *build-only-when-changes
|
||||||
|
|
||||||
|
build-nightly:
|
||||||
|
extends: .toolchain-nightly
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- cargo test --tests
|
||||||
|
- cargo test --examples
|
||||||
|
<<: *build-only-when-changes
|
||||||
|
|
||||||
|
deploy-crates-io:
|
||||||
|
extends: .toolchain-stable
|
||||||
|
stage: publish
|
||||||
script:
|
script:
|
||||||
- cargo publish --token $CRATES_IO_API_TOKEN
|
- cargo publish --token $CRATES_IO_API_TOKEN
|
||||||
only:
|
only:
|
||||||
|
|
14
.travis.yml
14
.travis.yml
|
@ -1,14 +0,0 @@
|
||||||
language: rust
|
|
||||||
cache: cargo
|
|
||||||
rust:
|
|
||||||
- stable
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- rust: nightly
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
script:
|
|
||||||
- cargo test --all
|
|
||||||
- cargo test --examples
|
|
Loading…
Reference in New Issue