Skip to content

Commit

Permalink
Adding Rootstock Integration Tests workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoreliovlabs committed Aug 29, 2024
1 parent 01bb758 commit a679f87
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/rit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Rootstock Integration Tests

on:
push:
branches:
- "master"
- "*-rc"
pull_request:
types: [opened, reopened, synchronize]
branches:
- "**"
issue_comment:
types:
- created
- edited

jobs:
rootstock-integration-tests:
name: Rootstock Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout rskj Repository
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: rsksmart/rskj
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 1

- name: Get PR Description
if: github.event_name == 'pull_request'
id: get-pr-description
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
PR_DESC=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER")
echo "PR Description: $PR_DESC"
rskj_branch=$(echo "$PR_DESC" | grep -Po '(?<=RSKj Branch: rskj:)\w+' || echo "master")
fed_branch=$(echo "$PR_DESC" | grep -Po '(?<=PowPeg Node Branch: fed:)\w+' || echo "master")
rit_branch=$(echo "$PR_DESC" | grep -Po '(?<=Rootstock Integration Tests Branch: rit:)\w+' || echo "main")
echo "RSKJ_BRANCH=$rskj_branch" >> $GITHUB_ENV
echo "FED_BRANCH=$fed_branch" >> $GITHUB_ENV
echo "RIT_BRANCH=$rit_branch" >> $GITHUB_ENV
echo "{\"rskj_branch\": \"$rskj_branch\", \"fed_branch\": \"$fed_branch\", \"rit_branch\": \"$rit_branch\"}" > debug-values.json
- name: Test jq Installation
run: |
echo '{"key":"value"}' | jq '.key'
cat debug-values.json
echo "RSKJ Branch: $(jq -r '.rskj_branch' debug-values.json)"
echo "FED Branch: $(jq -r '.fed_branch' debug-values.json)"
echo "RIT Branch: $(jq -r '.rit_branch' debug-values.json)"
- name: Checkout Rootstock Integration Tests Repository
uses: actions/checkout@v4
with:
repository: rsksmart/rootstock-integration-tests
ref: ${{ env.RIT_BRANCH }}
fetch-depth: 0

- name: Check Comment Condition
run: |
echo "Evaluating condition..."
if [[ "${{ github.event_name }}" == "issue_comment" && "${{ github.event.comment.body }}" == *"/pipeline:run"* ]]; then
echo "Condition met: Pipeline run command detected in comment."
else
echo "Condition not met: Comment body is '${{ github.event.comment.body }}'"
fi
- name: Run Rootstock Integration Tests
if: github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/pipeline:run'))
uses: rsksmart/rootstock-integration-tests@v1
with:
rskj-branch: ${{ env.RSKJ_BRANCH }}
powpeg-node-branch: ${{ env.FED_BRANCH }}

- name: Notify on Status
run: echo "Rootstock Integration Tests pipeline triggered"

0 comments on commit a679f87

Please sign in to comment.