Skip to content

E2E

E2E #2942

Workflow file for this run

name: E2E
# Controls when the workflow will run
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch: # To start from UI
inputs:
sdkTypescriptCommit:
description: 'sdk-typescript commit'
required: false
default: ''
type: string
restateCommit:
description: 'restate commit'
required: false
default: ''
type: string
workflow_call:
inputs:
sdkTypescriptCommit:
description: 'sdk-typescript commit'
required: false
default: ''
type: string
restateCommit:
description: 'restate commit'
required: false
default: ''
type: string
e2eRef:
description: 'e2e repo ref, for cross-repo workflow calls'
required: true
type: string
secrets:
E2E_CONTENTS_READ_TOKEN:
description: 'token to allow reading the contents of the e2e repo, for cross-repo workflow calls'
required: true
jobs:
build:
# prevent e2e running on forks
if: github.repository_owner == 'restatedev'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
services:
registry:
# if we are building a restate snapshot, start a local docker registry to store it
# an empty image skips the service (see https://github.com/actions/runner/issues/822)
image: ${{ inputs.restateCommit != '' && 'registry:2' || '' }}
ports:
- 5000:5000
steps:
- uses: actions/checkout@v3
with:
repository: restatedev/e2e
# if we are in a workflow_call, use the e2e branch from the workflow call (usually main)
# otherwise, defer to the checkout actions default, which depends on the triggering event
ref: ${{ inputs.e2eRef || '' }}
token: ${{ secrets.E2E_CONTENTS_READ_TOKEN || secrets.GITHUB_TOKEN }}
# Setup Java
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
# Setup node
- uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://npm.pkg.github.com"
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ secrets.GH_PACKAGE_READ_ACCESS_USER }}
password: ${{ secrets.GH_PACKAGE_READ_ACCESS_TOKEN }}
# Setup sdk-typescript 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 sdk-typescript snapshot from in-progress workflow
if: ${{ inputs.sdkTypescriptCommit != '' && github.event_name != 'workflow_dispatch' }}
uses: actions/download-artifact@v3
with:
name: restatedev-restate-sdk
path: services/node-services
# In the workflow dispatch case where the artifact was created in a previous run, we can download as normal
- name: Download sdk-typescript snapshot from completed workflow
if: ${{ inputs.sdkTypescriptCommit != '' && github.event_name == 'workflow_dispatch' }}
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.SDK_TYPESCRIPT_ACTION_READ_TOKEN || secrets.GITHUB_TOKEN }}
repo: restatedev/sdk-typescript
commit: ${{ inputs.sdkTypescriptCommit }}
name: restatedev-restate-sdk
path: services/node-services
- name: Install sdk-typescript snapshot
if: ${{ inputs.sdkTypescriptCommit != '' }}
run: npm install restatedev-restate-sdk.tgz
working-directory: services/node-services
# 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@v3
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@v2
with:
github_token: ${{ secrets.RESTATE_ACTION_READ_TOKEN || secrets.GITHUB_TOKEN }}
repo: restatedev/restate
commit: ${{ inputs.restateCommit }}
name: restate.tar
- name: Install restate snapshot
if: ${{ inputs.restateCommit != '' }}
run: |
output=$(docker load --input restate.tar)
docker tag "${output#*: }" "localhost:5000/restatedev/restate:latest"
docker push localhost:5000/restatedev/restate:latest
# Run tests
- name: Test
uses: gradle/gradle-build-action@v2
env:
GH_PACKAGE_READ_ACCESS_USER: ${{ secrets.GH_PACKAGE_READ_ACCESS_USER }}
GH_PACKAGE_READ_ACCESS_TOKEN: ${{ secrets.GH_PACKAGE_READ_ACCESS_TOKEN }}
E2E_IMAGE_PULL_POLICY: always
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_READ_ACCESS_TOKEN }}
E2E_VERIFICATION_SEED: ${{ github.run_id }}
RESTATE_RUNTIME_CONTAINER: ${{ inputs.restateCommit != '' && 'localhost:5000/restatedev/restate:latest' || '' }}
with:
arguments: -Djib.console=plain check
# Upload container logs
- uses: actions/upload-artifact@v3
if: always() # Make sure this is run even when test fails
with:
name: container-logs
path: |
tests/build/test-results/*/container-logs/**
tests/build/reports/tests/**
tests/build/test-results/*/*.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
tests/build/test-results/*/*.xml