Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Rootstock Integration Tests workflow to Powpeg node repo #310

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/rit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Rootstock Integration Tests

on:
rmoreliovlabs marked this conversation as resolved.
Show resolved Hide resolved
push:
branches: ["master", "*-rc"]
pull_request:
types: [ opened, synchronize, reopened ]
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' }}"
Comment on lines +31 to +32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to somehow re-use the default branch values that are defined above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, yes, it seems possible. Do you think it's better to re-use it? Nevertheless, to change these default values we would have to change the worfklow yaml anyway.

We would have to do something like this:

Suggested change
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 }}"

Copy link
Contributor

@fmacleal fmacleal Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops, the suggestion failed. Probably because the inputs are define only if the pipeline is triggered via workflow_dispatch. This logic wouldn't work for the commits in PR.

Let's let as it was? Otherwise we will need an even bigger if like:

 RSKJ_BRANCH="${{ github.event.inputs.rskj-branch || github.event.inputs['rskj-branch'].default || 'main' }}"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No big deal, I wouldn't expect the default branches to change anytime soon. Just the good practice of avoid repetition (DRY). But in this case I'd go with the simplest solution


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 }}"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
POWPEG_BRANCH="${{ github.head_ref }}"
fi

echo "RSKJ_BRANCH=$RSKJ_BRANCH" >> $GITHUB_ENV
echo "RIT_BRANCH=$RIT_BRANCH" >> $GITHUB_ENV
echo "POWPEG_BRANCH=$POWPEG_BRANCH" >> $GITHUB_ENV

- name: Run Rootstock Integration Tests
uses: rsksmart/rootstock-integration-tests@497172fd38dcfaf48c77f9bb1eeb6617eef5eed6 #v1
bernacodesido marked this conversation as resolved.
Show resolved Hide resolved
with:
rskj-branch: ${{ env.RSKJ_BRANCH }}
powpeg-node-branch: ${{ env.POWPEG_BRANCH }}
rit-branch: ${{ env. RIT_BRANCH }}
Loading