|
| 1 | +name: Integration (class-based API) |
| 2 | + |
| 3 | +# Controls when the workflow will run |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + schedule: |
| 10 | + - cron: "0 */6 * * *" # Every 6 hours |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + restateCommit: |
| 14 | + description: "restate commit" |
| 15 | + required: false |
| 16 | + default: "" |
| 17 | + type: string |
| 18 | + restateImage: |
| 19 | + description: "restate image, superseded by restate commit" |
| 20 | + required: false |
| 21 | + default: "ghcr.io/restatedev/restate:main" |
| 22 | + type: string |
| 23 | + serviceImage: |
| 24 | + description: "service image, if provided it will skip building the image from sdk main branch" |
| 25 | + required: false |
| 26 | + default: "" |
| 27 | + type: string |
| 28 | + workflow_call: |
| 29 | + inputs: |
| 30 | + restateCommit: |
| 31 | + description: "restate commit" |
| 32 | + required: false |
| 33 | + default: "" |
| 34 | + type: string |
| 35 | + restateImage: |
| 36 | + description: "restate image, superseded by restate commit" |
| 37 | + required: false |
| 38 | + default: "ghcr.io/restatedev/restate:main" |
| 39 | + type: string |
| 40 | + serviceImage: |
| 41 | + description: "service image, if provided it will skip building the image from sdk main branch" |
| 42 | + required: false |
| 43 | + default: "" |
| 44 | + type: string |
| 45 | + |
| 46 | +jobs: |
| 47 | + sdk-test-suite: |
| 48 | + if: github.repository_owner == 'restatedev' |
| 49 | + runs-on: warp-ubuntu-latest-x64-4x |
| 50 | + name: Features integration test (class-based API) |
| 51 | + permissions: |
| 52 | + contents: read |
| 53 | + issues: read |
| 54 | + checks: write |
| 55 | + pull-requests: write |
| 56 | + actions: read |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + repository: restatedev/sdk-python |
| 62 | + |
| 63 | + - name: Set up Docker containerd snapshotter |
| 64 | + uses: docker/setup-docker-action@v4 |
| 65 | + with: |
| 66 | + version: "v28.5.2" |
| 67 | + set-host: true |
| 68 | + daemon-config: | |
| 69 | + { |
| 70 | + "features": { |
| 71 | + "containerd-snapshotter": true |
| 72 | + } |
| 73 | + } |
| 74 | +
|
| 75 | + ### Download the Restate container image, if needed |
| 76 | + # Setup restate snapshot if necessary |
| 77 | + # Due to https://github.com/actions/upload-artifact/issues/53 |
| 78 | + # We must use download-artifact to get artifacts created during *this* workflow run, ie by workflow call |
| 79 | + - name: Download restate snapshot from in-progress workflow |
| 80 | + if: ${{ inputs.restateCommit != '' && github.event_name != 'workflow_dispatch' }} |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: restate.tar |
| 84 | + # In the workflow dispatch case where the artifact was created in a previous run, we can download as normal |
| 85 | + - name: Download restate snapshot from completed workflow |
| 86 | + if: ${{ inputs.restateCommit != '' && github.event_name == 'workflow_dispatch' }} |
| 87 | + uses: dawidd6/action-download-artifact@v3 |
| 88 | + with: |
| 89 | + repo: restatedev/restate |
| 90 | + workflow: ci.yml |
| 91 | + commit: ${{ inputs.restateCommit }} |
| 92 | + name: restate.tar |
| 93 | + - name: Install restate snapshot |
| 94 | + if: ${{ inputs.restateCommit != '' }} |
| 95 | + run: | |
| 96 | + output=$(docker load --input restate.tar | head -n 1) |
| 97 | + docker tag "${output#*: }" "localhost/restatedev/restate-commit-download:latest" |
| 98 | + docker image ls -a |
| 99 | +
|
| 100 | + # Either build the docker image from source |
| 101 | + - name: Set up QEMU |
| 102 | + if: ${{ inputs.serviceImage == '' }} |
| 103 | + uses: docker/setup-qemu-action@v3 |
| 104 | + - name: Set up Docker Buildx |
| 105 | + if: ${{ inputs.serviceImage == '' }} |
| 106 | + uses: docker/setup-buildx-action@v3 |
| 107 | + with: |
| 108 | + driver-opts: | |
| 109 | + network=host |
| 110 | + - name: Build Python test-services-cls image |
| 111 | + if: ${{ inputs.serviceImage == '' }} |
| 112 | + id: build |
| 113 | + uses: docker/build-push-action@v6 |
| 114 | + with: |
| 115 | + context: . |
| 116 | + file: "test-services-cls/Dockerfile" |
| 117 | + push: false |
| 118 | + load: true |
| 119 | + tags: restatedev/test-services-python-cls |
| 120 | + cache-from: type=gha,url=http://127.0.0.1:49160/,version=1,scope=${{ github.workflow }} |
| 121 | + cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max,version=1,scope=${{ github.workflow }} |
| 122 | + |
| 123 | + # Or use the provided one |
| 124 | + - name: Pull test services image |
| 125 | + if: ${{ inputs.serviceImage != '' }} |
| 126 | + shell: bash |
| 127 | + run: docker pull ${{ inputs.serviceImage }} |
| 128 | + |
| 129 | + - name: Run test tool |
| 130 | + uses: restatedev/sdk-test-suite@v3.4 |
| 131 | + with: |
| 132 | + restateContainerImage: ${{ inputs.restateCommit != '' && 'localhost/restatedev/restate-commit-download:latest' || (inputs.restateImage != '' && inputs.restateImage || 'ghcr.io/restatedev/restate:main') }} |
| 133 | + serviceContainerImage: ${{ inputs.serviceImage != '' && inputs.serviceImage || 'restatedev/test-services-python-cls' }} |
| 134 | + exclusionsFile: "test-services-cls/exclusions.yaml" |
| 135 | + testArtifactOutput: "sdk-python-cls-integration-test-report" |
| 136 | + serviceContainerEnvFile: "test-services-cls/.env" |
0 commit comments