From c005782b5613c44c94f3297a97c979a4c73a3cb2 Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:18:33 -0400 Subject: [PATCH 1/3] chore(ci): add standard rollkit CI --- .github/auto_request_review.yml | 15 +++++ .github/pull_request_template.md | 18 ++++++ .github/workflows/housekeeping.yml | 66 +++++++++++++++++++++ .github/workflows/semantic-pull-request.yml | 20 +++++++ 4 files changed, 119 insertions(+) create mode 100644 .github/auto_request_review.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/housekeeping.yml create mode 100644 .github/workflows/semantic-pull-request.yml diff --git a/.github/auto_request_review.yml b/.github/auto_request_review.yml new file mode 100644 index 0000000..bc48a57 --- /dev/null +++ b/.github/auto_request_review.yml @@ -0,0 +1,15 @@ +reviewers: + defaults: + - rollkit + groups: + rollkit: + - team:core +files: + ".github/**": + - MSevey + - rollkit +options: + ignore_draft: true + ignored_keywords: + - WIP + number_of_reviewers: 3 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..0c1cad9 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,18 @@ + + +## Overview + + diff --git a/.github/workflows/housekeeping.yml b/.github/workflows/housekeeping.yml new file mode 100644 index 0000000..515a40d --- /dev/null +++ b/.github/workflows/housekeeping.yml @@ -0,0 +1,66 @@ +name: Housekeeping + +on: + issues: + types: [opened] + pull_request_target: + types: [opened, ready_for_review] + +jobs: + issue-management: + if: ${{ github.event.issue }} + name: Add issues to project and add triage label + uses: rollkit/.github/.github/workflows/reusable_housekeeping.yml@v0.4.0 + secrets: inherit + permissions: + issues: write + pull-requests: write + with: + run-labels: true + labels-to-add: "needs-triage" + run-projects: true + project-url: https://github.com/orgs/rollkit/projects/7 + + add-pr-to-project: + # ignore dependabot PRs + if: ${{ github.event.pull_request && github.actor != 'dependabot[bot]' }} + name: Add PRs to project + uses: rollkit/.github/.github/workflows/reusable_housekeeping.yml@v0.4.0 + secrets: inherit + permissions: + issues: write + pull-requests: write + with: + run-projects: true + project-url: https://github.com/orgs/rollkit/projects/7 + + auto-add-reviewer: + name: Auto add reviewer to PR + if: github.event.pull_request + uses: rollkit/.github/.github/workflows/reusable_housekeeping.yml@v0.4.0 + secrets: inherit + permissions: + issues: write + pull-requests: write + with: + run-auto-request-review: true + + auto-add-assignee: + # ignore dependabot PRs + if: ${{ github.event.pull_request && github.actor != 'dependabot[bot]' }} + name: Assign issue and PR to creator + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - name: Set pull_request url and creator login + # yamllint disable rule:line-length + run: | + echo "PR=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV + echo "CREATOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV + # yamllint enable rule:line-length + - name: Assign PR to creator + run: gh pr edit ${{ env.PR }} --add-assignee ${{ env.CREATOR }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml new file mode 100644 index 0000000..e11fe30 --- /dev/null +++ b/.github/workflows/semantic-pull-request.yml @@ -0,0 +1,20 @@ +name: Semantic Pull Request + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: conventional-commit-pr-title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 60cc1dcf99ed6a5ab9262f92125353fe485af094 Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:34:08 -0400 Subject: [PATCH 2/3] feat(ci): remove outdated CI and add new test CI --- .github/workflows/release.yml | 53 --------------------- .github/workflows/test.yaml | 86 ----------------------------------- .github/workflows/test.yml | 20 ++++++++ compose.yaml | 2 + 4 files changed, 22 insertions(+), 139 deletions(-) delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/test.yaml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index d1fd0f1..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,53 +0,0 @@ -# This workflow is useful if you want to automate the process of: -# -# a) Creating a new prelease when you push a new tag with a "v" prefix (version). -# -# This type of prerelease is meant to be used for production: alpha, beta, rc, etc. types of releases. -# After the prerelease is created, you need to make your changes on the release page at the relevant -# Github page and publish your release. -# -# b) Creating/updating the "latest" prerelease when you push to your default branch. -# -# This type of prelease is useful to make your bleeding-edge binaries available to advanced users. -# -# The workflow will not run if there is no tag pushed with a "v" prefix and no change pushed to your -# default branch. -on: push - -jobs: - might_release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Prepare Release Variables - id: vars - uses: ignite/cli/actions/release/vars@main - - - name: Issue Release Assets - uses: ignite/cli/actions/cli@main - if: ${{ steps.vars.outputs.should_release == 'true' }} - with: - args: chain build --release --release.prefix ${{ steps.vars.outputs.tarball_prefix }} -t linux:amd64 -t darwin:amd64 -t darwin:arm64 - - - name: Delete the "latest" Release - uses: dev-drprasad/delete-tag-and-release@v0.2.1 - if: ${{ steps.vars.outputs.is_release_type_latest == 'true' }} - with: - tag_name: ${{ steps.vars.outputs.tag_name }} - delete_release: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish the Release - uses: softprops/action-gh-release@v1 - if: ${{ steps.vars.outputs.should_release == 'true' }} - with: - tag_name: ${{ steps.vars.outputs.tag_name }} - files: release/* - prerelease: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 16ad6b5..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,86 +0,0 @@ -name: Test - -# trigger on each push against any branch and any PR -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - check_logs_job: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install yq - run: | - wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O yq &&\ - chmod +x yq - - - name: Install bc - run: | - sudo apt-get update - sudo apt-get install bc - - - name: Build container - run: | - docker build -t docker-gm:latest . - # change FROM statement in docker/Dockerfile to docker-gm:latest - sed -i 's/FROM ghcr.io\/rollkit\/gm:.*/FROM docker-gm:latest/g' docker/Dockerfile - docker compose -f docker/docker-compose.yaml build - - - name: Start compose - run: docker compose -f docker/docker-compose.yaml up -d - - - name: Let the chain run for some time - run: sleep 30 - - - name: Check if rollup can submit blocks via logs - run: | - # Get logs and remove colorization to compare with a string - logs=$(docker logs docker-gm-1 2>&1 | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g") - line='INF commit synced commit=' - if [[ "$logs" == *"$line"* ]]; then - echo "'commit synced commit' reached" - else - echo "$logs" - echo "'commit synced commit' NOT reached" - exit 1 - fi - - - name: Check if rollup works - run: | - docker compose -f docker/docker-compose.yaml exec gm gmd q gm gm - - - name: Check balance of accounts - run: | - amount=42069 - genesis=$(docker compose -f docker/docker-compose.yaml exec gm cat .gm/config/genesis.json) - addresses=$(echo $genesis | jq -r '.app_state.auth.accounts[].address') - address1=$(echo $addresses | cut -d' ' -f1) - address2=$(echo $addresses | cut -d' ' -f2) - a1balance_old=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address1} | yq '.balances[0].amount' -) - a2balance_old=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address2} | yq '.balances[0].amount' -) - echo "Sending $amount from $address1 to $address2" - docker compose -f docker/docker-compose.yaml exec gm gmd tx bank send ${address1} ${address2} ${amount}stake --keyring-backend test -y > /dev/null - echo "Waiting for block to be committed" - sleep 60 # TODO: Instead of sleeping, wait for a new block to be committed - a1balance_new=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address1} | yq '.balances[0].amount' -) - a2balance_new=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address2} | yq '.balances[0].amount' -) - a1balance_diff=$(echo "$a1balance_new - $a1balance_old" | bc) - a2balance_diff=$(echo "$a2balance_new - $a2balance_old" | bc) - - if [ "$a1balance_diff" -eq "-$amount" ] && [ "$a2balance_diff" -eq "$amount" ]; then - echo "Transfer successful" - else - echo "Transfer failed" - exit 1 - fi - - - name: Cleanup compose - if: always() - run: docker compose -f docker/docker-compose.yaml down --timeout 0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dea0c84 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test + +on: + push: + branches: + - "main" + pull_request: + +jobs: + gm-docker-compose: + runs-on: ubuntu-latest + steps: + # need checkout before using docker-compose-action + - uses: actions/checkout@v3 + - uses: adambirds/docker-compose-action@v1.3.0 + with: + compose-file: "compose.yaml" + up-flags: "--build" + test-container: gm + test-command: "rollkit start --rollkit.aggregator --rollkit.da_address http://localhost:7980" diff --git a/compose.yaml b/compose.yaml index f971df0..3b3c5bc 100644 --- a/compose.yaml +++ b/compose.yaml @@ -3,6 +3,7 @@ version: "3" services: gm: + container_name: gm # The build config can be used for debugging and testing changes to the GM Dockerfile build: . @@ -18,6 +19,7 @@ services: - local-da local-da: + container_name: local-da image: ghcr.io/rollkit/local-da:aa37274 ports: - "7980:7980" From 601f76d5ad6dcdc257c3c14cacb8a5e53b10a5e1 Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:03:14 -0400 Subject: [PATCH 3/3] feat(ci): add halt height for test command --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dea0c84..cd2d5a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,4 +17,5 @@ jobs: compose-file: "compose.yaml" up-flags: "--build" test-container: gm - test-command: "rollkit start --rollkit.aggregator --rollkit.da_address http://localhost:7980" + # Run the GM tutorial and halt after 10 blocks + test-command: "rollkit start --rollkit.aggregator --rollkit.da_address http://localhost:7980 --halt-height 10"