Skip to content

Standardized dependency installation for GitHub actions #1472

Standardized dependency installation for GitHub actions

Standardized dependency installation for GitHub actions #1472

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: OpenFL-Test
on:
push:
branches: [master]
pull_request: {}
env:
# A workaround for long FQDN names provided by GitHub actions.
FQDN: "localhost"
jobs:
openfl-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Call reusable workflow to install dependencies
id: dependencies
uses: ./.github/workflows/dependencies
- name: Run generic unit tests to download data and construct CSVs
if: ${{steps.dependencies.outputs.other_modified_files_count > 0}} # Run on any non-docs change
run: |
pytest --cov=. --cov-report=xml -k "prepare_data_for_ci"
# openfl tests start here
- name: Run OpenFL tests
if: ${{steps.dependencies.outputs.other_modified_files_count > 0}} # Run on any non-docs change
run: |
echo "Removing onnx because of protobuf version conflict"
pip uninstall onnx -y
echo "Installing OpenFL"
git clone --depth=1 https://github.com/securefederatedai/openfl.git
cd openfl
git fetch --tags
# echo "Checkout the latest OpenFL tag"
# latestTag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
# git checkout $latestTag
# sed -i -e 's/protobuf==3.19.6/protobuf/g' setup.py ## this should NOT be there
pip install -e .
cd ..
echo "Copying files to appropriate directories and updated headers"
head -n 1 testing/data/train_2d_rad_segmentation.csv > /home/runner/work/GaNDLF/GaNDLF/openfl/valid.csv
tail -n +9 testing/data/train_2d_rad_segmentation.csv >> /home/runner/work/GaNDLF/GaNDLF/openfl/valid.csv
head -n 8 testing/data/train_2d_rad_segmentation.csv > /home/runner/work/GaNDLF/GaNDLF/openfl/train.csv
sed -i 's/# n_channels: 3/num_channels: 3/g' testing/config_segmentation.yaml
config_to_use=$(pwd)/testing/config_segmentation.yaml
cd openfl
python -m tests.github.test_gandlf --template gandlf_seg_test --fed_workspace aggregator --col1 one --col2 two --rounds-to-train 1 --gandlf_config $config_to_use