Skip to content

Integration tests #2854

Integration tests

Integration tests #2854

name: Integration tests
concurrency:
group: ${{ github.head_ref }}${{ github.ref }}-integration-tests
cancel-in-progress: true
on:
schedule:
- cron: "0 3 * * *"
pull_request:
push:
branches:
- "main"
workflow_dispatch:
defaults:
run:
shell: bash
permissions:
checks: write
pull-requests: write
jobs:
run-integration-tests:
name: "Run integration tests"
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip ci]') }}
env:
LOGS_DIR: "tests/integration-tests/target/logs"
REPORTS_DIR: "tests/integration-tests/target/site/serenity"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v14
with:
java-version: openjdk@1.17
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: hyperledger-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Compose
uses: ndeloof/install-compose-action@v0.0.1
with:
version: v2.12.2 # defaults to 'latest'
legacy: true # will also install in PATH as `docker-compose`
- name: Build local version of Cloud Agent
id: build_local_cloud_agent
env:
ENV_FILE: "infrastructure/local/.env"
GITHUB_ACTOR: hyperledger-bot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sbt docker:publishLocal
echo "agent_version=$(cut -d'=' -f2 version.sbt | tr -d '" ')" >> "${GITHUB_OUTPUT}"
echo "prism_node_version=$(grep PRISM_NODE_VERSION infrastructure/local/.env | cut -d'=' -f2 | tr -d ' ')" >> "${GITHUB_OUTPUT}"
- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "19"
- name: Run integration tests
working-directory: "tests/integration-tests"
env:
PRISM_NODE_VERSION: ${{ steps.build_local_cloud_agent.outputs.prism_node_version }}
AGENT_VERSION: ${{ steps.build_local_cloud_agent.outputs.agent_version }}
GITHUB_ACTOR: hyperledger-bot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# continue-on-error: true
run: |
./gradlew test --tests "IntegrationTestsRunner"
- name: Make report of integration tests
working-directory: "tests/integration-tests"
if: always()
env:
PRISM_NODE_VERSION: ${{ steps.build_local_cloud_agent.outputs.prism_node_version }}
AGENT_VERSION: ${{ steps.build_local_cloud_agent.outputs.agent_version }}
GITHUB_ACTOR: hyperledger-bot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew reports
- name: Extract test results
working-directory: "tests/integration-tests"
id: analyze_test_results
if: github.ref_name == 'main' && always()
run: |
JSON_RESULTS="target/site/serenity/serenity-summary.json"
CONCLUSION=failure
TOTAL_TESTS=0
FAILED_TESTS=0
SKIPPED_TESTS=0
TESTS_WITH_ERRORS=0
if [ -f "${JSON_RESULTS}" ]; then
TOTAL_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.total')"
PENDING_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.pending')"
SKIPPED_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.skipped')"
IGNORED_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.ignored')"
FAILED_TESTS="$(cat ${JSON_RESULTS} | jq '.results.counts.failure')"
TESTS_WITH_ERRORS="$(cat ${JSON_RESULTS} | jq '.results.counts.error')"
if [[ ${FAILED_TESTS} == 0 && ${TESTS_WITH_ERRORS} == 0 ]] ; then
CONCLUSION=success
fi
fi
{
echo "conclusion=${CONCLUSION}";
echo "tests=${TOTAL_TESTS}";
echo "failures=${FAILED_TESTS}";
echo "errors=${TESTS_WITH_ERRORS}";
echo "pending=${PENDING_TESTS}";
echo "skipped=${SKIPPED_TESTS}";
echo "ignored=${IGNORED_TESTS}";
} >> "$GITHUB_OUTPUT"
- name: Publish e2e test Results
id: publish-unit-tests
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "${{ env.REPORTS_DIR }}/SERENITY-JUNIT-*.xml"
comment_title: "Integration Test Results"
check_name: "Integration Test Results"
- name: Upload serenity report
if: github.ref_name == 'main' || failure()
uses: actions/upload-artifact@v4
with:
name: integration-tests-result
path: ${{ env.REPORTS_DIR }}
compression-level: 9
- name: Upload logs
if: github.ref_name == 'main' || failure()
uses: actions/upload-artifact@v4
with:
name: docker-logs
path: ${{ env.LOGS_DIR }}
compression-level: 9
- name: Slack Notification
if: github.ref_name == 'main' && failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ steps.analyze_test_results.outputs.conclusion }}
SLACK_MESSAGE: |
Total: ${{ steps.analyze_test_results.outputs.tests }}
Failed: ${{ steps.analyze_test_results.outputs.failures }}
Errors in tests: ${{ steps.analyze_test_results.outputs.errors }}
Skipped (known bugs): ${{ steps.analyze_test_results.outputs.skipped }}
SLACK_TITLE: "Identus Cloud Agent Integration Tests: ${{ steps.analyze_test_results.outputs.conclusion }}"
SLACK_USERNAME: circleci
SLACK_WEBHOOK: ${{ secrets.E2E_TESTS_SLACK_WEBHOOK }}
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Run didcomm tests
working-directory: "tests/didcomm-tests"
env:
AGENT_VERSION: ${{ steps.build_local_cloud_agent.outputs.agent_version }}
run: |
./docker/run.sh "$AGENT_VERSION"
npm i
npm test
./docker/stop.sh