From 91e4d6a542b5921f3572817217b3d08dab9add09 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Mon, 5 Aug 2024 15:23:56 +0200 Subject: [PATCH] E2E actions for running in runtime --- .github/workflows/ci.yml | 41 -------------- .github/workflows/e2e.yaml | 112 +++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/e2e.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8f2eac9..64e251c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,47 +71,6 @@ jobs: name: Event File path: ${{ github.event_path }} - - sdk-test-suite: - runs-on: ubuntu-latest - name: "Integration Test (Test tool ${{ matrix.sdk-test-suite }})" - strategy: - matrix: - sdk-test-suite: [ "1.4" ] - - steps: - - uses: actions/checkout@v4 - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Setup sdk-test-suite - run: wget --no-verbose https://github.com/restatedev/sdk-test-suite/releases/download/v${{ matrix.sdk-test-suite }}/restate-sdk-test-suite.jar - - - name: Build restatedev/java-test-services image - run: ./gradlew -Djib.console=plain :test-services:jibDockerBuild - - # Run test suite - - name: Run test suite - run: java -jar restate-sdk-test-suite.jar run --report-dir=test-report restatedev/java-test-services - - # Upload logs and publish test result - - uses: actions/upload-artifact@v4 - if: always() # Make sure this is run even when test fails - with: - name: test-report - path: test-report - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: | - test-report/*/*.xml - # TODO remove once we don't need it anymore e2e: permissions: diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml new file mode 100644 index 00000000..8af79d78 --- /dev/null +++ b/.github/workflows/e2e.yaml @@ -0,0 +1,112 @@ +name: Feature Integration test + +# Controls when the workflow will run +on: + pull_request: + push: + branches: + - main + schedule: + - cron: '0 */6 * * *' # Every 6 hours + workflow_dispatch: + inputs: + restateCommit: + description: 'restate commit' + required: false + default: '' + type: string + restateImage: + description: 'restate image, superseded by restate commit' + required: false + default: 'ghcr.io/restatedev/restate:main' + type: string + workflow_call: + inputs: + restateCommit: + description: 'restate commit' + required: false + default: '' + type: string + restateImage: + description: 'restate image, superseded by restate commit' + required: false + default: 'ghcr.io/restatedev/restate:main' + type: string + +jobs: + + sdk-test-suite: + if: github.repository_owner == 'restatedev' + runs-on: ubuntu-latest + name: "Features integration test (sdk-test-suite version ${{ matrix.sdk-test-suite }})" + strategy: + matrix: + sdk-test-suite: [ "1.4" ] + permissions: + contents: read + issues: read + checks: write + pull-requests: write + actions: read + + steps: + - uses: actions/checkout@v4 + with: + repository: restatedev/sdk-java + + ### Download the Restate container image, if needed + # Setup restate snapshot if necessary + # Due to https://github.com/actions/upload-artifact/issues/53 + # We must use download-artifact to get artifacts created during *this* workflow run, ie by workflow call + - name: Download restate snapshot from in-progress workflow + if: ${{ inputs.restateCommit != '' && github.event_name != 'workflow_dispatch' }} + uses: actions/download-artifact@v4 + with: + name: restate.tar + # In the workflow dispatch case where the artifact was created in a previous run, we can download as normal + - name: Download restate snapshot from completed workflow + if: ${{ inputs.restateCommit != '' && github.event_name == 'workflow_dispatch' }} + uses: dawidd6/action-download-artifact@v3 + with: + repo: restatedev/restate + workflow: ci.yml + commit: ${{ inputs.restateCommit }} + name: restate.tar + - name: Install restate snapshot + if: ${{ inputs.restateCommit != '' }} + run: | + output=$(docker load --input restate.tar) + docker tag "${output#*: }" "restatedev/restate-commit-download:latest" + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Setup sdk-test-suite + run: wget --no-verbose https://github.com/restatedev/sdk-test-suite/releases/download/v${{ matrix.sdk-test-suite }}/restate-sdk-test-suite.jar + + - name: Build restatedev/java-test-services image + run: ./gradlew -Djib.console=plain :test-services:jibDockerBuild + + # Run test suite + - name: Run test suite + env: + RESTATE_CONTAINER_IMAGE: ${{ inputs.restateCommit != '' && 'restatedev/restate-commit-download:latest' || (inputs.restateImage != '' && inputs.restateImage || 'ghcr.io/restatedev/restate:main') }} + run: java -jar restate-sdk-test-suite.jar run --report-dir=test-report restatedev/java-test-services + + # Upload logs and publish test result + - uses: actions/upload-artifact@v4 + if: always() # Make sure this is run even when test fails + with: + name: test-report + path: test-report + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: | + test-report/*/*.xml