From 4739c379b9ff03440d56c547ab13d205d8c17696 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 25 Feb 2020 20:02:57 +0100 Subject: [PATCH] do not check unleash on every PR, only master and tags (#5054) * do not check unleash on every PR, only master and tags * move scripts folder * add signed-tag check to CI * remove publish-to-crates-io dependencies Co-authored-by: s3krit --- .gitlab-ci.yml | 26 ++++++++++++++----- .maintain/gitlab/check_signed.sh | 16 ++++++++++++ {scripts => .maintain}/gitlab/lib.sh | 0 .../gitlab/publish_draft_release.sh | 11 -------- 4 files changed, 36 insertions(+), 17 deletions(-) create mode 100755 .maintain/gitlab/check_signed.sh rename {scripts => .maintain}/gitlab/lib.sh (100%) rename {scripts => .maintain}/gitlab/publish_draft_release.sh (86%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1fa4a6dadb5d2..bc7ce84a80512 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ # script: # - echo "List of shell commands to run in your job" # - echo "You can also just specify a script here, like so:" -# - ./scripts/gitlab/my_amazing_script.sh +# - ./.maintain/gitlab/my_amazing_script.sh stages: - test @@ -104,6 +104,16 @@ check-runtime: interruptible: true allow_failure: true +check-signed-tag: + stage: test + image: parity/tools:latest + <<: *kubernetes-build + only: + - tags + - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ + script: + - ./.maintain/gitlab/check_signed.sh + allow_failure: false check-line-width: stage: test @@ -177,7 +187,14 @@ test-dependency-rules: - $DEPLOY_TAG script: - .maintain/ensure-deps.sh - # FIXME set to release + +unleash-check: + stage: test + <<: *docker-env + only: + - master + - tags + script: - cargo install cargo-unleash ${CARGO_UNLEASH_INSTALL_PARAMS} - cargo unleash check ${CARGO_UNLEASH_PKG_DEF} @@ -552,16 +569,13 @@ publish-draft-release: - tags - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ script: - - ./scripts/gitlab/publish_draft_release.sh + - ./.maintain/gitlab/publish_draft_release.sh interruptible: true allow_failure: true publish-to-crates-io: stage: publish <<: *docker-env - dependencies: - - build-linux-substrate - - test-dependency-rules only: - tags - /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ diff --git a/.maintain/gitlab/check_signed.sh b/.maintain/gitlab/check_signed.sh new file mode 100755 index 0000000000000..7c4cc47baba38 --- /dev/null +++ b/.maintain/gitlab/check_signed.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# shellcheck source=lib.sh +source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh" + +version="$CI_COMMIT_TAG" + +echo '[+] Checking tag has been signed' +check_tag "paritytech/substrate" "$version" +case $? in + 0) echo '[+] Tag found and has been signed'; exit 0 + ;; + 1) echo '[!] Tag found but has not been signed. Aborting release.'; exit 1 + ;; + 2) echo '[!] Tag not found. Aborting release.'; exit 1 +esac diff --git a/scripts/gitlab/lib.sh b/.maintain/gitlab/lib.sh similarity index 100% rename from scripts/gitlab/lib.sh rename to .maintain/gitlab/lib.sh diff --git a/scripts/gitlab/publish_draft_release.sh b/.maintain/gitlab/publish_draft_release.sh similarity index 86% rename from scripts/gitlab/publish_draft_release.sh rename to .maintain/gitlab/publish_draft_release.sh index 463d8ee6c853d..8566827a09920 100755 --- a/scripts/gitlab/publish_draft_release.sh +++ b/.maintain/gitlab/publish_draft_release.sh @@ -14,17 +14,6 @@ version="$CI_COMMIT_TAG" last_version=$(git tag -l | sort -V | grep -B 1 -x "$version" | head -n 1) echo "[+] Version: $version; Previous version: $last_version" -# Check that a signed tag exists on github for this version -echo '[+] Checking tag has been signed' -#check_tag "paritytech/substrate" "$version" -case $? in - 0) echo '[+] Tag found and has been signed' - ;; - 1) echo '[!] Tag found but has not been signed. Aborting release.'; exit 1 - ;; - 2) echo '[!] Tag not found. Aborting release.'; exit -esac - all_changes="$(sanitised_git_logs "$last_version" "$version")" labelled_changes="" echo "[+] Iterating through $(wc -l <<< "$all_changes") changes to find labelled PRs"