From e01e72d0a13a5e3ff7ae9b3d2eba22624db8255d Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Wed, 8 Nov 2023 14:06:20 -0800 Subject: [PATCH] Concurrent essential and extended test workflows --- .github/workflows/on_pull_request.yml | 33 ++++ .../workflows/on_pull_request_comments.yml | 24 +++ ..._to_develop.yml => on_push_to_develop.yml} | 50 ++++-- ....yml => on_release_created_or_updated.yml} | 18 +- .github/workflows/sub_codeql_analysis.yml | 41 +++++ .github/workflows/sub_essential_tests.yml | 110 ++++++++++++ .github/workflows/sub_extended_tests.yml | 66 +++++++ .github/workflows/sub_gradle_build.yml | 46 +++++ .../workflows/sub_gradle_test_and_build.yml | 165 ------------------ .github/workflows/sub_jacoco_report.yml | 70 ++++++++ .github/workflows/wf_pull_request.yml | 21 --- .../AnchorPlatformCustodyEnd2EndTest.kt | 1 - .../platform/test/PlatformApiCustodyTests.kt | 2 + 13 files changed, 439 insertions(+), 208 deletions(-) create mode 100644 .github/workflows/on_pull_request.yml create mode 100644 .github/workflows/on_pull_request_comments.yml rename .github/workflows/{wk_push_to_develop.yml => on_push_to_develop.yml} (61%) rename .github/workflows/{wf_release_created_or_updated.yml => on_release_created_or_updated.yml} (79%) create mode 100644 .github/workflows/sub_codeql_analysis.yml create mode 100644 .github/workflows/sub_essential_tests.yml create mode 100644 .github/workflows/sub_extended_tests.yml create mode 100644 .github/workflows/sub_gradle_build.yml delete mode 100644 .github/workflows/sub_gradle_test_and_build.yml create mode 100644 .github/workflows/sub_jacoco_report.yml delete mode 100644 .github/workflows/wf_pull_request.yml diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml new file mode 100644 index 0000000000..e7f3034b5e --- /dev/null +++ b/.github/workflows/on_pull_request.yml @@ -0,0 +1,33 @@ +name: On Pull Request Workflow + +on: + pull_request: + +jobs: + gradle_build: + uses: ./.github/workflows/sub_gradle_build.yml + + jacoco_report: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_jacoco_report.yml + with: + forceRebuild: true + + essential_tests: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_essential_tests.yml + + extended_tests: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_extended_tests.yml + + codeql_analysis: + uses: ./.github/workflows/sub_codeql_analysis.yml + + complete: + if: always() + needs: [ gradle_build, essential_tests, extended_tests, jacoco_report, codeql_analysis ] + runs-on: ubuntu-22.04 + steps: + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 diff --git a/.github/workflows/on_pull_request_comments.yml b/.github/workflows/on_pull_request_comments.yml new file mode 100644 index 0000000000..fbfa014ce4 --- /dev/null +++ b/.github/workflows/on_pull_request_comments.yml @@ -0,0 +1,24 @@ +name: Pull Request Comments + +on: + issue_comment: + types: [ created, edited ] + +jobs: + run-extended-tests: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-extended-tests') + uses: ./.github/workflows/sub_extended_tests.yml + + run-essential-tests: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-essential-tests') + uses: ./.github/workflows/sub_essential_tests.yml + + run-codeql-analysis: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-codeql-analysis') + uses: ./.github/workflows/sub_codeql_analysis.yml + + run-jacoco-report: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-jacoco-report') + uses: ./.github/workflows/sub_jacoco_report.yml + with: + forceRebuild: true diff --git a/.github/workflows/wk_push_to_develop.yml b/.github/workflows/on_push_to_develop.yml similarity index 61% rename from .github/workflows/wk_push_to_develop.yml rename to .github/workflows/on_push_to_develop.yml index e1d77fef87..d9785aaddf 100644 --- a/.github/workflows/wk_push_to_develop.yml +++ b/.github/workflows/on_push_to_develop.yml @@ -7,12 +7,27 @@ name: Push/Merge to `develop` Branch on: push: - # when commits are pushed or merged onto `develop` branch + # when commits are pushed or pull requests merged onto `develop` branch branches: [ develop ] jobs: - gradle_test_and_build: - uses: ./.github/workflows/sub_gradle_test_and_build.yml + gradle_build: + uses: ./.github/workflows/sub_gradle_build.yml + + jacoco_report: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_jacoco_report.yml + + essential_tests: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_essential_tests.yml + + extended_tests: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_extended_tests.yml + + codeql_analysis: + uses: ./.github/workflows/sub_codeql_analysis.yml build_and_push_docker_image: # stellar/anchor-platform:edge-${{ steps.get_date.outputs.date }}-${{ steps.get_sha.outputs.SHA }} @@ -45,24 +60,23 @@ jobs: tags: stellar/anchor-platform:edge,stellar/anchor-platform:edge-${{ steps.get_date.outputs.DATE }}-${{ steps.get_sha.outputs.SHA }} file: Dockerfile - # TODO: enable purge-image when we got the dockerhub token - # purge-image: - # name: Purge Docker edge Images (tags=edge-*) - # runs-on: ubuntu-22.04 - # steps: - # - name: Delete image - # uses: bots-house/ghcr-delete-image-action@v1.1.0 - # with: - # owner: stellarproducteng - # name: ${{ secrets.DOCKERHUB_USERNAME }} - # token: ${{ secrets.DOCKERHUB_TOKEN }} - # tag: edge-* + # TODO: enable purge-image when we got the dockerhub token + # purge-image: + # name: Purge Docker edge Images (tags=edge-*) + # runs-on: ubuntu-22.04 + # steps: + # - name: Delete image + # uses: bots-house/ghcr-delete-image-action@v1.1.0 + # with: + # owner: stellarproducteng + # name: ${{ secrets.DOCKERHUB_USERNAME }} + # token: ${{ secrets.DOCKERHUB_TOKEN }} + # tag: edge-* complete: if: always() - # TODO: add sep_validation_suite when Jenkins develop build is complete - needs: [ gradle_test_and_build, build_and_push_docker_image ] + needs: [ essential_tests, extended_tests, build_and_push_docker_image ] runs-on: ubuntu-latest steps: - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') - run: exit 1 \ No newline at end of file + run: exit 1 diff --git a/.github/workflows/wf_release_created_or_updated.yml b/.github/workflows/on_release_created_or_updated.yml similarity index 79% rename from .github/workflows/wf_release_created_or_updated.yml rename to .github/workflows/on_release_created_or_updated.yml index e34393abb2..c46af157bc 100644 --- a/.github/workflows/wf_release_created_or_updated.yml +++ b/.github/workflows/on_release_created_or_updated.yml @@ -6,6 +6,20 @@ on: types: [ created, edited ] jobs: + gradle_build: + uses: ./.github/workflows/sub_gradle_build.yml + + essential_tests: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_essential_tests.yml + + extended_tests: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_extended_tests.yml + + codeql_analysis: + uses: ./.github/workflows/sub_codeql_analysis.yml + build_and_push_docker_image: name: Push to DockerHub (tag=stellar/anchor-platform:${{ github.event.release.tag_name }}) runs-on: ubuntu-22.04 @@ -41,9 +55,7 @@ jobs: complete: if: always() - # TODO: Enable end_to_end tests after it is fixed. - # needs: [ end_to_end_tests, build_and_push_docker_image ] - needs: [ build_and_push_docker_image ] + needs: [ essential_tests, extended_tests, build_and_push_docker_image ] runs-on: ubuntu-latest steps: - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') diff --git a/.github/workflows/sub_codeql_analysis.yml b/.github/workflows/sub_codeql_analysis.yml new file mode 100644 index 0000000000..eb96381816 --- /dev/null +++ b/.github/workflows/sub_codeql_analysis.yml @@ -0,0 +1,41 @@ +name: CodeQL Analysis Workflow + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + analyze: + name: CodeQL Analysis + runs-on: ubuntu-latest-4-cores + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java-kotlin' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Gradle properties + run: | + echo "kotlin.daemon.jvmargs=-Xmx2g" >> gradle.properties + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/sub_essential_tests.yml b/.github/workflows/sub_essential_tests.yml new file mode 100644 index 0000000000..63ff8ee492 --- /dev/null +++ b/.github/workflows/sub_essential_tests.yml @@ -0,0 +1,110 @@ +name: Run Essential Tests Workflow + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + essential_tests: + name: Run Essential Tests (Integration Tests, Faster End-2-End Tests, Unit Tests, and Stellar Validation Tools) + runs-on: ubuntu-latest-16-cores + # runs-on: ubuntu-latest + steps: + ############################################# + # Setup JDK 11 + # Download, and Extract java-stellar-anchor-sdk.tar + # Setup hostnames (/etc/hosts) + ############################################# + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Download java-stellar-anchor-sdk.tar + uses: actions/download-artifact@v3 + with: + name: java-stellar-anchor-sdk-tar + path: /home/runner/ + + - name: Extract java-stellar-anchor-sdk.tar + run: | + cd /home/runner + tar -xf /home/runner/java-stellar-anchor-sdk.tar + cd /home/runner/java-stellar-anchor-sdk + + - name: Set up hostnames (/etc/hosts) + run: | + sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 zookeeper" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts + + ############################################# + + + - name: Pull Stellar Validation Tests Docker Image + run: docker pull stellar/anchor-tests:v0.6.9 & + + - name: Run Zookeeper, Kafka, Postgres, and Sep24 UI with docker-compose + env: + TEST_PROFILE_NAME: default + run: docker-compose -f /home/runner/java-stellar-anchor-sdk/service-runner/src/main/resources/docker-compose-test.yaml up -d --build + + - name: Run sep server, platform server, observer, and reference servers for integration tests + env: + RUN_DOCKER: false + RUN_ALL_SERVERS: false + RUN_SEP_SERVER: true + RUN_PLATFORM_SERVER: true + RUN_OBSERVER: true + RUN_KOTLIN_REFERENCE_SERVER: true + RUN_EVENT_PROCESSING_SERVER: true + RUN_WALLET_SERVER: true + SEP1_TOML_VALUE: /home/runner/java-stellar-anchor-sdk/service-runner/src/main/resources/config/stellar.host.docker.internal.toml + SEP10_HOME_DOMAIN: host.docker.internal:8080 + run: | + cp /home/runner/java-stellar-anchor-sdk/service-runner/build/libs/anchor-platform-runner-*.jar /home/runner/anchor-platform-runner.jar + java -jar /home/runner/anchor-platform-runner.jar -t & + echo "PID=$!" >> $GITHUB_ENV + + - name: Wait for the sep server to start and get ready + uses: mydea/action-wait-for-api@v1 + with: + url: "http://localhost:8080/.well-known/stellar.toml" + expected-status: "200" + timeout: "300" + interval: "1" + + # + # Run Essential Tests + # + - name: Run Essential Tests + env: + RUN_DOCKER: false + ANCHOR_DOMAIN: http://host.docker.internal:8080 + run: | + cd /home/runner/java-stellar-anchor-sdk + ./gradlew test -x extended-tests:test jacocoTestReport --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar -x distTar -x distZip -x shadowJar -x shadowDistZip -x shadowDistTar -x bootDistTar -x bootDistZip + + - name: Run Stellar validation tool + run: | + docker run --network host -v /home/runner/java-stellar-anchor-sdk/platform/src/test/resources://config stellar/anchor-tests:v0.6.9 --home-domain http://host.docker.internal:8080 --seps 1 6 10 12 24 31 38 --sep-config //config/stellar-anchor-tests-sep-config.json --verbose + + - name: Upload Essential Tests Report + if: always() + uses: actions/upload-artifact@v3 + with: + name: essential-tests-report + path: | + /home/runner/java-stellar-anchor-sdk/api-schema/build/reports/ + /home/runner/java-stellar-anchor-sdk/core/build/reports/ + /home/runner/java-stellar-anchor-sdk/platform/build/reports/ + /home/runner/java-stellar-anchor-sdk/essential-tests/build/reports/ + diff --git a/.github/workflows/sub_extended_tests.yml b/.github/workflows/sub_extended_tests.yml new file mode 100644 index 0000000000..301ce43ff9 --- /dev/null +++ b/.github/workflows/sub_extended_tests.yml @@ -0,0 +1,66 @@ +name: Run Extended Tests Workflow + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + extended_tests: + name: Run Extended Tests + runs-on: ubuntu-latest-8-cores + steps: + ############################################# + # Setup JDK 11 + # Download, and Extract java-stellar-anchor-sdk.tar + # Setup hostnames (/etc/hosts) + ############################################# + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Download java-stellar-anchor-sdk.tar + uses: actions/download-artifact@v3 + with: + name: java-stellar-anchor-sdk-tar + path: /home/runner/ + + - name: Extract java-stellar-anchor-sdk.tar + run: | + cd /home/runner + tar -xf /home/runner/java-stellar-anchor-sdk.tar + cd /home/runner/java-stellar-anchor-sdk + + - name: Set up hostnames (/etc/hosts) + run: | + sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 zookeeper" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts + + ############################################# + + - name: Run Extended Tests + env: + ANCHOR_DOMAIN: http://host.docker.internal:8080 + SEP1_TOML_VALUE: /home/runner/java-stellar-anchor-sdk/service-runner/src/main/resources/config/stellar.host.docker.internal.toml + SEP10_HOME_DOMAIN: host.docker.internal:8080 + run: | + cd /home/runner/java-stellar-anchor-sdk + ./gradlew extended-tests:test --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar -x distTar -x distZip -x shadowJar -x shadowDistZip -x shadowDistTar -x bootDistTar -x bootDistZip + + - name: Upload Extended Tests Report + if: always() + uses: actions/upload-artifact@v3 + with: + name: extended-tests-report + path: | + /home/runner/java-stellar-anchor-sdk/extended-tests/build/reports/ + diff --git a/.github/workflows/sub_gradle_build.yml b/.github/workflows/sub_gradle_build.yml new file mode 100644 index 0000000000..5d473e5bbd --- /dev/null +++ b/.github/workflows/sub_gradle_build.yml @@ -0,0 +1,46 @@ +name: Build Anchor Platform Runnable Jar + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + gradle_build: + name: Gradle Build and Unit Tests + runs-on: ubuntu-latest-16-cores + # write to PR permission is required for jacocoTestReport Action to update comment + permissions: + contents: read + pull-requests: write + steps: + # Checkout the code + - name: Checkout the repository + uses: actions/checkout@v3 + with: + show-progress: false + + # Set up JDK 11 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Gradle Build with unit tests only + env: + run_docker: false + run: ./gradlew build jacocoTestReport -x essential-tests:test -x extended-tests:test --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar -x distTar -x distZip -x shadowJar -x shadowDistZip -x shadowDistTar -x bootDistTar -x bootDistZip + + - name: Archive Project Folder + run: | + cd /home/runner/work/java-stellar-anchor-sdk + tar -cf /home/runner/java-stellar-anchor-sdk.tar ./java-stellar-anchor-sdk + + - name: Upload java-stellar-anchor-sdk.tar to GitHub Artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: java-stellar-anchor-sdk-tar + path: | + /home/runner/java-stellar-anchor-sdk.tar diff --git a/.github/workflows/sub_gradle_test_and_build.yml b/.github/workflows/sub_gradle_test_and_build.yml deleted file mode 100644 index 78d6fa21c3..0000000000 --- a/.github/workflows/sub_gradle_test_and_build.yml +++ /dev/null @@ -1,165 +0,0 @@ -name: Gradle Build and Test - -on: - # allows this workflow to be called from another workflow - workflow_dispatch: - workflow_call: - -jobs: - gradle_test_and_build: - name: Gradle Build, Tests and Code Coverage - runs-on: ubuntu-latest-16-cores - # write to PR permission is required for jacocoTestReport Action to update comment - permissions: - contents: read - pull-requests: write - steps: - # Checkout the code - - uses: actions/checkout@v3 - - # This is to add to DNS entries to access the services started by docker-compose. - # This should be deprecated. Refer to: https://stackoverflow.com/questions/47762339/how-to-correctly-set-up-docker-network-to-use-localhost-connection/47763442#47763442 - - name: Set up hostnames (/etc/hosts) - run: | - sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 zookeeper" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts - sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts - - - name: Run Zookeeper, Kafka, Postgres, and Sep24 UI with docker compose - env: - TEST_PROFILE_NAME: default - run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml up -d --build - - # Check the docker containers - - name: Check running containers - run: docker ps - - # Prepare Stellar Validation Tests - - name: Pull Stellar Validation Tests Docker Image - run: docker pull stellar/anchor-tests:v0.6.9 & - - # Set up JDK 11 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - # Gradle test is now printing the test messages to GitHub Actions log. - # It is not necessary to print the reports. - - name: Gradle Build. (unit tests only) - env: - run_docker: false - run: ./gradlew clean build jacocoTestReport -x essential-tests:test -x extended-tests:test --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar - - - name: Run sep server, platform server, observer, and reference servers for integration tests - env: - run_docker: false - run_all_servers: false - run_sep_server: true - run_platform_server: true - run_observer: true - run_kotlin_reference_server: true - run_event_processing_server: true - run_wallet_server: true - - SEP1_TOML_VALUE: service-runner/src/main/resources/config/stellar.host.docker.internal.toml - SEP10_HOME_DOMAIN: host.docker.internal:8080 - run: | - pwd - cp service-runner/build/libs/anchor-platform-runner-*.jar service-runner/build/libs/anchor-platform-runner.jar - java -jar service-runner/build/libs/anchor-platform-runner.jar -t & - echo "PID=$!" >> $GITHUB_ENV - - - name: Wait for the sep server to start and get ready - uses: mydea/action-wait-for-api@v1 - with: - url: "http://localhost:8080/.well-known/stellar.toml" - expected-status: "200" - timeout: "300" - interval: "1" - - - name: Run the integration tests and end-2-end tests - env: - run_docker: false - ANCHOR_DOMAIN: http://host.docker.internal:8080 - - run: ./gradlew essential-tests:test - - - name: Run Stellar validation tool - run: | - docker run --network host -v ${GITHUB_WORKSPACE}/platform/src/test/resources://config stellar/anchor-tests:v0.6.9 --home-domain http://host.docker.internal:8080 --seps 1 6 10 12 24 31 38 --sep-config //config/stellar-anchor-tests-sep-config.json --verbose - - - name: Stop docker containers - env: - TEST_PROFILE_NAME: default - run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml down - - # The following step is to be moved to another workflow. - - name: Run the extended tests - run: | - kill -9 $PID - ./gradlew extended-tests:test - - - name: Add coverage to PR - id: jacoco - uses: madrapps/jacoco-report@v1.6.1 - with: - paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml - token: ${{ secrets.GITHUB_TOKEN }} - min-coverage-overall: 40 - min-coverage-changed-files: 60 - title: Code Coverage - update-comment: true - - - name: Upload Artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: gradle-artifact - path: | - /etc/hosts - /home/runner/work/java-stellar-anchor-sdk/java-stellar-anchor-sdk/api-schema/build/reports/ - /home/runner/work/java-stellar-anchor-sdk/java-stellar-anchor-sdk/core/build/reports/ - /home/runner/work/java-stellar-anchor-sdk/java-stellar-anchor-sdk/platform/build/reports/ - /home/runner/work/java-stellar-anchor-sdk/java-stellar-anchor-sdk/essential-tests/build/reports/ - - analyze: - name: CodeQL Analysis - runs-on: ubuntu-22.04 - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'java-kotlin' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Gradle properties - run: | - echo "kotlin.daemon.jvmargs=-Xmx2g" >> gradle.properties - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/sub_jacoco_report.yml b/.github/workflows/sub_jacoco_report.yml new file mode 100644 index 0000000000..4ba3982db2 --- /dev/null +++ b/.github/workflows/sub_jacoco_report.yml @@ -0,0 +1,70 @@ +name: Generate Jacoco Coverage Report + +on: + workflow_dispatch: + workflow_call: + inputs: + forceRebuild: + type: boolean + description: 'Force Gradle rebuild (true/false)' + required: false + default: false + +jobs: + jacoco-report: + name: Generate Jacoco Coverage Report + runs-on: ubuntu-latest + steps: + ############################################# + # Setup JDK 11 + # Download, and Extract java-stellar-anchor-sdk.tar + # Setup hostnames (/etc/hosts) + ############################################# + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Download java-stellar-anchor-sdk.tar + uses: actions/download-artifact@v3 + with: + name: java-stellar-anchor-sdk-tar + path: /home/runner/ + + - name: Extract java-stellar-anchor-sdk.tar + run: | + cd /home/runner + tar -xf /home/runner/java-stellar-anchor-sdk.tar + cd /home/runner/java-stellar-anchor-sdk + + - name: Set up hostnames (/etc/hosts) + run: | + sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 zookeeper" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts + + ############################################# + - name: Gradle Build with unit tests only + if : ${{ inputs.forceRebuild }} + run: | + cd /home/runner/java-stellar-anchor-sdk + ./gradlew clean build jacocoTestReport -x essential-tests:test -x extended-tests:test + + - name: Add coverage to the Pull Request + id: jacoco + uses: madrapps/jacoco-report@v1.6.1 + with: + # The path to the jacocoTestReport.xml files which were generated in the previous workflow + paths: /home/runner/java-stellar-sdk/**/build/reports/jacoco/test/jacocoTestReport.xml + token: ${{ secrets.GITHUB_TOKEN }} + min-coverage-overall: 40 + min-coverage-changed-files: 60 + title: Code Coverage + update-comment: true \ No newline at end of file diff --git a/.github/workflows/wf_pull_request.yml b/.github/workflows/wf_pull_request.yml deleted file mode 100644 index c5bd6e8700..0000000000 --- a/.github/workflows/wf_pull_request.yml +++ /dev/null @@ -1,21 +0,0 @@ -# This workflow will build a Java project with Gradle. -# This workflow is triggered: -# On all pull request events -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -name: Pull Request Workflow - -on: - pull_request: - -jobs: - gradle_test_and_build: - uses: ./.github/workflows/sub_gradle_test_and_build.yml - - complete: - if: always() - needs: [ gradle_test_and_build ] - runs-on: ubuntu-22.04 - steps: - - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') - run: exit 1 diff --git a/extended-tests/src/test/kotlin/org/stellar/anchor/platform/AnchorPlatformCustodyEnd2EndTest.kt b/extended-tests/src/test/kotlin/org/stellar/anchor/platform/AnchorPlatformCustodyEnd2EndTest.kt index f322446b19..c3fd72e840 100644 --- a/extended-tests/src/test/kotlin/org/stellar/anchor/platform/AnchorPlatformCustodyEnd2EndTest.kt +++ b/extended-tests/src/test/kotlin/org/stellar/anchor/platform/AnchorPlatformCustodyEnd2EndTest.kt @@ -3,7 +3,6 @@ package org.stellar.anchor.platform import org.junit.jupiter.api.* @TestMethodOrder(MethodOrderer.OrderAnnotation::class) -@Disabled class AnchorPlatformCustodyEnd2EndTest : AbstractIntegrationTest( TestConfig(testProfileName = "default-custody").also { diff --git a/extended-tests/src/test/kotlin/org/stellar/anchor/platform/test/PlatformApiCustodyTests.kt b/extended-tests/src/test/kotlin/org/stellar/anchor/platform/test/PlatformApiCustodyTests.kt index 9edc214a44..66d8e3ca96 100644 --- a/extended-tests/src/test/kotlin/org/stellar/anchor/platform/test/PlatformApiCustodyTests.kt +++ b/extended-tests/src/test/kotlin/org/stellar/anchor/platform/test/PlatformApiCustodyTests.kt @@ -59,6 +59,8 @@ class PlatformApiCustodyTests(config: TestConfig, toml: Sep1Helper.TomlContent, `SEP-24 deposit complete full`() `SEP-24 withdraw full refund`() + // TODO: This is temporarily disabled because of lacking support for debugging. This should be + // re-enabled once the tests are cleaned up. `SEP-31 refunded do_stellar_refund`() }