traefik based local cluster setup #52
Workflow file for this run
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
name: Fork State | |
on: | |
workflow_dispatch: | |
inputs: | |
network: | |
type: choice | |
description: "The network to be forked" | |
options: | |
- porcini | |
- root | |
required: true | |
runtime-upgrade: | |
type: boolean | |
description: "Whether to enable runtime upgrade." | |
required: true | |
release-candidate-branch: | |
type: string | |
description: "The release candidate branch for runtime upgrade." | |
required: false | |
push: # TODO remove this | |
branches: | |
- "release-test" | |
env: | |
REGISTRY: "ghcr.io" | |
CARGO_TERM_COLOR: always | |
jobs: | |
fork-state: | |
runs-on: [dev-box] | |
name: Fork the current state and run runtime upgrade | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: ghcr.io login | |
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python 3.9 | |
if: ${{ github.event.inputs.runtime-upgrade }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Check out the correct version | |
if: ${{ github.event.inputs.runtime-upgrade }} | |
run: | | |
python3 -m venv ./scripts/penv | |
source ./scripts/penv/bin/activate | |
pip install -r ./scripts/requirements.txt | |
UPGRADE_FLAG=$(if [ ${{ github.event.inputs.runtime-upgrade }} ]; then echo "--branch ${{ github.event.inputs.release-candidate-branch }}"; else echo ""; fi) | |
python3 ./scripts/get_node_version.py --config ./scripts/networks/${{ github.event.inputs.network }}.yaml $UPGRADE_FLAG | |
- name: Upload wasm as artifact | |
if: ${{ github.event.inputs.runtime-upgrade }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: runtime-wasm | |
path: ./output/seed_runtime.compact.compressed.wasm | |
if-no-files-found: warn | |
- name: Deploy cluster 🐳 | |
run: | | |
export NETWORK=${{ github.event.inputs.network }} | |
docker compose down --remove-orphans | |
docker compose up -d | |
poll-service-status: | |
runs-on: [dev-box] | |
needs: fork-state | |
name: Poll the service status on Kubernetes till the service is up | |
steps: | |
- name: Wait till the Kubernetes runner reacts | |
run: sleep 10s | |
shell: bash | |
- name: Fetch the service status | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: "https://forkednet.au.cicd.rootnet.app/" | |
responseCode: 405 | |
timeout: 300 | |
interval: 20 | |
runtime-upgrade: | |
if: ${{ github.event.inputs.runtime-upgrade }} | |
runs-on: [dev-box] | |
needs: poll-service-status | |
defaults: | |
run: | |
working-directory: ./ci-scripts/runtime-upgrade | |
name: Do the runtime upgrade | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: runtime-wasm | |
path: runtime-wasm | |
- name: "Install Node.js" | |
uses: "actions/setup-node@v3" | |
with: | |
node-version: "lts/*" | |
- name: "Install yarn globally" | |
run: "npm install -g yarn" | |
- name: "Install ts-node" | |
run: | | |
npm install -g ts-node | |
npm install -g typescript | |
- name: "Install the dependencies" | |
run: "yarn install --immutable --prefer-offline" | |
- name: Do runtime upgrade | |
run: npx ts-node runtime-upgrade.ts |