Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
cargo-contract
Commits
01e01a61
Unverified
Commit
01e01a61
authored
Mar 16, 2022
by
João Paulo Silva de Souza
Committed by
GitHub
Mar 16, 2022
Browse files
gitspiegel test
parent
9362c045
Changes
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
01e01a61
# .gitlab-ci.yml
#
# cargo-contract
#
# pipelines can be triggered manually in the web
stages
:
-
check
-
test
-
build
variables
:
GIT_STRATEGY
:
fetch
GIT_DEPTH
:
"
100"
CARGO_HOME
:
"
/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
CARGO_TARGET_DIR
:
"
/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
RUST_LIB_BACKTRACE
:
"
0"
# this var is changed to "-:staging" when the CI image gets rebuilt
# read more https://github.com/paritytech/cargo-contract/pull/115
CI_IMAGE
:
"
paritytech/contracts-ci-linux:production"
workflow
:
rules
:
-
if
:
$CI_COMMIT_TAG
-
if
:
$CI_COMMIT_BRANCH
.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
image
:
"
${CI_IMAGE}"
before_script
:
-
cargo -vV
-
rustc -vV
-
rustup show
-
cargo dylint --version
-
bash --version
-
./scripts/ci/pre_cache.sh
# global RUSTFLAGS overrides the linker args so this way is better to pass the flags
-
printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' > ${CARGO_HOME}/config
-
sccache -s
-
git show
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "web"
-
if
:
$CI_PIPELINE_SOURCE == "schedule"
-
if
:
$CI_COMMIT_REF_NAME == "master"
-
if
:
$CI_COMMIT_REF_NAME == "tags"
-
if
:
$CI_COMMIT_REF_NAME =~ /^[0-9]+$/
# PRs
-
if
:
$CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/
# i.e. v1.0, v2.1rc1
dependencies
:
[]
interruptible
:
true
retry
:
max
:
2
when
:
-
runner_system_failure
-
unknown_failure
-
api_failure
tags
:
-
linux-docker
#### stage: check
# be aware that the used image has cargo-contract installed
fmt
:
stage
:
check
<<
:
*docker-env
script
:
-
cargo fmt --verbose --all -- --check
clippy
:
stage
:
check
<<
:
*docker-env
script
:
-
cargo clippy --verbose --all-targets --all-features -- -D warnings;
#### stage: test (all features)
test-dylint
:
stage
:
test
<<
:
*docker-env
script
:
-
cd ink_linting/
-
mv _Cargo.toml Cargo.toml
# Installing these components here is necessary because
# `ink_linting/` has a fixed `rust-toolchain` file.
# We can't move this line to the Docker container, since
# that would then make it impossible to upgrade the
# `ink_linting/rust-toolchain` file while still having
# this CI job succeed.
-
rustup component add rustfmt clippy rust-src
-
cargo check --verbose
-
cargo fmt --verbose --all -- --check
-
cargo clippy --verbose -- -D warnings;
# Needed until https://github.com/mozilla/sccache/issues/1000 is fixed.
-
unset RUSTC_WRAPPER
-
cargo test --verbose --all-features
test
:
stage
:
test
<<
:
*docker-env
script
:
-
cargo test --verbose --workspace --all-features
test-new-project-template
:
stage
:
test
<<
:
*docker-env
script
:
-
cargo run -- contract new new_project
# needed because otherwise:
# `error: current package believes it's in a workspace when it's not`
-
echo "[workspace]" >> new_project/Cargo.toml
-
cargo run --all-features -- contract build --manifest-path new_project/Cargo.toml
-
cargo run --all-features -- contract check --manifest-path new_project/Cargo.toml
-
cargo run --all-features -- contract test --manifest-path new_project/Cargo.toml
-
cd new_project
-
cargo check --verbose
-
cargo test --verbose --all
-
cargo fmt --verbose --all -- --check
-
cargo clippy --verbose --manifest-path Cargo.toml -- -D warnings;
# With the introduction of `ink_linting` in `build.rs` the installation process
# is more elaborate now and as part of it the `ink_linting` crate is built locally.
# We introduced this CI job to make sure that publishing to a registry and installing
# from it will work correctly.
test-registry-publish-install
:
stage
:
test
<<
:
*docker-env
before_script
:
# Set up a local registry.
-
mkdir -p ./estuary/crates/ ./estuary/indices/
-
estuary --base-url=http://0.0.0.0:7878 --crate-dir ./estuary/crates/ --index-dir ./estuary/indices &
-
mkdir .cargo
-
echo -e '[registries]\nestuary = { index = "http://0.0.0.0:7878/git/index" }' > .cargo/config.toml
-
echo 0000 | cargo login --registry estuary
script
:
-
cargo publish --registry estuary
-
cargo install cargo-contract --index http://0.0.0.0:7878/git/index
# Simple smoke testing to check if basic `check` functionality works.
-
cargo run -- contract new new_project
-
echo "[workspace]" >> new_project/Cargo.toml
-
cargo run --all-features -- contract check --manifest-path new_project/Cargo.toml
#### stage: build (default features)
build
:
stage
:
build
<<
:
*docker-env
<<
:
*collect-artifacts
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "web"
-
if
:
$CI_PIPELINE_SOURCE == "schedule"
-
if
:
$CI_COMMIT_REF_NAME == "master"
-
if
:
$CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/
# i.e. v1.0, v2.1rc1
script
:
-
cargo build --verbose --release
after_script
:
-
mkdir -p ./artifacts/cargo-contract/
-
cp ${CARGO_TARGET_DIR}/release/cargo-contract ./artifacts/cargo-contract/
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment