Skip to content

extensions: add e2e test framework (#517) #1484

extensions: add e2e test framework (#517)

extensions: add e2e test framework (#517) #1484

Workflow file for this run

# Copyright Built On Envoy
# SPDX-License-Identifier: Apache-2.0
# The full text of the Apache license is available in the LICENSE file at
# the root of the repo.
name: Extensions
on:
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**
env:
GOPROXY: https://proxy.golang.org
jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
extensions:
- 'extensions/**'
predicate-quantifier: every # Make the filters be AND-ed
token: "" # don't use github api
outputs:
extensions: ${{ steps.changes.outputs.extensions }}
discover:
needs: changes
if: ${{ needs.changes.outputs.extensions == 'true' }}
runs-on: ubuntu-latest
outputs:
rust-extensions: ${{ steps.discover.outputs.rust-extensions }}
extproc-extensions: ${{ steps.discover.outputs.extproc-extensions }}
has-composer: ${{ steps.discover.outputs.has-composer }}
steps:
- uses: actions/checkout@v7
- name: Discover extensions
id: discover
run: |
# Discover extensions and their languages
extensions="[]"
for dir in extensions/*/; do
# Skip if not a directory
[ -d "$dir" ] || continue
ext_path=$(basename "$dir")
manifest="$dir/manifest.yaml"
# Skip if no manifest
[ -f "$manifest" ] || continue
# Read name and type from manifest
ext_name=$(yq '.name' "$manifest")
type=$(yq '.type' "$manifest")
# Detect language
lang=""
if [ -f "$dir/Cargo.toml" ]; then
lang="rust"
elif [ -f "$dir/go.mod" ]; then
lang="go"
elif [ "$type" = "lua" ]; then
lang="lua"
fi
echo "Found extension: $ext_name (type=$type, lang=$lang, path=$ext_path)"
# Add to extensions array
if [ -n "$lang" ]; then
extensions=$(echo "$extensions" | jq -c \
--arg name "$ext_name" \
--arg type "$type" \
--arg lang "$lang" \
--arg path "$ext_path" \
'. + [{name: $name, type: $type, language: $lang, path: $path}]')
fi
done
# Filter Rust extensions
rust_extensions=$(echo "$extensions" | jq -c '[.[] | select(.language == "rust")]')
# Filter ExtProc extensions
extproc_extensions=$(echo "$extensions" | jq -c '[.[] | select(.type == "ext_proc")]')
# Check if composer extension exists
has_composer=$(echo "$extensions" | jq '[.[] | select(.name == "composer")] | length > 0')
echo "rust-extensions=$rust_extensions" >> $GITHUB_OUTPUT
echo "extproc-extensions=$extproc_extensions" >> $GITHUB_OUTPUT
echo "has-composer=$has_composer" >> $GITHUB_OUTPUT
echo "Rust extensions: $rust_extensions"
echo "ExtProc extensions: $extproc_extensions"
echo "Has composer: $has_composer"
rust-checks:
needs: discover
if: ${{ needs.discover.outputs.rust-extensions != '[]' }}
uses: ./.github/workflows/extensions-rust.yaml
with:
extensions: ${{ needs.discover.outputs.rust-extensions }}
secrets: inherit
go-checks:
needs: discover
if: ${{ needs.discover.outputs.has-composer == 'true' }}
uses: ./.github/workflows/extensions-go.yaml
secrets: inherit
extproc-checks:
needs: discover
if: ${{ needs.discover.outputs.extproc-extensions != '[]' }}
uses: ./.github/workflows/extensions-extproc.yaml
with:
extensions: ${{ needs.discover.outputs.extproc-extensions }}
secrets: inherit
e2e-check:
runs-on: ubuntu-latest
needs: changes
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- run: make -C extensions/tests/e2e check
e2e:
runs-on: ubuntu-latest
needs: e2e-check
strategy:
fail-fast: false
matrix:
envoy_version:
- dev
- 1.38.0
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Run extension e2e tests
env:
GO_TEST_ARGS: -v
ENVOY_VERSION: ${{ matrix.envoy_version }}
run: make -C extensions/tests/e2e test
- uses: actions/upload-artifact@v7
if: failure()
with:
name: extension-e2e-logs-envoy-${{ matrix.envoy_version }}
path: extensions/tests/e2e/**/*.log
if-no-files-found: ignore
# Aggregate all the required jobs and make it easier to customize CI required jobs
extensions-checks:
runs-on: ubuntu-latest
needs:
- discover
- rust-checks
- go-checks
- extproc-checks
- e2e-check
- e2e
# We need this to run always to force-fail (and not skip) if any needed
# job has failed. Otherwise, a skipped job will not fail the workflow.
if: always()
steps:
- run: |
echo "Extension checks completed"
[ "${{
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
}}" == "false" ] || exit 1