Optimize functional tests registration #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End to End tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
priorities: | ||
description: "Priorities of tests to register (comma-separated)" | ||
required: true | ||
type: string | ||
cache_key: | ||
description: "Cache key for docker image" | ||
required: true | ||
type: string | ||
jobs: | ||
endtoend: | ||
name: End to End tests | ||
runs-on: ubuntu-latest | ||
env: | ||
FLYTESNACKS_VERSION: '' | ||
steps: | ||
- name: Set latest Flytesnacks release | ||
if: ${{ env.FLYTESNACKS_VERSION == '' }} | ||
run: | | ||
FLYTESNACKS_VERSION="$(curl --silent https://api.github.com/repos/flyteorg/flytesnacks/releases/latest | jq -r .tag_name)" | ||
echo "FLYTESNACKS_VERSION=${FLYTESNACKS_VERSION}" >> ${GITHUB_ENV} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: unionai/[email protected] | ||
name: Setup flytectl | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.8 | ||
- id: load-docker-cache | ||
name: Load Docker Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/tmp/docker-images | ||
key: ${{ inputs.cache_key }} | ||
- name: Create Sandbox Cluster | ||
run: | | ||
cp /tmp/tmp/docker-images/snapshot.tar snapshot.tar | ||
flytectl config init | ||
flytectl sandbox start --source=$(pwd) | ||
- name: Prime docker cache | ||
run: | | ||
flytectl sandbox exec -- docker load -i /root/snapshot.tar | ||
- name: Setup Flytekit | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flytekit | ||
pip freeze | ||
- name: Checkout flytesnacks | ||
if: ${{ inputs.priorities == 'P0' }} | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: flyteorg/flytesnacks | ||
path: flytesnacks | ||
ref: ${{ env.FLYTESNACKS_VERSION }} | ||
- name: Register P0 tests | ||
if: ${{ inputs.priorities == 'P0' }} | ||
run: | | ||
for f in basics/basics/basic_workflow.py \ | ||
basics/basics/hello_world.py \ | ||
basics/basics/lp.py \ | ||
basics/basics/named_outputs.py \ | ||
control_flow/control_flow/chain_entities.py \ | ||
control_flow/control_flow/dynamics.py \ | ||
control_flow/control_flow/map_task.py \ | ||
control_flow/control_flow/subworkflows.py \ | ||
type_system/type_system/custom_objects.py \ | ||
type_system/type_system/schema.py \ | ||
type_system/type_system/typed_schema.py ; | ||
do | ||
pyflyte --config ./boilerplate/flyte/end2end/functional-test-config.yaml \ | ||
register \ | ||
--project flytesnacks \ | ||
--domain development \ | ||
--image cr.flyte.org/flyteorg/flytekit:py3.11-latest \ | ||
--version ${{ env.FLYTESNACKS_VERSION }} \ | ||
flytesnacks/examples/$f; | ||
done | ||
- name: Register all flytesnacks examples | ||
if: ${{ inputs.priorities != 'P0' }} | ||
uses: unionai/[email protected] | ||
with: | ||
flytesnacks: true | ||
project: flytesnacks | ||
version: ${{ env.FLYTESNACKS_VERSION }} | ||
domain: development | ||
- name: Pre Upgrade Tests | ||
if: ${{ github.event.repository.name == 'flyteadmin' }} | ||
env: | ||
PRIORITIES: "${{ inputs.priorities }}" | ||
run: | | ||
make end2end_execute | ||
- name: Upgrade Helm charts | ||
run: | | ||
flytectl sandbox exec -- helm repo add flyteorg https://flyteorg.github.io/flyte | ||
flytectl sandbox exec -- helm repo update | ||
flytectl sandbox exec -- helm upgrade flyte -n flyte-core --kubeconfig=/etc/rancher/k3s/k3s.yaml flyteorg/flyte-core -f /flyteorg/share/flyte/values-sandbox.yaml --wait --set ${{ github.event.repository.name }}.image.repository=flyteorg/${{ github.event.repository.name }},${{ github.event.repository.name }}.image.tag=latest | ||
flytectl sandbox exec -- k3s kubectl get pods -n flyte -oyaml | ||
- name: Post Upgrade Tests | ||
env: | ||
PRIORITIES: "${{ inputs.priorities }}" | ||
run: | | ||
make end2end_execute |