Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify partial repo build on CI #1832

Merged
merged 9 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ benchmarks-test:
# we may live with failing benchmarks, it is just a signal for us
allow_failure: true

partial-repo-build-test:
stage: test
<<: *docker-env
<<: *nightly-test
script:
- ./scripts/verify-partial-repo-build.sh --no-revert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@svyatonik
very very nit, I would maybe name it like verify-partial-repo-of-bridge-pallets-build.sh or verify-partial-bridge-pallets-build.sh or something similar, because partial-repo could be relayer part or pallets part :)

# we may live with failing partial repo build, it is just a signal for us
allow_failure: true

#### stage: build

build:
Expand Down
53 changes: 41 additions & 12 deletions scripts/verify-partial-repo-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,35 @@
# - modules/relayers;
# - everything required from primitives folder.

set -eux

# show CLI help
function show_help() {
set +x
echo " "
echo Error: $1
echo "Usage:"
echo " ./scripts/verify-partial-repo-build.sh Exit with code 0 if runtime code repo is well decoupled from the other code"
echo "Options:"
echo " --no-revert Leaves only runtime code on exit"
exit 1
}

# parse CLI args
NO_REVERT=
for i in "$@"
do
case $i in
--no-revert)
NO_REVERT=true
shift
;;
*)
show_help "Unknown option: $i"
;;
esac
done

# the script is able to work only on clean git copy
[[ -z "$(git status --porcelain)" ]] || { echo >&2 "The git copy must be clean"; exit 1; }

Expand All @@ -18,8 +47,7 @@ BRIDGES_FOLDER="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && p

# let's leave repository/subtree in its original (clean) state if something fails below
function revert_to_clean_state {
echo "Reverting to clean state..."
git reset --hard
[[ ! -z "${NO_REVERT}" ]] || { echo "Reverting to clean state..."; git checkout .; }
}
trap revert_to_clean_state EXIT

Expand Down Expand Up @@ -48,17 +76,18 @@ rm -f $BRIDGES_FOLDER/ci.Dockerfile
rm -f $BRIDGES_FOLDER/Dockerfile

# let's fix Cargo.toml a bit (it'll be helpful if we are in the bridges repo)
if [[ ! -f "Cargo.toml" ]]; then
cat > Cargo.toml <<-CARGO_TOML
[workspace]
resolver = "2"

cat > $BRIDGES_FOLDER/Cargo.toml <<-CARGO_TOML
[workspace]
resolver = "2"

members = [
"bin/runtime-common",
"modules/*",
"primitives/*",
]
CARGO_TOML
members = [
"bin/runtime-common",
"modules/*",
"primitives/*",
]
CARGO_TOML
fi

# let's test if everything we need compiles

Expand Down