Skip to content

Adding Rootstock Integration Tests workflow #34

Adding Rootstock Integration Tests workflow

Adding Rootstock Integration Tests workflow #34

Workflow file for this run

name: Rootstock Integration Tests
on:
# push:
# branches:
# - "master"
# - "*-rc"
pull_request:
types: [opened, reopened, synchronize]
branches:
- "**"
issue_comment:
types:
- created
- edited
permissions:
contents: write
issues: write
pull-requests: write
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: Test Token Permissions
run: |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user
- name: Checkout Rootstock Integration Tests Repository
uses: actions/checkout@v4
with:
repository: rsksmart/rootstock-integration-tests
ref: ${{ env.RIT_BRANCH }}
fetch-depth: 0
- name: Debug Comment Event
if: github.event_name == 'issue_comment'
run: |
echo "Comment body: ${{ github.event.comment.body }}"
- name: Check Comment Condition
if: github.event_name == 'issue_comment'
run: |
echo "Evaluating condition..."
if [[ "${{ 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 == '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"