From 215b151af8f1b468313ef8176c938785c5796c6a Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Tue, 3 Sep 2024 20:31:21 -0400 Subject: [PATCH 1/5] Adding Rootstock Integration Tests workflow to Powpeg node repo --- .github/workflows/rit.yml | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/rit.yml diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml new file mode 100644 index 000000000..103918485 --- /dev/null +++ b/.github/workflows/rit.yml @@ -0,0 +1,68 @@ +name: Rootstock Integration Tests + +on: + pull_request: + types: [opened, reopened] + branches: + - "**" + push: + branches: ["master", "*-rc"] + workflow_dispatch: + inputs: + rit-branch: + description: 'Branch for Rootstock Integration Tests' + required: false + default: 'main' + rskj-branch: + description: 'Branch for RSKJ repo' + required: false + default: 'master' + +jobs: + rootstock-integration-tests: + name: Rootstock Integration Tests + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Set Branch Variables + id: set-branch-variables + run: | + # Default values + POWPEG_BRANCH="master" + RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" + RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || 'master' }}" + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + POWPEG_BRANCH="${{ github.event.pull_request.head.ref }}" + elif [[ "${{ github.event_name }}" == "push" ]]; then + if [[ "${{ github.ref }}" == refs/heads/*-rc ]]; then + POWPEG_BRANCH="${{ github.ref }}" + fi + elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + POWPEG_BRANCH="${{ github.ref_name }}" + fi + + echo "RSKJ_BRANCH=$RSKJ_BRANCH" >> $GITHUB_ENV + echo "RIT_BRANCH=$RIT_BRANCH" >> $GITHUB_ENV + echo "POWPEG_BRANCH=$POWPEG_BRANCH" >> $GITHUB_ENV + + - name: Checkout PowPeg Repository + if: github.event_name == 'pull_request' + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + repository: rsksmart/powpeg-node + ref: ${{ env.POWPEG_BRANCH }} + fetch-depth: 1 + + - name: Checkout Rootstock Integration Tests Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + with: + repository: rsksmart/rootstock-integration-tests + ref: ${{ env.RIT_BRANCH }} + fetch-depth: 0 + + - name: Run Rootstock Integration Tests + uses: rsksmart/rootstock-integration-tests@497172fd38dcfaf48c77f9bb1eeb6617eef5eed6 #v1 + with: + rskj-branch: ${{ env.RSKJ_BRANCH }} + powpeg-node-branch: ${{ env.POWPEG_BRANCH }} \ No newline at end of file From 5762913074166cf98727fd491c6d751a96066de6 Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Fri, 6 Sep 2024 13:18:10 -0400 Subject: [PATCH 2/5] Addressing comments --- .github/workflows/rit.yml | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index 103918485..a76ba03e4 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -1,10 +1,6 @@ name: Rootstock Integration Tests on: - pull_request: - types: [opened, reopened] - branches: - - "**" push: branches: ["master", "*-rc"] workflow_dispatch: @@ -32,12 +28,8 @@ jobs: RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || 'master' }}" - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - POWPEG_BRANCH="${{ github.event.pull_request.head.ref }}" - elif [[ "${{ github.event_name }}" == "push" ]]; then - if [[ "${{ github.ref }}" == refs/heads/*-rc ]]; then - POWPEG_BRANCH="${{ github.ref }}" - fi + if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then + POWPEG_BRANCH="${{ github.ref }}" elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then POWPEG_BRANCH="${{ github.ref_name }}" fi @@ -46,23 +38,9 @@ jobs: echo "RIT_BRANCH=$RIT_BRANCH" >> $GITHUB_ENV echo "POWPEG_BRANCH=$POWPEG_BRANCH" >> $GITHUB_ENV - - name: Checkout PowPeg Repository - if: github.event_name == 'pull_request' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 - with: - repository: rsksmart/powpeg-node - ref: ${{ env.POWPEG_BRANCH }} - fetch-depth: 1 - - - name: Checkout Rootstock Integration Tests Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 - with: - repository: rsksmart/rootstock-integration-tests - ref: ${{ env.RIT_BRANCH }} - fetch-depth: 0 - - name: Run Rootstock Integration Tests uses: rsksmart/rootstock-integration-tests@497172fd38dcfaf48c77f9bb1eeb6617eef5eed6 #v1 with: rskj-branch: ${{ env.RSKJ_BRANCH }} - powpeg-node-branch: ${{ env.POWPEG_BRANCH }} \ No newline at end of file + powpeg-node-branch: ${{ env.POWPEG_BRANCH }} + rit-branch: ${{ env. RIT_BRANCH }} \ No newline at end of file From 89a436a88b56b7cf8fb15bf9ac1e1ecd13324870 Mon Sep 17 00:00:00 2001 From: frederico leal Date: Mon, 9 Sep 2024 17:05:48 +0200 Subject: [PATCH 3/5] Adding back the pull_request trigger to the workflow In order to have the RIT tests working as we have it today, we need to add triggers for every commit and for when the PR is opened, but only for masters and *-rc branches base branches. --- .github/workflows/rit.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index a76ba03e4..f461623c2 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -3,6 +3,9 @@ name: Rootstock Integration Tests on: push: branches: ["master", "*-rc"] + pull_request: + types: [ opened, synchronize, reopened ] + branches: [ "master", "*-rc" ] workflow_dispatch: inputs: rit-branch: @@ -32,6 +35,8 @@ jobs: POWPEG_BRANCH="${{ github.ref }}" elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then POWPEG_BRANCH="${{ github.ref_name }}" + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + POWPEG_BRANCH="${{ github.head_ref }}" fi echo "RSKJ_BRANCH=$RSKJ_BRANCH" >> $GITHUB_ENV From 78150c1cc8f25396b3795890c673d725d78db0b5 Mon Sep 17 00:00:00 2001 From: fmacleal <157636304+fmacleal@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:18:21 +0200 Subject: [PATCH 4/5] Update .github/workflows/rit.yml according suggestion from review --- .github/workflows/rit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index f461623c2..bd8a99a81 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -28,8 +28,8 @@ jobs: run: | # Default values POWPEG_BRANCH="master" - RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" - RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || 'master' }}" + RIT_BRANCH="${{ github.event.inputs.rit-branch || github.event.inputs['rit-branch'].default }}" + RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || github.event.inputs['rskj-branch'].default }}" if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then POWPEG_BRANCH="${{ github.ref }}" From e64ce07bd10981453011de4f4f69d3d5fecd1c87 Mon Sep 17 00:00:00 2001 From: frederico leal Date: Wed, 11 Sep 2024 13:30:23 +0200 Subject: [PATCH 5/5] Revert "Update .github/workflows/rit.yml according suggestion from review" This reverts commit 78150c1cc8f25396b3795890c673d725d78db0b5. --- .github/workflows/rit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index bd8a99a81..f461623c2 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -28,8 +28,8 @@ jobs: run: | # Default values POWPEG_BRANCH="master" - RIT_BRANCH="${{ github.event.inputs.rit-branch || github.event.inputs['rit-branch'].default }}" - RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || github.event.inputs['rskj-branch'].default }}" + RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" + RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || 'master' }}" if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then POWPEG_BRANCH="${{ github.ref }}"