feat(ci)_: add Jenkinsfile, Dockerfile for RPC tests

Also add curl to Docker image.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2024-07-04 12:50:15 +02:00 committed by Anton Danchenko
parent 2a743e37ce
commit 0d82dbe240
6 changed files with 100 additions and 3 deletions

View File

@ -491,7 +491,11 @@ test-verif-proxy-wrapper:
run-integration-tests: SHELL := /bin/sh
run-integration-tests:
docker-compose -f integration-tests/docker-compose.anvil.yml -f integration-tests/docker-compose.test.status-go.yml up --remove-orphans --build
docker-compose -f integration-tests/docker-compose.anvil.yml -f integration-tests/docker-compose.test.status-go.yml up -d --build --remove-orphans; \
docker-compose -f integration-tests/docker-compose.anvil.yml -f integration-tests/docker-compose.test.status-go.yml logs -f tests-rpc; \
exit_code=$$(docker inspect integration-tests_tests-rpc_1 -f '{{.State.ExitCode}}'); \
docker-compose -f integration-tests/docker-compose.anvil.yml -f integration-tests/docker-compose.test.status-go.yml down; \
exit $$exit_code
run-anvil: SHELL := /bin/sh
run-anvil:

View File

@ -22,7 +22,7 @@ LABEL maintainer="support@status.im"
LABEL source="https://github.com/status-im/status-go"
LABEL description="status-go is an underlying part of Status - a browser, messenger, and gateway to a decentralized world."
RUN apk add --no-cache ca-certificates bash libgcc libstdc++
RUN apk add --no-cache ca-certificates bash libgcc libstdc++ curl
RUN mkdir -p /static/keys
RUN mkdir -p /static/configs

View File

@ -0,0 +1,57 @@
library 'status-jenkins-lib@v1.8.17'
pipeline {
agent { label 'linux && x86_64 && nix-2.19' }
parameters {
string(
name: 'BRANCH',
defaultValue: 'develop',
description: 'Name of branch to build.'
)
}
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 30, unit: 'MINUTES')
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '5',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}
environment {
PLATFORM = 'tests-rpc'
PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
}
stages {
stage('RPC Tests') {
steps { script {
sh 'make run-integration-tests'
} }
}
} // stages
post {
always {
script {
archiveArtifacts artifacts: '**/results.xml', allowEmptyArchive: true
junit(
testResults: '**/results.xml',
skipOldReports: true,
skipPublishingChecks: true,
skipMarkingBuildUnstable: true
)
}
}
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { sh "make git-clean" }
} // post
} // pipeline

View File

@ -0,0 +1,18 @@
FROM python:3.10.14-slim AS build
RUN apt-get update && apt-get install -y gcc python3-dev
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
FROM python:3.10.14-slim AS run
ENV PATH="/opt/venv/bin:$PATH"
COPY --from=build /opt/venv /opt/venv
WORKDIR tests-rpc
COPY . .
ENTRYPOINT ["pytest"]

View File

@ -14,3 +14,21 @@ services:
- 30303:30303/udp
- 30304:30304/udp
entrypoint: ["statusd", "-c", "/static/configs/config.json", "--seed-phrase=test test test test test test test test test test test junk", "--password=Strong12345"]
healthcheck:
test: ["CMD-SHELL", "curl -X POST --data '{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":1}' -H 'Content-Type: application/json' http://0.0.0.0:3333 || exit 1"]
interval: 5s
timeout: 2s
retries: 120
tests-rpc:
depends_on:
status-go:
condition: service_healthy
deploy-communities-contracts:
condition: service_completed_successfully
build:
context: .
dockerfile: Dockerfile.tests-rpc
entrypoint: ["pytest", "-m", "wallet", "--rpc_url=http://status-go:3333"]
volumes:
- .:/tests-rpc

View File

@ -1,5 +1,5 @@
[pytest]
addopts = -s -v --tb=short
addopts = -s -v --tb=short --junitxml=results.xml
markers =
rpc