Skip to content

Adding Rootstock Integration Tests workflow #15

Adding Rootstock Integration Tests workflow

Adding Rootstock Integration Tests workflow #15

Workflow file for this run

name: Rootstock Integration Tests
on:
pull_request:
branches:
- "master"
- "*-rc"
issue_comment:
types:
- created
- edited
jobs:
rootstock-integration-tests:
name: Rootstock Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Print GitHub Event Information
run: |
echo "GitHub Event Name: ${{ github.event_name }}"
echo "GitHub Event Action: ${{ github.event.action }}"
echo "GitHub Comment Body: ${{ github.event.comment.body }}"
echo "GitHub Repository: ${{ github.repository }}"
echo "GitHub Ref: ${{ github.ref }}"
echo "GitHub PR Number: ${{ github.event.pull_request.number }}"
if: always()
- name: Check Comment Contains /pipeline:run
id: check-comment
run: |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
COMMENT_BODY="${{ github.event.comment.body }}"
if [[ "$COMMENT_BODY" == *"/pipeline:run"* ]]; then
echo "CONTAINS_PIPELINE_RUN=true" >> $GITHUB_ENV
echo "Pipeline run command is present in the comment body."
else
echo "CONTAINS_PIPELINE_RUN=false" >> $GITHUB_ENV
echo "Pipeline run command is NOT present in the comment body."
fi
else
echo "CONTAINS_PIPELINE_RUN=false" >> $GITHUB_ENV
echo "Not an issue comment event, skipping check."
fi
if: always()
- name: Get PR Description
id: get-pr-description
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
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")
rskj_branch=$(echo "$PR_DESC" | jq -r '.body | select(test("rskj:")) | split(" ") | .[1]')
fed_branch=$(echo "$PR_DESC" | jq -r '.body | select(test("fed:")) | split(" ") | .[1]')
rit_branch=$(echo "$PR_DESC" | jq -r '.body | select(test("rit:")) | split(" ") | .[1]')
echo "RSKJ_BRANCH=$rskj_branch" >> $GITHUB_ENV
echo "FED_BRANCH=$fed_branch" >> $GITHUB_ENV
echo "RIT_BRANCH=$rit_branch" >> $GITHUB_ENV
fi
if: github.event_name == 'pull_request'
- name: Checkout Rootstock Integration Tests Repository
uses: actions/checkout@v3
with:
repository: rsksmart/rootstock-integration-tests
ref: ${{ env.RIT_BRANCH }}
fetch-depth: 1
- name: Run Rootstock Integration Tests
if: (env.CONTAINS_PIPELINE_RUN == 'true' && github.event_name == 'issue_comment') || github.event.action == 'opened'
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"