Skip to content

Commit

Permalink
feat: add E2E tests modules and github workflow
Browse files Browse the repository at this point in the history
Changes:
* add new gradle module e2e-tests
* add new reusable github workflow e2e

Enhancement:
* update main workflow to use setup-build composite action
* update main workflow to use .plugin file for listing plugins
* update docker workflow to use .plugin file for listing plugins
  • Loading branch information
fhussonnois committed Jul 4, 2024
1 parent c6fcb83 commit a090a4d
Show file tree
Hide file tree
Showing 14 changed files with 614 additions and 322 deletions.
24 changes: 24 additions & 0 deletions .github/actions/plugins-list/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Load Kestra Plugin List'
description: 'Composite action to load list of plugins'
inputs:
plugin-version:
description: "Kestra version"
default: 'LATEST'
required: true
plugin-file:
description: "File of the plugins"
default: './.plugins'
required: true
outputs:
plugins:
description: "List of all Kestra plugins"
value: ${{ steps.plugins.outputs.plugins }}
runs:
using: composite
steps:
- name: Get Plugins List
id: plugins
shell: bash
run: |
PLUGINS=$([ -f ${{ inputs.plugin-file }} ] && cat ${{ inputs.plugin-file }} | grep "io\\.kestra\\." | sed -e '/#/s/^.//' | sed -e "s/LATEST/${{ inputs.plugin-version }}/g" | xargs || echo '');
echo "plugins=$PLUGINS" >> $GITHUB_OUTPUT
20 changes: 20 additions & 0 deletions .github/actions/setup-vars/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Setup vars'
description: 'Composite action to setup common vars'
outputs:
tag:
description: "Git tag"
value: ${{ steps.vars.outputs.tag }}
commit:
description: "Git commit"
value: ${{ steps.vars.outputs.commit }}
runs:
using: composite
steps:
# Setup vars
- name: Set variables
id: vars
shell: bash
run: |
TAG=${GITHUB_REF#refs/*/}
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "commit=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
109 changes: 18 additions & 91 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,119 +16,46 @@ on:
required: false
type: string
default: "LATEST"

jobs:
docker:
name: Publish docker
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
env:
PLUGIN_VERSION: ${{ github.event.inputs.plugin-version != null && github.event.inputs.plugin-version || 'LATEST' }}
DOCKER_APT_PACKAGES: python3 python3-venv python-is-python3 python3-pip nodejs npm curl zip unzip
DOCKER_PYTHON_LIBRARIES: kestra
strategy:
matrix:
image:
- name: ""
plugins: ""
packages: ""
python-libs: ""
- name: "-full"
plugins: >-
io.kestra.plugin:plugin-airbyte:$PLUGIN_VERSION
io.kestra.plugin:plugin-amqp:$PLUGIN_VERSION
io.kestra.plugin:plugin-ansible:$PLUGIN_VERSION
io.kestra.plugin:plugin-aws:$PLUGIN_VERSION
io.kestra.plugin:plugin-azure:$PLUGIN_VERSION
io.kestra.plugin:plugin-cassandra:$PLUGIN_VERSION
io.kestra.plugin:plugin-cloudquery:$PLUGIN_VERSION
io.kestra.plugin:plugin-compress:$PLUGIN_VERSION
io.kestra.plugin:plugin-couchbase:$PLUGIN_VERSION
io.kestra.plugin:plugin-crypto:$PLUGIN_VERSION
io.kestra.plugin:plugin-databricks:$PLUGIN_VERSION
io.kestra.plugin:plugin-dataform:$PLUGIN_VERSION
io.kestra.plugin:plugin-dbt:$PLUGIN_VERSION
io.kestra.plugin:plugin-debezium-db2:$PLUGIN_VERSION
io.kestra.plugin:plugin-debezium-mongodb:$PLUGIN_VERSION
io.kestra.plugin:plugin-debezium-mysql:$PLUGIN_VERSION
io.kestra.plugin:plugin-debezium-oracle:$PLUGIN_VERSION
io.kestra.plugin:plugin-debezium-postgres:$PLUGIN_VERSION
io.kestra.plugin:plugin-debezium-sqlserver:$PLUGIN_VERSION
io.kestra.plugin:plugin-docker:$PLUGIN_VERSION
io.kestra.plugin:plugin-elasticsearch:$PLUGIN_VERSION
io.kestra.plugin:plugin-fivetran:$PLUGIN_VERSION
io.kestra.plugin:plugin-fs:$PLUGIN_VERSION
io.kestra.plugin:plugin-gcp:$PLUGIN_VERSION
io.kestra.plugin:plugin-git:$PLUGIN_VERSION
io.kestra.plugin:plugin-googleworkspace:$PLUGIN_VERSION
io.kestra.plugin:plugin-hightouch:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-as400:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-clickhouse:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-db2:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-duckdb:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-druid:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-mysql:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-oracle:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-pinot:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-postgres:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-redshift:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-rockset:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-snowflake:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-sqlserver:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-trino:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-vectorwise:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-vertica:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-dremio:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-arrow-flight:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-sqlite:$PLUGIN_VERSION
io.kestra.plugin:plugin-jdbc-sybase:$PLUGIN_VERSION
io.kestra.plugin:plugin-kafka:$PLUGIN_VERSION
io.kestra.plugin:plugin-kubernetes:$PLUGIN_VERSION
io.kestra.plugin:plugin-malloy:$PLUGIN_VERSION
io.kestra.plugin:plugin-minio:$PLUGIN_VERSION
io.kestra.plugin:plugin-modal:$PLUGIN_VERSION
io.kestra.plugin:plugin-mongodb:$PLUGIN_VERSION
io.kestra.plugin:plugin-mqtt:$PLUGIN_VERSION
io.kestra.plugin:plugin-nats:$PLUGIN_VERSION
io.kestra.plugin:plugin-neo4j:$PLUGIN_VERSION
io.kestra.plugin:plugin-notifications:$PLUGIN_VERSION
io.kestra.plugin:plugin-openai:$PLUGIN_VERSION
io.kestra.plugin:plugin-powerbi:$PLUGIN_VERSION
io.kestra.plugin:plugin-pulsar:$PLUGIN_VERSION
io.kestra.plugin:plugin-redis:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-groovy:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-julia:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-jython:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-nashorn:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-node:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-powershell:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-python:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-r:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-ruby:$PLUGIN_VERSION
io.kestra.plugin:plugin-script-shell:$PLUGIN_VERSION
io.kestra.plugin:plugin-serdes:$PLUGIN_VERSION
io.kestra.plugin:plugin-servicenow:$PLUGIN_VERSION
io.kestra.plugin:plugin-singer:$PLUGIN_VERSION
io.kestra.plugin:plugin-soda:$PLUGIN_VERSION
io.kestra.plugin:plugin-solace:$PLUGIN_VERSION
io.kestra.plugin:plugin-spark:$PLUGIN_VERSION
io.kestra.plugin:plugin-sqlmesh:$PLUGIN_VERSION
io.kestra.plugin:plugin-surrealdb:$PLUGIN_VERSION
io.kestra.plugin:plugin-terraform:$PLUGIN_VERSION
io.kestra.plugin:plugin-tika:$PLUGIN_VERSION
io.kestra.plugin:plugin-weaviate:$PLUGIN_VERSION
io.kestra.storage:storage-azure:$PLUGIN_VERSION
io.kestra.storage:storage-gcs:$PLUGIN_VERSION
io.kestra.storage:storage-minio:$PLUGIN_VERSION
io.kestra.storage:storage-s3:$PLUGIN_VERSION
packages: python3 python3-venv python-is-python3 python3-pip nodejs npm curl zip unzip
python-libs: kestra
packages: $DOCKER_APT_PACKAGES
python-libs: $DOCKER_PYTHON_LIBRARIES
steps:
- uses: actions/checkout@v4

# Get Plugins List
- name: Get Plugins List
uses: ./.github/actions/plugins-list
id: plugins-list
with:
plugin-version: ${{ env.PLUGIN_VERSION }}

# Vars
- name: Set image name
id: vars
run: |
TAG=${GITHUB_REF#refs/*/}
PLUGINS=""
if [[ "${{ matrix.image.name }}" = "-full" ]]
then
PLUGINS = "$PLUGINS ${{ steps.plugins.outputs.plugins }}"
fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "plugins=${{ matrix.image.plugins }}" >> $GITHUB_OUTPUT
Expand Down
164 changes: 164 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: 'Reusable Workflow for Running End-to-End Tests'
on:
workflow_call:
inputs:
tags:
description: "Tags used for filtering tests to include for QA."
type: string
required: true
docker-artifact-name:
description: "The GitHub artifact containing the Kestra docker image."
type: string
required: false
docker-image-tag:
description: "The Docker image Tag for Kestra"
default: 'kestra/kestra:develop-full'
type: string
required: true
backend:
description: "The Kestra backend type to be used for E2E tests."
type: string
required: true
default: "postgres"
secrets:
GITHUB_AUTH_TOKEN:
description: "The GitHub Token."
required: true
GOOGLE_SERVICE_ACCOUNT:
description: "The Google Service Account."
required: false
jobs:
check:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
E2E_TEST_DOCKER_DIR: ./kestra/e2e-tests/docker
KESTRA_BASE_URL: http://127.27.27.27:8080/ui/
steps:
# Checkout kestra
- name: Checkout kestra
uses: actions/checkout@v4
with:
path: kestra

# Checkout GitHub Actions
- uses: actions/checkout@v4
with:
repository: kestra-io/actions
path: actions
ref: main

# Setup build
- uses: ./actions/.github/actions/setup-build
id: build
with:
java-enabled: true
caches-enabled: true

# Get Docker Image
- name: Download Kestra Image
if: inputs.docker-artifact-name != ''
uses: actions/download-artifact@v4
with:
name: ${{ inputs.docker-artifact-name }}
path: /tmp

- name: Load Kestra Image
if: inputs.docker-artifact-name != ''
run: |
docker load --input /tmp/${{ inputs.docker-artifact-name }}.tar
# Docker Compose
- name: Login to DockerHub
uses: docker/login-action@v3
if: inputs.docker-artifact-name == ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

# Build configuration
- name: Create additional application configuration
run: |
touch ${{ env.E2E_TEST_DOCKER_DIR }}/data/application-secrets.yml
- name: Setup additional application configuration
if: env.APPLICATION_SECRETS != null
env:
APPLICATION_SECRETS: ${{ secrets.APPLICATION_SECRETS }}
run: |
echo $APPLICATION_SECRETS | base64 -d > ${{ env.E2E_TEST_DOCKER_DIR }}/data/application-secrets.yml
# Deploy Docker Compose Stack
- name: Run Kestra (${{ inputs.backend }})
env:
KESTRA_DOCKER_IMAGE: ${{ inputs.docker-image-tag }}
run: |
cd ${{ env.E2E_TEST_DOCKER_DIR }}
echo "KESTRA_DOCKER_IMAGE=$KESTRA_DOCKER_IMAGE" >> .env
docker compose -f docker-compose-${{ inputs.backend }}.yml up -d
- name: Install Playwright Deps
run: |
cd kestra
./gradlew playwright --args="install-deps"
# Run E2E Tests
- name: Wait For Kestra UI
run: |
# Start time
START_TIME=$(date +%s)
# Timeout duration in seconds (5 minutes)
TIMEOUT_DURATION=$((5 * 60))
while [ $(curl -s -L -o /dev/null -w %{http_code} $KESTRA_BASE_URL) != 200 ]; do
echo -e $(date) "\tKestra server HTTP state: " $(curl -k -L -s -o /dev/null -w %{http_code} $KESTRA_BASE_URL) " (waiting for 200)";
# Check the elapsed time
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
# Break the loop if the elapsed time exceeds the timeout duration
if [ $ELAPSED_TIME -ge $TIMEOUT_DURATION ]; then
echo "Timeout reached: Exiting after 5 minutes."
exit 1;
fi
sleep 2;
done;
echo "Kestra is running: $KESTRA_BASE_URL 🚀";
continue-on-error: true

- name: Run E2E Tests (${{ inputs.tags }})
if: inputs.tags != ''
run: |
cd kestra
./gradlew e2eTestsCheck -P tags=${{ inputs.tags }}
- name: Run E2E Tests
if: inputs.tags == ''
run: |
cd kestra
./gradlew e2eTestsCheck
# Allure check
- name: Auth to Google Cloud
id: auth
if: ${{ !cancelled() && env.GOOGLE_SERVICE_ACCOUNT != 0 }}
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GOOGLE_SERVICE_ACCOUNT }}'

- uses: rlespinasse/github-slug-action@v4

- name: Publish allure report
uses: andrcuns/[email protected]
if: ${{ !cancelled() && env.GOOGLE_SERVICE_ACCOUNT != 0 }}
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_AUTH_TOKEN }}
JAVA_HOME: /usr/lib/jvm/default-jvm/
with:
storageType: gcs
resultsGlob: build/allure-results
bucket: internal-kestra-host
baseUrl: "https://internal.kestra.io"
prefix: ${{ format('{0}/{1}/{2}', github.repository, env.GITHUB_HEAD_REF_SLUG != '' && env.GITHUB_HEAD_REF_SLUG || github.ref_name, 'allure/playwright') }}
copyLatest: true
ignoreMissingResults: true
Loading

0 comments on commit a090a4d

Please sign in to comment.