Skip to content

Commit

Permalink
Merge branch 'main' into total_number_of_commitments_counting
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond authored May 15, 2024
2 parents 83c0718 + 669cf22 commit 7d1d692
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/software-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,29 @@ jobs:
- name: Retrieve info.json and set snapshot path
run: |
DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/info.json
curl -L $DOWNLOAD_URL -o /tmp/info.json
echo "Info.json downloaded to check snapshot version."
# DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/info.json
# curl -L $DOWNLOAD_URL -o /tmp/info.json
# echo "Info.json downloaded to check snapshot version."
# retrieve blockHeight field value from info.json
SNAPSHOT_BLOCK_HEIGHT=$(cat /tmp/info.json | awk -F'"' '/"blockHeight":/{print $4}')
echo "SNAPSHOT_BLOCK_HEIGHT=$SNAPSHOT_BLOCK_HEIGHT" >> $GITHUB_ENV
echo "Snapshot block height: $SNAPSHOT_BLOCK_HEIGHT"
# # retrieve blockHeight field value from info.json
# SNAPSHOT_BLOCK_HEIGHT=$(cat /tmp/info.json | awk -F'"' '/"blockHeight":/{print $4}')
# echo "SNAPSHOT_BLOCK_HEIGHT=$SNAPSHOT_BLOCK_HEIGHT" >> $GITHUB_ENV
# echo "Snapshot block height: $SNAPSHOT_BLOCK_HEIGHT"
# set snapshot download url
SNAPSHOT_DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4
# SNAPSHOT_DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4
# SNAPSHOT_DOWNLOAD_URL=https://tools.highstakes.ch/files/elys.tar.gz
SNAPSHOT_DOWNLOAD_URL=https://snapshots.elys.network/elys.tar.gz
echo "SNAPSHOT_DOWNLOAD_URL=$SNAPSHOT_DOWNLOAD_URL" >> $GITHUB_ENV
- name: Cache Directories
uses: actions/cache@v4
id: cache-elys-folders
id: cache-backup-directories
with:
path: |
/tmp/elys-backup
/tmp/elys2-backup
key: ${{ runner.os }}-elys-folders-${{ env.LATEST_TAG }}
key: ${{ runner.os }}-backup-directories-${{ env.LATEST_TAG }}

- name: Retrieve latest binary
run: |
Expand All @@ -62,7 +64,7 @@ jobs:
echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV
# TODO: retrieve upgrade-assure and upload-snapshot binaries
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Create git tag
run: git tag v999.999.999
Expand All @@ -89,17 +91,17 @@ jobs:
- name: Copy upgrade assure folder
run: |
cp -a ./cmd/upgrade-assure ./cmd/upgrade-assure-skip
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Check out latest tag
run: git checkout $LATEST_TAG
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

# TODO: to remove when upgrade-assure binary is available in previous release
- name: Copy old upgrade assure types.go file
run: |
cp -a ./scripts/upgrade-assure/types.go ./cmd/upgrade-assure-skip/types.go
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

# TODO: to remove when upgrade-assure binary is available in previous release
- name: Build old binaries
Expand All @@ -109,7 +111,7 @@ jobs:
OLD_UPGRADE_ASSURE_BINARY_PATH=./build/old-upgrade-assure
mv ./build/upgrade-assure-skip $OLD_UPGRADE_ASSURE_BINARY_PATH
echo "OLD_UPGRADE_ASSURE_BINARY_PATH=$OLD_UPGRADE_ASSURE_BINARY_PATH" >> $GITHUB_ENV
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Chain snapshot and export
run: |
Expand All @@ -118,7 +120,7 @@ jobs:
--skip-node-start \
--timeout-next-block 100000 \
--timeout-wait-for-node 100000
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Chain initialization
run: |
Expand All @@ -127,7 +129,7 @@ jobs:
--skip-node-start \
--timeout-next-block 100000 \
--timeout-wait-for-node 100000
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Check out new branch
run: git checkout ${{ github.head_ref }}
Expand All @@ -146,11 +148,11 @@ jobs:
--skip-upgrade-to-new-binary \
--timeout-next-block 100000 \
--timeout-wait-for-node 100000
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Save up space
run: |
rm -rf ~/.elys/config/genesis.json
rm -rf /tmp/genesis.json
- name: Prepare second validator data
run: |
Expand All @@ -162,7 +164,7 @@ jobs:
--skip-upgrade-to-new-binary \
--timeout-next-block 100000 \
--timeout-wait-for-node 100000
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Submit new proposal
uses: nick-fields/retry@v3
Expand All @@ -178,27 +180,28 @@ jobs:
--skip-upgrade-to-new-binary \
--timeout-next-block 100000 \
--timeout-wait-for-node 100000
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Backup elys folders
run: |
cp -a $HOME/.elys /tmp/elys-backup
cp -a $HOME/.elys2 /tmp/elys2-backup
if: steps.cache-elys-folders.outputs.cache-hit != 'true'
if: steps.cache-backup-directories.outputs.cache-hit != 'true'

- name: Restore elys folders from backup
run: |
mv /tmp/elys-backup $HOME/.elys
mv /tmp/elys2-backup $HOME/.elys2
if: steps.cache-elys-folders.outputs.cache-hit == 'true'
cp -a $HOME/.elys2/config/genesis.json $HOME/.elys/config/genesis.json
if: steps.cache-backup-directories.outputs.cache-hit == 'true'

- name: Upgrade to new binary
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
command: |
GOMEMLIMIT=4GiB $NEW_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $NEW_BINARY_PATH $NEW_BINARY_PATH \
GOMEMLIMIT=8GiB $NEW_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $NEW_BINARY_PATH $NEW_BINARY_PATH \
--skip-snapshot \
--skip-chain-init \
--skip-create-validator \
Expand Down

0 comments on commit 7d1d692

Please sign in to comment.