Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix v1 precompiled (#7033)
Browse files Browse the repository at this point in the history
* Combine cargo updates into one

* Update log tag
  • Loading branch information
jacogr authored Nov 13, 2017
1 parent 399043d commit 0f2bfda
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 119 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,10 @@ js-release:
script:
- rustup default stable
- echo $JS_FILES_MODIFIED
- if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS rebuild since no JS files modified."; else ./js/scripts/build.sh && ./js/scripts/release.sh; fi
- if [ $JS_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS rebuild since no JS files modified."; else ./js/scripts/build.sh && ./js/scripts/push-precompiled.sh; fi
- echo $JS_OLD_FILES_MODIFIED
- if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) rebuild since no JS files modified."; else ./js-old/scripts/build.sh && ./js-old/scripts/release.sh; fi
- if [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping JS (old) rebuild since no JS files modified."; else ./js-old/scripts/build.sh && ./js-old/scripts/push-precompiled.sh; fi
- if [ $JS_FILES_MODIFIED -eq 0 ] || [ $JS_OLD_FILES_MODIFIED -eq 0 ]; then echo "Skipping Cargo update since no JS files modified."; else ./js/scripts/push-cargo.sh; fi

tags:
- javascript
Expand Down
32 changes: 4 additions & 28 deletions js-old/scripts/release.sh → js-old/scripts/push-precompiled.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -e
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
PRECOMPILED_BRANCH="v1"
GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.git"
GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/parity.git"

# setup the git user defaults for the current repo
function setup_git_user {
Expand All @@ -22,17 +21,17 @@ pushd $BASEDIR
cd ../.dist

# add local files and send it up
echo "*** [v1] Setting up GitHub config for js-precompiled"
echo "*** [v1 precompiled] Setting up GitHub config for js-precompiled"
rm -rf ./.git
git init
setup_git_user

echo "*** [v1] Checking out $PRECOMPILED_BRANCH branch"
echo "*** [v1 precompiled] Checking out $PRECOMPILED_BRANCH branch"
git remote add origin $GIT_JS_PRECOMPILED
git fetch origin 2>$GITLOG
git checkout -b $PRECOMPILED_BRANCH

echo "*** [v1] Committing compiled files for $UTCDATE"
echo "*** [v1 precompiled] Committing compiled files for $UTCDATE"
mv build ../build.new
git add .
git commit -m "$UTCDATE [update]"
Expand All @@ -44,33 +43,10 @@ mv ../build.new build
git add .
git commit -m "$UTCDATE [release]"

echo "*** [v1] Merging remote"
echo "*** [v1 precompiled] Merging remote"
git push origin HEAD:refs/heads/$PRECOMPILED_BRANCH 2>$GITLOG
PRECOMPILED_HASH=`git rev-parse HEAD`

# move to root
cd ../..

echo "*** [v1] Setting up GitHub config for parity"
setup_git_user
git remote set-url origin $GIT_PARITY
git reset --hard origin/$BRANCH 2>$GITLOG

echo "*** [v1] Updating cargo parity-ui-old-precompiled#$PRECOMPILED_HASH"
git submodule update
# Not needed since $BRANCH is hardcoded
# sed -i "/^parity-ui-old-precompiled/ { s/branch = \".*\"/branch = \"$BRANCH\"/g; }" dapps/ui/Cargo.toml
cargo update -p parity-ui-old-precompiled
# --precise "$PRECOMPILED_HASH"

echo "*** [v1] Committing updated files"
git add dapps/ui/Cargo.toml
git add Cargo.lock
git commit -m "[ci skip] js-precompiled $UTCDATE"
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG

# back to root
echo "*** [v1] Release completed"
popd

# exit with exit code
Expand Down
2 changes: 1 addition & 1 deletion js-old/scripts/test.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// test script 10
// test script 11
55 changes: 55 additions & 0 deletions js/scripts/push-cargo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
set -e

# variables
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
BRANCH=$CI_BUILD_REF_NAME
GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/parity.git"

# setup the git user defaults for the current repo
function setup_git_user {
git config push.default simple
git config merge.ours.driver true
git config user.email "$GITHUB_EMAIL"
git config user.name "GitLab Build Bot"
}

# change into the build directory
BASEDIR=`dirname $0`
pushd $BASEDIR

echo "*** [cargo] Setting up GitHub config for parity"
setup_git_user
git remote set-url origin $GIT_PARITY
git reset --hard origin/$BRANCH 2>$GITLOG
git submodule update

if [ "$BRANCH" == "master" ]; then
cd js

echo "*** [cargo] Bumping package.json patch version"
npm --no-git-tag-version version
npm version patch

cd ..

git add js
fi

echo "*** [cargo] Updating cargo parity-ui-precompiled"
sed -i "/^parity-ui-precompiled/ { s/branch = \".*\"/branch = \"$BRANCH\"/g; }" dapps/ui/Cargo.toml
cargo update -p parity-ui-precompiled
cargo update -p parity-ui-old-precompiled

echo "*** [cargo] Committing updated files"
git add dapps/ui/Cargo.toml
git add Cargo.lock
git commit -m "[ci skip] js-precompiled $UTCDATE"
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG

# back to root
echo "*** [cargo] Release completed"
popd

# exit with exit code
exit 0
52 changes: 52 additions & 0 deletions js/scripts/push-precompiled.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
set -e

# variables
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
BRANCH=$CI_BUILD_REF_NAME
GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.git"

# setup the git user defaults for the current repo
function setup_git_user {
git config push.default simple
git config merge.ours.driver true
git config user.email "$GITHUB_EMAIL"
git config user.name "GitLab Build Bot"
}

# change into the build directory
BASEDIR=`dirname $0`
GITLOG=./.git/gitcommand.log
pushd $BASEDIR
cd ../.dist

# add local files and send it up
echo "*** [v2 precompiled] Setting up GitHub config"
rm -rf ./.git
git init
setup_git_user

echo "*** [v2 precompiled] Checking out $BRANCH branch"
git remote add origin $GIT_JS_PRECOMPILED
git fetch origin 2>$GITLOG
git checkout -b $BRANCH

echo "*** [v2 precompiled] Committing compiled files for $UTCDATE"
mv build ../build.new
git add .
git commit -m "$UTCDATE [update]"
git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [merge]"
git rm -r build
rm -rf build
git commit -m "$UTCDATE [cleanup]"
mv ../build.new build
git add .
git commit -m "$UTCDATE [release]"

echo "*** [v2 precompiled] Merging remote"
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG

popd

# exit with exit code
exit 0
87 changes: 0 additions & 87 deletions js/scripts/release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion js/scripts/test.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// test script 15
// test script 16

0 comments on commit 0f2bfda

Please sign in to comment.