stages:
- build
- test
- deploy
variables:
CARGO_INCREMENTAL: "0"
RUSTC_WRAPPER: /sccache
SCCACHE_ENDPOINT: 192.168.1.202:7480
SCCACHE_S3_USE_SSL: "off"
SCCACHE_BUCKET: gitlab-sccache
default:
before_script:
- mkdir /sccache-dl
- |
curl -Ls "$(curl -s https://api.github.com/repos/mozilla/sccache/releases/latest | grep 'browser_download_url.*sccache-v.*x86_64.*musl.tar.gz"' | cut -d: -f2- | sed -e 's/^ "//' -e 's/"$//')" | tar -C /sccache-dl -zxvf -
- mv -vf /sccache-dl/*/sccache /sccache
- chmod 755 /sccache
- rm -Rvf /sccache-dl
- |
if [ -d .cargo ]; then
rm -Rvf /usr/local/cargo
time mv -f .cargo /usr/local/cargo
fi
after_script:
- time mv -f /usr/local/cargo .cargo
- /sccache -s
Build crate:
stage: build
image: rustlang/rust:nightly
cache:
- key: cargo
paths:
- .cargo
script:
- cargo update
- cargo build
- cargo build --features=parse-names
- cargo build --features=require-parse-names
- cargo clippy --no-deps
- cargo clippy --no-deps --features=parse-names
- cargo clippy --no-deps --features=require-parse-names
cargo test:
stage: test
image: rustlang/rust:nightly
cache:
- key: cargo
policy: pull
paths:
- .cargo
script:
- cargo test
- cargo test --features=parse-names
- cargo test --features=require-parse-names
cargo doc:
stage: test
image: rustlang/rust:nightly
cache:
- key: cargo
policy: pull
paths:
- .cargo
script:
- cargo doc --no-deps
- cargo doc --no-deps --features=parse-names
- cargo doc --no-deps --features=require-parse-names
Publish crate:
stage: deploy
image: rustlang/rust:nightly
cache:
- key: cargo
policy: pull
paths:
- .cargo
script:
- sh -c 'cargo login "${CARGO_TOKEN}" && cargo publish'
only:
- tags