Newer
Older
# .gitlab-ci.yml
#
# ink
#
# pipelines can be triggered manually in the web
stages:
CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
ALL_CRATES: "core alloc prelude primitives lang lang/macro"
.collect-artifacts: &collect-artifacts
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 7 days
paths:
- artifacts/
.docker-env: &docker-env
- mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config
# global RUSTFLAGS overrides the linker args so this way is better to pass the flags
- printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' | tee ${CARGO_HOME}/config
# if there is no directory for this $CI_COMMIT_REF_NAME/$CI_JOB_NAME
# create such directory and
# create hardlinks recursively of all the files from the master/$CI_JOB_NAME if it exists
- if [[ ! -d $CARGO_TARGET_DIR ]]; then
mkdir -p /ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME};
cp -al /ci-cache/${CI_PROJECT_NAME}/targets/${CI_DEFAULT_BRANCH}/${CI_JOB_NAME}
/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME} ||
echo "_____No such target dir, proceeding from scratch_____";
fi
- sccache -s
only:
- master
- /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- schedules
- web
- /^[0-9]+$/ # PRs
- runner_system_failure
- unknown_failure
- api_failure
cargo check --verbose --all-features --manifest-path ${crate}/Cargo.toml;
Andrew Jones
committed
- for crate in ${ALL_CRATES}; do
cargo check --verbose --no-default-features --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
done
cargo build --verbose --all-features --release --manifest-path ${crate}/Cargo.toml;
Andrew Jones
committed
- for crate in ${ALL_CRATES}; do
cargo build --verbose --no-default-features --release --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
done
cargo test --verbose --all-features --release --manifest-path ${crate}/Cargo.toml;
cargo +nightly-2020-02-01 clippy --verbose --all-features --manifest-path ${crate}/Cargo.toml -- -D warnings;
Andrew Jones
committed
- for crate in ${ALL_CRATES}; do
cargo +nightly-2020-02-01 clippy --verbose --no-default-features --manifest-path ${crate}/Cargo.toml --target wasm32-unknown-unknown -- -D warnings;
.update-cargo-contract: &update-cargo-contract
# `cargo install` returns an error if there is nothing to update, so have to supress it here temporarily
- cargo install --git https://github.com/paritytech/cargo-contract || echo $?
- cargo contract -V
- for example in examples/*/; do
cargo test --verbose --manifest-path ${example}/Cargo.toml;
- for example in examples/*/; do
cargo fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
- for example in examples/*/; do
cargo +nightly-2020-02-01 clippy --verbose --manifest-path ${example}/Cargo.toml -- -D warnings;
done
examples-clippy-wasm:
stage: examples
<<: *docker-env
script:
- for example in examples/*/; do
cargo +nightly-2020-02-01 clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
done
examples-contract-build:
stage: examples
<<: *docker-env
script:
- for example in examples/*/; do
pushd $example &&
cargo contract build &&
popd;
done
- for example in examples/*/; do
#### stage: publish
publish-docs:
stage: publish
<<: *docker-env
only:
- master
- schedules
- tags
script:
# Set git config
- rm .git/config
- git config user.email "devops-team@parity.io"
- git config user.name "${GITHUB_USER}"
- git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/ink.git"
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch origin gh-pages
- time cargo +nightly doc --no-deps --all-features
-p type-metadata -p ink_abi -p ink_abi_derive -p ink_core -p ink_core_derive
-p ink_primitives -p ink_prelude -p ink_lang -p ink_lang_macro
# saving README and docs
- mv target/doc/ /tmp/
- cp README.md /tmp/doc/
- mv _config.yml /tmp/doc/
# remove everything and restore generated docs, README and Jekyll config
- git commit -m "Updated docs for ${CI_COMMIT_REF_NAME} and pushed to gh-pages"