Skip to content

Commit

Permalink
Added pre and post test run compose action files
Browse files Browse the repository at this point in the history
Signed-off-by: noopur <[email protected]>
  • Loading branch information
noopurintel committed Dec 17, 2024
1 parent bd44b41 commit d19d655
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 354 deletions.
43 changes: 43 additions & 0 deletions .github/actions/task_runner_e2e/post_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
#---------------------------------------------------------------------------
# Composite Action to run post-test functions for task runner end to end tests
# Includes:
# - Print test summary
# - Create tar file
# - Upload artifacts
#
# Authors - Noopur, Payal Chaurasiya
#---------------------------------------------------------------------------
name: 'Post-Test Functions'
description: 'Run post-test functions'
inputs:
test_type:
description: 'Test type'
required: true

runs:
using: 'composite'
steps:
- name: Print test summary
id: print_test_summary
if: ${{ always() }}
run: |
export PYTHONPATH="$PYTHONPATH:."
python tests/end_to_end/utils/summary_helper.py
echo "Test summary printed"
shell: bash

- name: Create Tar (exclude cert and data folders)
id: tar_files
if: ${{ always() }}
run: |
tar -cvf result.tar --exclude="cert" --exclude="data" --exclude="__pycache__" $HOME/results
shell: bash

- name: Upload Artifacts
id: upload_artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ inputs.test_type }}_${{ env.MODEL_NAME }}_python${{ env.PYTHON_VERSION }}_${{ github.run_id }}
path: result.tar
39 changes: 39 additions & 0 deletions .github/actions/task_runner_e2e/pre_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
#---------------------------------------------------------------------------
# Composite Action to run pre-test functions for task runner end to end tests
# Includes:
# - Set up Python
# - Install dependencies
#
# Authors - Noopur, Payal Chaurasiya
#---------------------------------------------------------------------------
name: 'Pre-Test Functions'
description: 'Run pre-test functions'

runs:
using: 'composite'
steps:
- name: Set up Python
id: setup_python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
id: install_dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r test-requirements.txt
shell: bash

- name: Create OpenFL image
if: ${{ github.workflow == 'Task_Runner_E2E_via_Docker' }}
id: create_openfl_image
run: |
echo "Creating openfl image with current repo and branch. This may take a few minutes..."
cd openfl-docker
docker build . -t openfl -f Dockerfile.base \
--build-arg OPENFL_REVISION=https://github.com/${{ github.repository }}.git@${{ github.ref_name }}
echo "OpenFL image created successfully"
shell: bash
149 changes: 25 additions & 124 deletions .github/workflows/task_runner_basic_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Workflow to run Task Runner end to end tests using bare metal approach
# Authors - Noopur, Payal Chaurasiya
#---------------------------------------------------------------------------
name: Task Runner E2E
name: Task_Runner_E2E # Please do not modify the name as it is used in the composite action

on:
schedule:
Expand Down Expand Up @@ -55,18 +55,9 @@ jobs:
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
id: setup_python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
id: install_dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r test-requirements.txt
- name: Pre test run
uses: ./.github/actions/task_runner_e2e/pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests with TLS
id: run_tests
Expand All @@ -76,27 +67,11 @@ jobs:
--num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }}
echo "Task runner end to end test run completed"
- name: Print test summary
id: print_test_summary
if: ${{ always() }}
run: |
export PYTHONPATH="$PYTHONPATH:."
python tests/end_to_end/utils/summary_helper.py
echo "Test summary printed"
- name: Create Tar (exclude cert and data folders)
id: tar_files
if: ${{ always() }}
run: |
tar -cvf result.tar --exclude="cert" --exclude="data" --exclude="__pycache__" $HOME/results
- name: Upload Artifacts
id: upload_artifacts
uses: actions/upload-artifact@v4
- name: Post test run
uses: ./.github/actions/task_runner_e2e/post_test_run
if: ${{ always() }}
with:
name: tr_tls_${{ env.MODEL_NAME }}_python${{ env.PYTHON_VERSION }}_${{ github.run_id }}
path: result.tar
run_type: "tr_tls"

test_with_non_tls:
name: tr_non_tls
Expand All @@ -123,18 +98,9 @@ jobs:
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
id: setup_python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
id: install_dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r test-requirements.txt
- name: Pre test run
uses: ./.github/actions/task_runner_e2e/pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests without TLS
id: run_tests
Expand All @@ -144,27 +110,11 @@ jobs:
--num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} --disable_tls
echo "Task runner end to end test run completed"
- name: Print test summary
id: print_test_summary
if: ${{ always() }}
run: |
export PYTHONPATH="$PYTHONPATH:."
python tests/end_to_end/utils/summary_helper.py
echo "Test summary printed"
- name: Create Tar (exclude cert and data folders)
id: tar_files
if: ${{ always() }}
run: |
tar -cvf result.tar --exclude="cert" --exclude="data" --exclude="__pycache__" $HOME/results
- name: Upload Artifacts
id: upload_artifacts
uses: actions/upload-artifact@v4
- name: Post test run
uses: ./.github/actions/task_runner_e2e/post_test_run
if: ${{ always() }}
with:
name: tr_non_tls_${{ env.MODEL_NAME }}_python${{ env.PYTHON_VERSION }}_${{ github.run_id }}
path: result.tar
run_type: "tr_non_tls"

test_with_no_client_auth:
name: tr_no_client_auth
Expand All @@ -191,18 +141,9 @@ jobs:
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
id: setup_python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
id: install_dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r test-requirements.txt
- name: Pre test run
uses: ./.github/actions/task_runner_e2e/pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests without TLS
id: run_tests
Expand All @@ -212,27 +153,11 @@ jobs:
--num_rounds ${{ env.NUM_ROUNDS }} --num_collaborators ${{ env.NUM_COLLABORATORS }} --disable_client_auth
echo "Task runner end to end test run completed"
- name: Print test summary
id: print_test_summary
if: ${{ always() }}
run: |
export PYTHONPATH="$PYTHONPATH:."
python tests/end_to_end/utils/summary_helper.py
echo "Test summary printed"
- name: Create Tar (exclude cert and data folders)
id: tar_files
if: ${{ always() }}
run: |
tar -cvf result.tar --exclude="cert" --exclude="data" --exclude="__pycache__" $HOME/results
- name: Upload Artifacts
id: upload_artifacts
uses: actions/upload-artifact@v4
- name: Post test run
uses: ./.github/actions/task_runner_e2e/post_test_run
if: ${{ always() }}
with:
name: tr_no_client_auth_${{ env.MODEL_NAME }}_python${{ env.PYTHON_VERSION }}_${{ github.run_id }}
path: result.tar
run_type: "tr_no_client_auth"

test_memory_logs:
name: tr_tls_memory_logs
Expand All @@ -259,18 +184,9 @@ jobs:
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
id: setup_python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
id: install_dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r test-requirements.txt
- name: Pre test run
uses: ./.github/actions/task_runner_e2e/pre_test_run
if: ${{ always() }}

- name: Run Task Runner E2E tests with TLS and memory logs
id: run_tests
Expand All @@ -280,23 +196,8 @@ jobs:
--num_collaborators ${{ env.NUM_COLLABORATORS }} --log_memory_usage
echo "Task runner memory logs test run completed"
- name: Print test summary
id: print_test_summary
if: ${{ always() }}
run: |
export PYTHONPATH="$PYTHONPATH:."
python tests/end_to_end/utils/summary_helper.py
echo "Test summary printed"
- name: Tar files
id: tar_files
if: ${{ always() }}
run: tar -cvf result.tar --exclude="cert" --exclude="data" --exclude="__pycache__" $HOME/results

- name: Upload Artifacts
id: upload_artifacts
uses: actions/upload-artifact@v4
- name: Post test run
uses: ./.github/actions/task_runner_e2e/post_test_run
if: ${{ always() }}
with:
name: tr_tls_memory_logs_${{ env.MODEL_NAME }}_python${{ env.PYTHON_VERSION }}_${{ github.run_id }}
path: result.tar
run_type: "tr_tls_memory_logs"
Loading

0 comments on commit d19d655

Please sign in to comment.