From 051bf1e00f0a81307f14626f41d887deb953e5d3 Mon Sep 17 00:00:00 2001 From: Adam Narozniak <51029327+adam-narozniak@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:42:17 +0200 Subject: [PATCH] Add Flower Datasets tests as GitHub workflow (#2345) --------- Co-authored-by: Taner Topal --- .github/workflows/datasets.yml | 42 ++++++++++++++++++++++++++++++++++ datasets/dev/test.sh | 4 ++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/datasets.yml diff --git a/.github/workflows/datasets.yml b/.github/workflows/datasets.yml new file mode 100644 index 000000000000..60eb9e49db45 --- /dev/null +++ b/.github/workflows/datasets.yml @@ -0,0 +1,42 @@ +name: Datasets + +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +defaults: + run: + working-directory: datasets + +jobs: + test_core: + runs-on: ubuntu-22.04 + strategy: + matrix: + # Latest version which comes cached in the host image can be found here: + # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#python + # In case of a mismatch, the job has to download Python to install it. + # Note: Due to a bug in actions/setup-python we have to put 3.10 in + # qoutes as it will otherwise will assume 3.1 + python: [3.8, 3.9, '3.10'] + + name: Python ${{ matrix.python }} + + steps: + - uses: actions/checkout@v4 + - name: Bootstrap + uses: ./.github/actions/bootstrap + with: + python-version: ${{ matrix.python }} + - name: Install dependencies (mandatory only) + run: python -m poetry install --all-extras + - name: Test (formatting + unit tests) + run: ./dev/test.sh diff --git a/datasets/dev/test.sh b/datasets/dev/test.sh index 06338dffaea2..babb5a3cdd36 100755 --- a/datasets/dev/test.sh +++ b/datasets/dev/test.sh @@ -2,6 +2,10 @@ set -e cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../ +# Append path to PYTHONPATH that makes flwr_tool.init_py_check discoverable +PARENT_DIR=$(dirname "$(pwd)") # Go one dir up from flower/datasets +export PYTHONPATH="${PYTHONPATH}:${PARENT_DIR}/src/py" + echo "=== test.sh ===" echo "- Start Python checks"