Skip to content

chore: run E2E tests from a separate workflow #1

chore: run E2E tests from a separate workflow

chore: run E2E tests from a separate workflow #1

Workflow file for this run

name: Run E2E tests
on:
push:
workflow_dispatch:
inputs:
postgres_img:
description: "PostgreSQL Image (leave empty for default)"
required: false
major_version:
description: "PostgreSQL major version (leave empty for default)"
required: false
cnpg_branch:
description: "Name of the branch/tag used to build & load the operator (leave empty for default)"
required: false
test_depth:
description: 'E2E test level: 0(highest) to 4(lowest) (leave empty for default)'
required: false
feature_type:
description: 'E2E feature type filter. See https://github.com/cloudnative-pg/cloudnative-pg/blob/main/contribute/e2e_testing_environment/README.md#using-feature-type-test-selectionfilter'
required: false
jobs:
evaluate-env:
name: Evaluate input env variables
runs-on: ubuntu-24.04
outputs:
pg_image: "${{ env.PG_IMAGE }}"
pg_major: ${{ env.PG_MAJOR }}
cnpg_branch: ${{ env.CNPG_BRANCH }}
test_depth: ${{ env.TEST_DEPTH }}
feature_type: ${{ env.FEATURE_TYPE }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set env variables from defaults.json
run: |
for key in $(jq -r 'keys[]' defaults.json); do
echo "$key=$(cat defaults.json | jq -r --arg key "$key" '.[$key]')" >> $GITHUB_ENV
done
# Inputs have priority over defaults.json.
- name: Evaluate E2E workflow inputs
run: |
if [[ -n "${{ github.event.inputs.postgres_img }}" ]]; then
echo "PG_IMAGE=${{ github.event.inputs.postgres_img }}" >> $GITHUB_ENV
fi
if [[ -n "${{ github.event.inputs.major_version }}" ]]; then
echo "PG_MAJOR=${{ github.event.inputs.major_version }}" >> $GITHUB_ENV
fi
if [[ -n "${{ github.event.inputs.cnpg_branch }}" ]]; then
echo "CNPG_BRANCH=${{ github.event.inputs.cnpg_branch }}" >> $GITHUB_ENV
fi
if [[ -n "${{ github.event.inputs.test_depth }}" ]]; then
echo "TEST_DEPTH=${{ github.event.inputs.test_depth }}" >> $GITHUB_ENV
fi
if [[ -n "${{ github.event.inputs.feature_type }}" ]]; then
echo "FEATURE_TYPE=${{ github.event.inputs.feature_type }}" >> $GITHUB_ENV
fi
call-run-e2e:
needs:
- evaluate-env
uses: ./.github/workflows/run-e2e.yml
with:
postgres_img: ${{ needs.evaluate-env.outputs.pg_image }}
major_version: ${{ needs.evaluate-env.outputs.pg_major }}
cnpg_branch: ${{ needs.evaluate-env.outputs.cnpg_branch }}
test_depth: ${{ needs.evaluate-env.outputs.test_depth }}
feature_type: ${{ needs.evaluate-env.outputs.feature_type }}