-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issues fixed: 1 - Remove the trigger on push for master and *-rc -> we don't need that anymore since we are running it for every commit on PRs against these branches. 2 - Solve the issue that the status of an execution triggered via workflow doesn't update the PR status. And if we need to use a different branch for RIT, Powpeg and RIT in the PR, it won't change the status to green after the workflow_dispatch execution -> We will do that adding a parsing on the description, looking for the branch that need to be used for that PR. If there is no branch configured on the description, we will try to use the default one.
- Loading branch information
Showing
1 changed file
with
65 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
name: Rootstock Integration Tests | ||
|
||
on: | ||
push: | ||
branches: ["master", "*-rc"] | ||
pull_request: | ||
types: [ opened, synchronize, reopened ] | ||
branches: ["master", "*-rc"] | ||
|
@@ -17,35 +15,92 @@ on: | |
required: false | ||
default: 'master' | ||
|
||
env: | ||
REGEX_PARSE_BRANCH: '([a-zA-Z0-9/_-]+)' | ||
|
||
jobs: | ||
rootstock-integration-tests: | ||
name: Rootstock Integration Tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Fetch Pull Request Description | ||
uses: actions/checkout@v4 | ||
id: fetch-pr-description | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
PR_DESCRIPTION=$(gh pr view ${{ github.event.pull_request.number }} --json body -q .body) | ||
echo "pr_description=$pr_description" >> $GITHUB_ENV | ||
- name: Set Branch Variables | ||
id: set-branch-variables | ||
env: | ||
PR_DESCRIPTION: ${{ env.pr_description }} | ||
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 }}" == "push" && "${{ github.ref }}" == "refs/heads/*-rc" ]]; then | ||
RSKJ_BRANCH="${{ github.ref }}" | ||
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
# Set the RSKJ branch | ||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
RSKJ_BRANCH="${{ github.ref_name }}" | ||
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
RSKJ_BRANCH="${{ github.head_ref }}" | ||
if [[ "$PR_DESCRIPTION" =~ rskj:${{ env.REGEX_PARSE_BRANCH }} ]]; then | ||
RSKJ_BRANCH="${BASH_REMATCH[1]}" | ||
else | ||
RSKJ_BRANCH="${{ github.head_ref }}" | ||
fi | ||
fi | ||
# Set the Powpeg branch | ||
if [[ -n "${{ github.event.inputs.powpeg-branch }}" ]]; then | ||
POWPEG_BRANCH="${{ github.event.inputs.powpeg-branch }}" | ||
elif [[ "$PR_DESCRIPTION" =~ fed:${{ env.REGEX_PARSE_BRANCH }} ]]; then | ||
POWPEG_BRANCH="${BASH_REMATCH[1]}" | ||
else | ||
POWPEG_BRANCH="master" | ||
fi | ||
# Set the RIT branch | ||
if [[ -n "${{ github.event.inputs.rit-branch }}" ]]; then | ||
RIT_BRANCH="${{ github.event.inputs.rit-branch }}" | ||
elif [[ "$PR_DESCRIPTION" =~ rit:${{ env.REGEX_PARSE_BRANCH }} ]]; then | ||
RIT_BRANCH="${BASH_REMATCH[1]}" | ||
else | ||
RIT_BRANCH="main" | ||
fi | ||
echo "RSKJ_BRANCH=$RSKJ_BRANCH" >> $GITHUB_ENV | ||
echo "RIT_BRANCH=$RIT_BRANCH" >> $GITHUB_ENV | ||
echo "POWPEG_BRANCH=$POWPEG_BRANCH" >> $GITHUB_ENV | ||
- name: Set Build URL | ||
id: set-build-url | ||
run: | | ||
BUILD_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
echo "BUILD_URL=$BUILD_URL" >> $GITHUB_ENV | ||
- 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 }} | ||
|
||
# - name: Send Slack Notification on Success | ||
# if: success() | ||
# uses: slackapi/[email protected] | ||
# with: | ||
# channel-id: 'C8X9Q4PBM' # integration-tests channel | ||
# slack-message: "OK: :+1: Pull request: ${{ github.head_ref }} - [#${{ github.run_number }}] (${{ env.BUILD_URL }}) branches used [rskj:`rsksmart#${{ env.RSKJ_BRANCH }}`] [fed:`${{ env.POWPEG_BRANCH }}`] [rootstock-integration-tests:`${{ env.RIT_BRANCH }}`]" | ||
# env: | ||
# SLACK_BOT_TOKEN: ${{ secrets.GHA_SLACK_NOTIFICATION_TOKEN }} | ||
# | ||
# - name: Send Slack Notification on Failure | ||
# if: failure() | ||
# uses: slackapi/[email protected] | ||
# with: | ||
# channel-id: 'C8X9Q4PBM' # integration-tests channel | ||
# slack-message: "FAILED: :robot_face: Pull request: ${{ github.head_ref }} - [#${{ github.run_number }}] (${{ env.BUILD_URL }}) branches used [rskj:`rsksmart#${{ env.RSKJ_BRANCH }}`] [fed:`${{ env.POWPEG_BRANCH }}`] [rootstock-integration-tests:`${{ env.RIT_BRANCH }}`]" | ||
# env: | ||
# SLACK_BOT_TOKEN: ${{ secrets.GHA_SLACK_NOTIFICATION_TOKEN }} |