From 5e0aa23809ddc93e1691e86ae9258a6f2a693931 Mon Sep 17 00:00:00 2001 From: Vyatcheslav Suharnikov Date: Wed, 23 Oct 2024 14:56:00 +0400 Subject: [PATCH] Run integration tests on GitHub, save logs (WIP) --- .github/workflows/check-pr.yml | 25 ++++++++++++++++++- .../scala/units/network/BaseItTestSuite.scala | 3 +++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 3c3b2246..c5358d5c 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -6,6 +6,16 @@ jobs: check-pr: name: Check PR runs-on: ubuntu-latest + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + services: + docker: + image: docker:latest + options: --privileged # Required for Docker-in-Docker (dind) + volumes: + - /var/run/docker.sock:/var/run/docker.sock + ports: + - 2375:2375 steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -13,5 +23,18 @@ jobs: distribution: 'temurin' java-version: '11' cache: 'sbt' + # - uses: sbt/setup-sbt@v1 + # - name: Install dependencies + # # testcontainers uses nc: + # # https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/containers/wait/internal/InternalCommandPortListeningCheck.java#L33 + # run: sudo apt-get update && sudo apt-get install -y netcat - name: Check PR - run: sbt --batch "compile;test" + # run: sbt --batch "docker;consensus-client-it/test" + run: sbt --batch "docker;consensus-client-it/test" + - name: Archive logs + uses: actions/upload-artifact@v4 + if: always() + with: + name: test-logs-${{ env.BRANCH_NAME }}-${{ github.run_id }} + path: consensus-client-it/target/test-logs + retention-days: 14 diff --git a/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala b/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala index ced811b6..1f0f08ac 100644 --- a/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala +++ b/consensus-client-it/src/test/scala/units/network/BaseItTestSuite.scala @@ -43,10 +43,13 @@ trait BaseItTestSuite ec1.start() ec1.logPorts() + log.info(s"Last execution block: ${ec1.engineApi.getLastExecutionBlock}") // Works // TODO remove waves1.start() waves1.waitReady() waves1.logPorts() + Thread.sleep(5000) + log.info(s"Last height: ${waves1.api.height}") // TODO remove } override protected def afterAll(): Unit = {