From 856e75c8065d902feb04e5e79515ea5221b21257 Mon Sep 17 00:00:00 2001 From: Denis P Date: Wed, 8 Jan 2020 15:07:22 +0100 Subject: [PATCH 1/4] initial fail-fast CI with 3 stages --- .gitlab.ci.yml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .gitlab.ci.yml diff --git a/.gitlab.ci.yml b/.gitlab.ci.yml new file mode 100644 index 00000000..43fad9f5 --- /dev/null +++ b/.gitlab.ci.yml @@ -0,0 +1,81 @@ +# .gitlab-ci.yml +# +# cargo-contract +# +# pipelines can be triggered manually in the web + + +stages: + - check + - test + - build + +variables: + GIT_STRATEGY: fetch + GIT_DEPTH: "3" + 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}" + CI_SERVER_NAME: "GitLab CI" + REGISTRY: registry.parity.io/parity/infrastructure/scripts + +.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: ${REGISTRY}/ink-ci-linux:latest + before_script: + - cargo -vV + - rustc -vV + - rustup show + - bash --version + - mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config + - mkdir -p ${CARGO_TARGET_DIR} + # 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 + - sccache -s + only: + - master + - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 + - schedules + - web + - /^[0-9]+$/ # PRs + dependencies: [] + interruptible: true + retry: + max: 2 + when: + - runner_system_failure + - unknown_failure + - api_failure + tags: + - linux-docker + + +#### stage: check + +fmt: + stage: check + <<: *docker-env + script: + - cargo fmt --verbose --all -- --check + +#### stage: test + +test: + stage: test + <<: *docker-env + script: + - cargo test --verbose --all-features --release + +#### stage: build + +build: + stage: build + <<: *docker-env + script: + - cargo build --verbose --all-features --release \ No newline at end of file -- GitLab From b771de366e4c4181f309e67ea66e72d6b8bbde92 Mon Sep 17 00:00:00 2001 From: Denis P Date: Wed, 8 Jan 2020 15:23:56 +0100 Subject: [PATCH 2/4] build will happen nightly and on merges --- .gitlab.ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab.ci.yml b/.gitlab.ci.yml index 43fad9f5..29e6833f 100644 --- a/.gitlab.ci.yml +++ b/.gitlab.ci.yml @@ -77,5 +77,8 @@ test: build: stage: build <<: *docker-env + only: + - schedules + - master script: - cargo build --verbose --all-features --release \ No newline at end of file -- GitLab From 22861108cb31e7f3795855366bf2f55d2301b78b Mon Sep 17 00:00:00 2001 From: Denis P Date: Wed, 8 Jan 2020 15:26:03 +0100 Subject: [PATCH 3/4] typo in name --- .gitlab.ci.yml => .gitlab-ci.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .gitlab.ci.yml => .gitlab-ci.yml (100%) diff --git a/.gitlab.ci.yml b/.gitlab-ci.yml similarity index 100% rename from .gitlab.ci.yml rename to .gitlab-ci.yml -- GitLab From fc22ff6b9f78e78d527d99faff3520725ef18d18 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 8 Jan 2020 14:33:36 +0000 Subject: [PATCH 4/4] Format code --- src/cmd/instantiate.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/instantiate.rs b/src/cmd/instantiate.rs index 34de2c21..2f7ac802 100644 --- a/src/cmd/instantiate.rs +++ b/src/cmd/instantiate.rs @@ -57,9 +57,10 @@ pub(crate) fn execute_instantiate( .build() .and_then(|cli| cli.xt(signer, None)) .and_then(move |xt| { - xt.watch().submit(contracts::instantiate::( - endowment, gas_limit, code_hash, data.0, - )) + xt.watch() + .submit(contracts::instantiate::( + endowment, gas_limit, code_hash, data.0, + )) }); let mut rt = tokio::runtime::Runtime::new()?; -- GitLab