-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: end to end network upgrade github action (#4274)
* feat: upgrade testing in CI * fix: ignore idempotency checks * fix: fund_redeem test erasing decimals * chore: clean up * chore: lint * chore: minor clean up
- Loading branch information
Showing
10 changed files
with
241 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
name: Test upgrade from latest release to main | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
permissions: | ||
packages: read | ||
contents: read | ||
|
||
jobs: | ||
upgrade_test: | ||
runs-on: [digitalocean] | ||
# conservatively 1.5 hours. 2 bouncer runs need to occur. | ||
timeout-minutes: 90 | ||
steps: | ||
|
||
- name: Checkout chainflip-backend | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Github Container Registry 🔑 | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Configure NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
registry-url: "https://npm.pkg.github.com" | ||
scope: "@chainflip-io" | ||
cache-dependency-path: "bouncer/pnpm-lock.yaml" | ||
|
||
- name: Set NPM registry | ||
run: | | ||
pnpm set @chainflip-io:registry=https://npm.pkg.github.com/ | ||
pnpm set //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }} | ||
- name: Install system packages | ||
run: | | ||
sudo apt update | ||
sudo apt install -y bc xxd | ||
- name: Install wscat | ||
run: | | ||
npm install -g wscat | ||
- name: Download try-runtime binary | ||
uses: jaxxstorm/action-install-gh-release@v1.10.0 | ||
with: | ||
repo: paritytech/try-runtime-cli | ||
tag: v0.5.0 | ||
extension-matching: disable | ||
rename-to: try-runtime | ||
chmod: 0755 | ||
|
||
- name: Download latest release binaries | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: release-perseverance.yml | ||
name: chainflip-backend-bin-ubuntu-22.04 | ||
github_token: ${{ secrets.CF_BACKEND_GITHUB_TOKEN }} | ||
path: latest-release-bins | ||
|
||
- name: Permissions for latest binaries | ||
run: | | ||
chmod +x ./latest-release-bins/chainflip-* | ||
- name: Version of the latest release | ||
run: | | ||
set -x | ||
RELEASE_VERSION=$(./latest-release-bins/chainflip-engine --version) | ||
echo $RELEASE_VERSION | ||
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV | ||
- name: Download latest main binaries | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: ci-main.yml | ||
name: chainflip-backend-bin-try-runtime-ubuntu-22.04 | ||
path: main-bins | ||
|
||
- name: Permissions for latest binaries | ||
run: | | ||
chmod +x ./main-bins/chainflip-* | ||
- name: Download latest main runtime | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: ci-main.yml | ||
name: chainflip-node-runtime-try-runtime | ||
path: main-runtime | ||
|
||
- name: Install node dependencies | ||
working-directory: bouncer | ||
run: pnpm install | ||
|
||
- name: Start a localnet from current release | ||
env: | ||
BINARY_ROOT_PATH: ./latest-release-bins | ||
run: | | ||
set -x | ||
mkdir -p /tmp/chainflip/bashful | ||
mkdir -p /tmp/chainflip/doc | ||
mkdir -p /tmp/chainflip/dopey | ||
touch ./localnet/.setup_complete | ||
./localnet/manage.sh | ||
- name: Run bouncer on latest release | ||
id: pre-upgrade-bouncer | ||
working-directory: bouncer | ||
run: | | ||
./run.sh | ||
# we need to be sure that when this fails, we catch the error, any panics etc. that occur | ||
# TODO: Run swaps simultaneously to the upgrade - we could do that inside the `upgrade_network` command itself. | ||
- name: Upgrade network | ||
shell: bash | ||
id: upgrade-network | ||
working-directory: bouncer | ||
run: | | ||
./commands/upgrade_network.ts prebuilt \ | ||
--runtime ./../main-runtime/state_chain_runtime.compact.compressed.wasm \ | ||
--bins ./../main-bins \ | ||
--localnet_init ./../localnet/init \ | ||
--oldVersion "${{ env.RELEASE_VERSION }}" | ||
- name: Run bouncer after upgrade | ||
id: post-upgrade-bouncer | ||
working-directory: bouncer | ||
run: | | ||
./run-no-setup.sh | ||
- name: Print chainflip-engine logs | ||
if: failure() | ||
run: | | ||
cat /tmp/chainflip/*/chainflip-engine.log | ||
- name: Print chainflip-node logs | ||
if: failure() | ||
run: | | ||
cat /tmp/chainflip/*/chainflip-node.log | ||
- name: Print broker logs | ||
if: failure() | ||
run: | | ||
cat /tmp/chainflip/chainflip-broker-api.log | ||
- name: Print lp-api logs | ||
if: failure() | ||
run: | | ||
cat /tmp/chainflip/chainflip-lp-api.log | ||
- name: Upload Localnet Logs 💾 | ||
if: always() | ||
continue-on-error: true | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: localnet-logs | ||
path: | | ||
/tmp/chainflip/*/chainflip-*.log | ||
- name: Clean Up docker containers 🧹 | ||
if: always() | ||
continue-on-error: true | ||
run: | | ||
ls -alR /tmp/chainflip | ||
docker compose -f localnet/docker-compose.yml -p "chainflip-localnet" logs | ||
docker compose -f localnet/docker-compose.yml -p "chainflip-localnet" down --rmi all --volumes --remove-orphans | ||
- name: Notify on failed upgrade test | ||
if: failure() && github.ref_name == 'main' || cancelled() && github.ref_name == 'main' | ||
env: | ||
DISCORD_USERNAME: "Upgrade Test" | ||
DISCORD_WEBHOOK: ${{ secrets.CF_DISCORD_ALERTS_CRITICAL }} | ||
uses: Ilshidur/action-discord@0.3.2 | ||
with: | ||
args: | | ||
❗️❗️❗️❗️ Sorry **${{ github.actor }}**, The Upgrade Test has not passed ❗️❗️❗️❗️ | ||
👾 Link to job: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
#️⃣ Tagging: <@&939151218708709416> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters