Skip to content

Commit

Permalink
Added the initial version of the action and a worfklow to validate it
Browse files Browse the repository at this point in the history
- There are some work in progress to tackle, since we need to have an example of how to use the action created. This is ongoing.
  • Loading branch information
fmacleal committed Jun 25, 2024
1 parent 242958b commit 1cad0ca
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 5 deletions.
36 changes: 36 additions & 0 deletions .github/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Rootstock Integration Tests Action'
description: 'This action provides a containerized environment for running integration tests on Rootstock.'
author: 'Rootstock Labs'

inputs:
rskj-branch:
description: 'The rskj branch to checkout'
required: false
default: 'master'
federator-branch:
description: 'The federate-node branch to checkout'
required: false
default: 'master'
rit-branch:
description: 'The rootstock-integration-tests branch to checkout'
required: false
default: 'main'
rit-log-level:
description: 'Log level for the rootstock-integration-tests'
required: false
default: 'info'

outputs:
status:
description: 'The status of the integration tests'
message:
description: 'The output message of the integration tests'

runs:
using: docker
image: ./images/Dockerfile
env:
RSKJ_BRANCH: ${{ inputs.rskj-branch }}
FEDERATOR_BRANCH: ${{ inputs.federator-branch }}
RIT_BRANCH: ${{ inputs.rit-branch }}
RIT_LOG_LEVEL: ${{ inputs.rit-log-level }}
8 changes: 3 additions & 5 deletions .github/images/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

set -e

RSKJ_BRANCH="master"
POWPEG_BRANCH="master"


echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n"

git clone https://github.com/rsksmart/rskj.git rskj
Expand All @@ -18,7 +14,7 @@ cd ..
echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n"
git clone https://github.com/rsksmart/powpeg-node.git powpeg
cp configure_gradle_federator.sh powpeg
cd powpeg && git checkout $POWPEG_BRANCH
cd powpeg && git checkout $FEDERATOR_BRANCH
chmod +x ./configure.sh && chmod +x gradlew
./configure_gradle_federator.sh
./configure.sh
Expand All @@ -31,9 +27,11 @@ mv configure_rit_locally.sh rit
mv regtest.js rit/config/regtest.js
mv /usr/src/logbacks/* /usr/src/rit/logbacks/
cd rit
git checkout $RIT_BRANCH
chmod +x ./configure.sh
./configure.sh
./configure_rit_locally.sh "$FED_VERSION"
export LOG_LEVEL=$RIT_LOG_LEVEL

echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n"
npm install -y
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Continuous Integration Tests

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
test-rit-docker:
name: Test Rootstock Integration Tests docker image
runs-on: ubuntu-latest

services:
registry:
image: registry:2
ports:
- 5001:5000

env:
TEST_TAG: localhost:5001/actions/container-action:latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Setup Docker BuildX
id: setup-buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver-opts: network=host
platforms: linux/amd64,linux/arm64


- name: Build the RIT Container
id: build
uses: docker/build-push-action@v6
with:
context: .github/images
push: true
tags: ${{ env.TEST_TAG }}

- name: Run the RIT Container
id: run
env:
RSKJ_BRANCH: 'master'
FEDERATOR_BRANCH: 'master'
run: |
docker run \
--env RSKJ_BRANCH="${{ env.RSKJ_BRANCH }}" \
--env FEDERATOR_BRANCH="${{ env.FEDERATOR_BRANCH }}" \
--rm ${{ env.TEST_TAG }}

0 comments on commit 1cad0ca

Please sign in to comment.