diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml new file mode 100644 index 0000000000..dcf2e00049 --- /dev/null +++ b/.github/workflows/on_pull_request.yml @@ -0,0 +1,28 @@ +name: On Pull Request Workflow + +on: + pull_request: + +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 + + stellar_validation: + needs: [ gradle_build ] + uses: ./.github/workflows/sub_stellar_validation.yml + + complete: + if: always() + needs: [ gradle_build, essential_tests, extended_tests, stellar_validation ] + 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..db10ba0488 --- /dev/null +++ b/.github/workflows/on_pull_request_comments.yml @@ -0,0 +1,10 @@ +name: Pull Request Comments + +on: + issue_comment: + types: [ created, edited ] + +jobs: + check-comment: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-extended-tests') + uses: ./.github/workflows/sub_extended_tests.yml diff --git a/.github/workflows/wk_push_to_develop.yml b/.github/workflows/on_push_to_develop.yml similarity index 100% rename from .github/workflows/wk_push_to_develop.yml rename to .github/workflows/on_push_to_develop.yml diff --git a/.github/workflows/wf_release_created_or_updated.yml b/.github/workflows/on_release_created_or_updated.yml similarity index 100% rename from .github/workflows/wf_release_created_or_updated.yml rename to .github/workflows/on_release_created_or_updated.yml diff --git a/.github/workflows/sub_essential_tests.yml b/.github/workflows/sub_essential_tests.yml new file mode 100644 index 0000000000..b511c45af1 --- /dev/null +++ b/.github/workflows/sub_essential_tests.yml @@ -0,0 +1,101 @@ +name: Run Essential Tests Workflow + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + essential_tests: + runs-on: ubuntu-latest-16-cores + # runs-on: ubuntu-latest + steps: + # Download the JAR from the previous workflow + - 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: | + tar -xvf /home/runner/java-stellar-anchor-sdk.tar + ls -al /home/runner + ls -al /home/runner/java-stellar-anchor-sdk + ls -al /home/runner/java-stellar-anchor-sdk/service-runner + ls -al /home/runner/java-stellar-anchor-sdk/service-runner/src/main/resources/config/stellar.host.docker.internal.toml + cd /home/runner/java-stellar-anchor-sdk + + # 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 /home/runner/java-stellar-anchor-sdk/service-runner/src/main/resources/docker-compose-test.yaml up -d --build + + # Set up JDK 11 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - 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" + + - name: Run Essential Tests + env: + run_docker: false + ANCHOR_DOMAIN: http://host.docker.internal:8080 + run: | + cd /home/runner/java-stellar-anchor-sdk + pwd + ls -al . + ./gradlew essential-tests:test + + - name: Upload Essential Tests Report + if: always() + uses: actions/upload-artifact@v3 + with: + name: essential-tests-report + path: | + /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/ + diff --git a/.github/workflows/sub_extended_tests.yml b/.github/workflows/sub_extended_tests.yml new file mode 100644 index 0000000000..e4528ab80b --- /dev/null +++ b/.github/workflows/sub_extended_tests.yml @@ -0,0 +1,13 @@ +name: Run Extended Tests Workflow + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + extended_tests: + runs-on: ubuntu-latest + steps: + - name: Run Extended Tests + run: echo "Running Extended Tests" \ No newline at end of file diff --git a/.github/workflows/sub_gradle_build.yml b/.github/workflows/sub_gradle_build.yml new file mode 100644 index 0000000000..6d284a878a --- /dev/null +++ b/.github/workflows/sub_gradle_build.yml @@ -0,0 +1,47 @@ +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 clean build -x test -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 -cvf /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 +# /home/runner/work/java-stellar-anchor-sdk/java-stellar-anchor-sdk/service-runner/build/libs/anchor-platform-runner-*.jar diff --git a/.github/workflows/sub_stellar_validation.yml b/.github/workflows/sub_stellar_validation.yml new file mode 100644 index 0000000000..2f07d89628 --- /dev/null +++ b/.github/workflows/sub_stellar_validation.yml @@ -0,0 +1,13 @@ +name: Run Extended Tests Workflow + +on: + # allows this workflow to be called from another workflow + workflow_dispatch: + workflow_call: + +jobs: + extended_tests: + runs-on: ubuntu-latest + steps: + - name: Run Stellar Validation + run: echo "Running Stellar Validation" \ 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