Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
[WIP] .gitlab-ci.yml: Fix a check for polkadot to work on forked repo…
Browse files Browse the repository at this point in the history
…s v2 (paritytech#4078)

* Fix a check for polkadot to work on forked repos.

* .gitlab-ci.yml: Add `git diff` for CI debugging

* More future proof and less redundant.

* .gitlab-ci.yml: Improve comments and refactor sed command

* .gitlab-ci.yml: Remove two commas in a row

* .gitlab-ci.yml: Ensure to match branch statements at the end

* .gitlab-ci.yml: Reference concrete commit

When one does not specify the concrete commit, cargo-update tries to
checkout 'master' in the Substrate repository.

* .gitlab-ci.yml: Remove 'git diff' debug line
  • Loading branch information
mxinden authored and bkchr committed Nov 11, 2019
1 parent 116bba6 commit a3c5b77
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ build-linux-subkey:
script:
- cd ./subkey
- BUILD_DUMMY_WASM_BINARY=1 time cargo build --release --verbose
- cd ..
- cd -
- sccache -s
- mkdir -p ./artifacts/subkey
- mv ./target/release/subkey ./artifacts/subkey/.
Expand Down Expand Up @@ -338,20 +338,33 @@ check_warnings:
fi
allow_failure: true

# Check whether Polkadot 'master' branch builds using this Substrate commit.
check_polkadot:
stage: build
<<: *docker-env
allow_failure: true
dependencies:
- test-linux-stable
script:
- git clone --depth 1 https://github.com/paritytech/polkadot.git
- COMMIT_HASH=$(git rev-parse HEAD)
- SUBSTRATE_PATH=$(pwd)
# Clone the current Polkadot master branch into ./polkadot.
- git clone --depth 1 https://gitlab.parity.io/parity/polkadot.git
- cd polkadot
- git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/"
- cargo update -p sr-io --precise $COMMIT_HASH
# Within Polkadot 'master' alter each Cargo.toml that references the
# Substrate 'polkadot-master' branch:
# 1. Replace the 'branch = "polkadot-master"' statements with the rev of our
# commit.
# 2. Replace 'git = "https://.*"' with 'git = "file://.*"' (the local
# checked out Substrate repository one folder above).
# 3. Remove any trailing commas.
- git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/"
# Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one
# package, others are updated along the way.
- cargo update -p sr-io
# Check whether Polkadot 'master' branch builds with this Substrate commit.
- time cargo check
- cd ..
- cd -
- sccache -s

#### stage: publish
Expand Down

0 comments on commit a3c5b77

Please sign in to comment.