From 1d9c71381826d81bf617010731a5a3d3deb62e44 Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Wed, 28 Aug 2024 15:57:46 -0400 Subject: [PATCH 1/7] Adding Rootstock Integration Tests workflow --- .github/workflows/rit.yml | 73 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 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 00000000000..f6b51d9bafe --- /dev/null +++ b/.github/workflows/rit.yml @@ -0,0 +1,73 @@ +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' + powpeg-branch: + description: 'Branch for PowPeg Node' + 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 + RSKJ_BRANCH="master" + RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" + POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch || 'master' }}" + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + RSKJ_BRANCH="${{ github.event.pull_request.head.ref }}" + elif [[ "${{ github.event_name }}" == "push" ]]; then + if [[ "${{ github.ref }}" == refs/heads/*-rc ]]; then + RSKJ_BRANCH="${{ github.ref }}" + fi + elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + RSKJ_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 rskj Repository + if: github.event_name == 'pull_request' + uses: actions/checkout@v3 + with: + repository: rsksmart/rskj + ref: ${{ env.RSKJ_BRANCH }} + fetch-depth: 1 + + - name: Checkout Rootstock Integration Tests Repository + uses: actions/checkout@v4 + with: + repository: rsksmart/rootstock-integration-tests + ref: ${{ env.RIT_BRANCH }} + fetch-depth: 0 + + - name: Run Rootstock Integration Tests + uses: rsksmart/rootstock-integration-tests@v1 + with: + rskj-branch: ${{ env.RSKJ_BRANCH }} + powpeg-node-branch: ${{ env.POWPEG_BRANCH }} + + - name: Notify on Status + run: echo "Rootstock Integration Tests pipeline triggered" From afadadb1ca807cec07b3c79ed1a799b05e6e0823 Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Tue, 3 Sep 2024 11:05:04 -0400 Subject: [PATCH 2/7] addressing comments --- .github/workflows/rit.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index f6b51d9bafe..941f50ace8f 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -6,9 +6,7 @@ on: branches: - "**" push: - branches: - - "master" - - "*-rc" + branches: ["master", "*-rc"] workflow_dispatch: inputs: rit-branch: @@ -50,14 +48,14 @@ jobs: - name: Checkout rskj Repository if: github.event_name == 'pull_request' - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.7 with: repository: rsksmart/rskj ref: ${{ env.RSKJ_BRANCH }} fetch-depth: 1 - name: Checkout Rootstock Integration Tests Repository - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.7 with: repository: rsksmart/rootstock-integration-tests ref: ${{ env.RIT_BRANCH }} @@ -68,6 +66,3 @@ jobs: with: rskj-branch: ${{ env.RSKJ_BRANCH }} powpeg-node-branch: ${{ env.POWPEG_BRANCH }} - - - name: Notify on Status - run: echo "Rootstock Integration Tests pipeline triggered" From 20ef32dbfbbbee64b31f53a815c4fff2d6c0415e Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Tue, 3 Sep 2024 20:45:11 -0400 Subject: [PATCH 3/7] Update workflow to use specific commit hashes for GitHub Actions Checkout --- .github/workflows/rit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index 941f50ace8f..8c5a1614f6a 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -48,21 +48,21 @@ jobs: - name: Checkout rskj Repository if: github.event_name == 'pull_request' - uses: actions/checkout@v4.1.7 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 with: repository: rsksmart/rskj ref: ${{ env.RSKJ_BRANCH }} fetch-depth: 1 - name: Checkout Rootstock Integration Tests Repository - uses: actions/checkout@v4.1.7 + 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@v1 + uses: rsksmart/rootstock-integration-tests@497172fd38dcfaf48c77f9bb1eeb6617eef5eed6 #v1 with: rskj-branch: ${{ env.RSKJ_BRANCH }} powpeg-node-branch: ${{ env.POWPEG_BRANCH }} From c37c4d842f19d3bff2cdca7131d9d7f5cb9c8175 Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Fri, 6 Sep 2024 13:06:40 -0400 Subject: [PATCH 4/7] Addressing comments --- .github/workflows/rit.yml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/rit.yml b/.github/workflows/rit.yml index 8c5a1614f6a..f7fd8ebb463 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' }}" POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch || 'master' }}" - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - RSKJ_BRANCH="${{ github.event.pull_request.head.ref }}" - elif [[ "${{ github.event_name }}" == "push" ]]; then - if [[ "${{ github.ref }}" == refs/heads/*-rc ]]; then - RSKJ_BRANCH="${{ github.ref }}" - fi + if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then + RSKJ_BRANCH="${{ github.ref }}" elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then RSKJ_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 rskj Repository - if: github.event_name == 'pull_request' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 - with: - repository: rsksmart/rskj - ref: ${{ env.RSKJ_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 }} + rit-branch: ${{ env.RIT_BRANCH }} From a775973bbfc033feba2644ce0eae60fca4d08346 Mon Sep 17 00:00:00 2001 From: fmacleal <157636304+fmacleal@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:34:12 +0200 Subject: [PATCH 5/7] Adding back the pull_request trigger 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 f7fd8ebb463..1b97e186b5c 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: RSKJ_BRANCH="${{ github.ref }}" elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then RSKJ_BRANCH="${{ github.ref_name }}" + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + RSKJ_BRANCH="${{ github.head_ref }}" fi echo "RSKJ_BRANCH=$RSKJ_BRANCH" >> $GITHUB_ENV From c42b470bf1961846b84e86c2e0aed0cc1c624b4c Mon Sep 17 00:00:00 2001 From: fmacleal <157636304+fmacleal@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:21:30 +0200 Subject: [PATCH 6/7] Update rit.yml Using the default branch set on the inputs from workflow dispatch would be a better re-use. --- .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 1b97e186b5c..891555dc9f3 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -28,8 +28,8 @@ jobs: run: | # Default values RSKJ_BRANCH="master" - RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" - POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch || 'master' }}" + RIT_BRANCH="${{ github.event.inputs.rit-branch || github.event.inputs['rit-branch'].default }}" + POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch || github.event.inputs['powpeg-branch'].default }}" if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then RSKJ_BRANCH="${{ github.ref }}" From 5e2f1d282b585310fa70c15ac7429253f640ddf9 Mon Sep 17 00:00:00 2001 From: frederico leal Date: Wed, 11 Sep 2024 13:31:00 +0200 Subject: [PATCH 7/7] Revert "Update rit.yml" This reverts commit c42b470bf1961846b84e86c2e0aed0cc1c624b4c. --- .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 891555dc9f3..1b97e186b5c 100644 --- a/.github/workflows/rit.yml +++ b/.github/workflows/rit.yml @@ -28,8 +28,8 @@ jobs: run: | # Default values RSKJ_BRANCH="master" - RIT_BRANCH="${{ github.event.inputs.rit-branch || github.event.inputs['rit-branch'].default }}" - POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch || github.event.inputs['powpeg-branch'].default }}" + RIT_BRANCH="${{ github.event.inputs.rit-branch || 'main' }}" + POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch || 'master' }}" if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then RSKJ_BRANCH="${{ github.ref }}"