Skip to content

Commit

Permalink
Merge branch 'main' into fds-add-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljanes authored Mar 11, 2024
2 parents 93ec136 + 0864aa7 commit 16a0bff
Show file tree
Hide file tree
Showing 772 changed files with 58,471 additions and 18,698 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN apt-get install -y curl wget gnupg python3 python-is-python3 python3-pip git
RUN python -m pip install \
pip==23.3.1 \
setuptools==68.2.2 \
poetry==1.5.1
poetry==1.7.1

USER $USERNAME
ENV PATH="/home/$USERNAME/.local/bin:${PATH}"
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Default code owners
* @danieljanes @tanertopal

# README.md
README.md @jafermarq @tanertopal @danieljanes

# Flower Baselines
/baselines @jafermarq @tanertopal @danieljanes

Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/baseline_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ body:
attributes:
label: For first time contributors
value: |
- [ ] Read the [`first contribution` doc](https://flower.dev/docs/first-time-contributors.html)
- [ ] Read the [`first contribution` doc](https://flower.ai/docs/first-time-contributors.html)
- [ ] Complete the Flower tutorial
- [ ] Read the Flower Baselines docs to get an overview:
- [ ] [How to use Flower Baselines](https://flower.dev/docs/baselines/how-to-use-baselines.html)
- [ ] [How to contribute a Flower Baseline](https://flower.dev/docs/baselines/how-to-contribute-baselines.html)
- [ ] [How to use Flower Baselines](https://flower.ai/docs/baselines/how-to-use-baselines.html)
- [ ] [How to contribute a Flower Baseline](https://flower.ai/docs/baselines/how-to-contribute-baselines.html)
- type: checkboxes
attributes:
label: Prepare - understand the scope
options:
- label: Read the paper linked above
- label: Decide which experiments you'd like to reproduce. The more the better!
- label: Follow the steps outlined in [Add a new Flower Baseline](https://flower.dev/docs/baselines/how-to-contribute-baselines.html#add-a-new-flower-baseline).
- label: Follow the steps outlined in [Add a new Flower Baseline](https://flower.ai/docs/baselines/how-to-contribute-baselines.html#add-a-new-flower-baseline).
- label: You can use as reference [other baselines](https://github.com/adap/flower/tree/main/baselines) that the community merged following those steps.
- type: checkboxes
attributes:
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Slack Channel
url: https://flower.dev/join-slack
url: https://flower.ai/join-slack
about: Connect with other Flower users and contributors and discuss with them or ask them questions.
- name: Discussion
url: https://github.com/adap/flower/discussions
about: Ask about new features or general questions. Please use the discussion area in most of the cases instead of the issues.
about: Ask about new features or general questions. Please use the discussion area in most of the cases instead of the issues.
- name: Flower Issues
url: https://github.com/adap/flower/issues
about: Contribute new features/enhancements, report bugs, or improve the documentation.
- name: Flower Mail
url: https://flower.dev/
about: If your project needs professional support please contact the Flower team (hello@flower.dev).
url: https://flower.ai/
about: If your project needs professional support please contact the Flower team (hello@flower.ai).
10 changes: 5 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ Example: The variable `rnd` was renamed to `server_round` to improve readability

- [ ] Implement proposed change
- [ ] Write tests
- [ ] Update [documentation](https://flower.dev/docs/writing-documentation.html)
- [ ] Update [documentation](https://flower.ai/docs/writing-documentation.html)
- [ ] Update the changelog entry below
- [ ] Make CI checks pass
- [ ] Ping maintainers on [Slack](https://flower.dev/join-slack/) (channel `#contributions`)
- [ ] Ping maintainers on [Slack](https://flower.ai/join-slack/) (channel `#contributions`)

<!--
Inside the following 'Changelog entry' section, you should put the description of your changes that will be added to the changelog alongside your PR title.
If the section is completely empty (without any token), the changelog will just contain the title of the PR for the changelog entry, without any description. If the 'Changelog entry' section is removed entirely, it will categorize the PR as "General improvement" and add it to the changelog accordingly. If the section contains some text other than tokens, it will use it to add a description to the change. If the section contains one of the following tokens it will ignore any other text and put the PR under the corresponding section of the changelog:
If the section is completely empty (without any token) or non-existant, the changelog will just contain the title of the PR for the changelog entry, without any description. If the section contains some text other than tokens, it will use it to add a description to the change. If the section contains one of the following tokens it will ignore any other text and put the PR under the corresponding section of the changelog:
<general> is for classifying a PR as a general improvement.
<skip> is to not add the PR to the changelog
Expand All @@ -58,7 +58,7 @@ Note that only one token should be used.

### Changelog entry

<general>


### Any other comments?

Expand All @@ -68,7 +68,7 @@ Smaller PRs with good descriptions can be considered much more easily.
If you have an urgent request or question, please use the Flower Slack:
https://flower.dev/join-slack/ (channel: #contributions)
https://flower.ai/join-slack/ (channel: #contributions)
Thank you for contributing to Flower!
-->
4 changes: 2 additions & 2 deletions .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
default: 68.2.2
poetry-version:
description: "Version of poetry to be installed using pip"
default: 1.5.1
default: 1.7.1
outputs:
python-version:
description: "Version range or exact version of Python or PyPy"
Expand All @@ -30,7 +30,7 @@ runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install build tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
metadata: ${{ steps.meta.outputs.json }}
steps:
- name: Download digests
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
pattern: digests-${{ needs.build.outputs.build-id }}-*
path: /tmp/digests
Expand Down
166 changes: 60 additions & 106 deletions .github/workflows/baselines.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
name: Baselines
# The aim of this workflow is to test only the changed (or added) baseline.
# Here is the rough idea of how it works (more details are presented later in the comments):
# 1. Checks for the changes between the current branch and the main - in case of PR -
# or between the HEAD and HEAD~1 (main last commit and the previous one) - in case of
# a push to main.
# 2. Fails the test if there are changes to more than one baseline. Passes the test
# (skips the rests) if there are no changes to any baselines. Follows the test if only
# one baseline is added or modified.
# 3. Sets up the env specified for the baseline.
# 4. Runs the tests.

on:
push:
branches:
Expand All @@ -24,112 +15,75 @@ concurrency:
env:
FLWR_TELEMETRY_ENABLED: 0

defaults:
run:
working-directory: baselines

jobs:
test_baselines:
name: Test
changes:
runs-on: ubuntu-22.04
permissions:
pull-requests: read
outputs:
baselines: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
# The depth two of the checkout is needed in case of merging to the main
# because we compare the HEAD (current version) with HEAD~1 (version before
# the PR was merged)
with:
fetch-depth: 2
- name: Fetch main branch
run: |
# The main branch is needed in case of the PR to make a comparison (by
# default the workflow takes as little information as possible - it does not
# have the history
if [ ${{ github.event_name }} == "pull_request" ]
then
git fetch origin main:main
fi
- name: Find changed/new baselines
id: find_changed_baselines_dirs

- shell: bash
run: |
if [ ${{ github.event_name }} == "push" ]
then
# Push event triggered when merging to main
change_references="HEAD..HEAD~1"
else
# Pull request event triggered for any commit to a pull request
change_references="main..HEAD"
fi
dirs=$(git diff --dirstat=files,0 ${change_references} . | awk '{print $2}' | grep -E '^baselines/[^/]*/$' | \
grep -v \
-e '^baselines/dev' \
-e '^baselines/baseline_template' \
-e '^baselines/flwr_baselines' \
-e '^baselines/doc' \
| sed 's/^baselines\///')
# git diff --dirstat=files,0 ${change_references} . - checks the differences
# and a file is counted as changed if more than 0 lines were changed
# it returns the results in the format x.y% path/to/dir/
# awk '{print $2}' - takes only the directories (skips the percentages)
# grep -E '^baselines/[^/]*/$' - takes only the paths that start with
# baseline (and have at least one subdirectory)
# grep -v -e ... - excludes the `baseline_template`, `dev`, `flwr_baselines`
# sed 's/^baselines\///' - narrows down the path to baseline/<subdirectory>
echo "Detected changed directories: ${dirs}"
# Save changed dirs to output of this step
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "dirs<<EOF" >> "$GITHUB_OUTPUT"
for dir in $dirs
do
echo "$dir" >> "$GITHUB_OUTPUT"
done
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Validate changed/new baselines
id: validate_changed_baselines_dirs
# create a list of all directories in baselines
{
echo 'FILTER_PATHS<<EOF'
FILTER=""
while read -d $'\0' BASELINES_PATH; do
DIR=$(basename $BASELINES_PATH)
FILTER+=$(echo "$DIR: ${BASELINES_PATH}/**\n")
done < <(find baselines -maxdepth 1 \
-name ".*" -prune -o \
-path "baselines/doc" -prune -o \
-path "baselines/dev" -prune -o \
-path "baselines/baseline_template" -prune -o \
-path "baselines/flwr_baselines" -prune -o \
-type d -print0)
FILTER=$(echo -e "$FILTER")
# remove first line
FILTER=${FILTER#*$'\n'}
echo "$FILTER"
echo EOF
} >> "$GITHUB_ENV"
- uses: dorny/paths-filter@v3
id: filter
with:
filters: ${{ env.FILTER_PATHS }}

- if: ${{ github.event.pull_request.head.repo.fork }}
run: |
dirs="${{ steps.find_changed_baselines_dirs.outputs.dirs }}"
dirs_array=()
if [[ -n $dirs ]]; then
while IFS= read -r line; do
dirs_array+=("$line")
done <<< "$dirs"
fi
length=${#dirs_array[@]}
echo "The number of changed baselines is $length"
if [ $length -gt 1 ]; then
echo "The changes should only apply to a single baseline"
exit 1
CHANGES=$(echo "${{ toJson(steps.filter.outputs.changes) }}" | jq '. | length')
if [ "$CHANGES" -gt 1 ]; then
echo "::error ::The changes should only apply to a single baseline."
exit 1
fi
if [ $length -eq 0 ]; then
echo "The baselines were not changed - skipping the remaining steps."
echo "baseline_changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "changed_dir=${dirs[0]}" >> "$GITHUB_OUTPUT"
echo "baseline_changed=true" >> "$GITHUB_OUTPUT"
test:
runs-on: ubuntu-22.04
needs: changes
if: ${{ needs.changes.outputs.baselines != '' && toJson(fromJson(needs.changes.outputs.baselines)) != '[]' }}
strategy:
matrix:
baseline: ${{ fromJSON(needs.changes.outputs.baselines) }}
steps:
- uses: actions/checkout@v4

- name: Bootstrap
if: steps.validate_changed_baselines_dirs.outputs.baseline_changed == 'true'
uses: ./.github/actions/bootstrap
with:
python-version: '3.10'

- name: Install dependencies
if: steps.validate_changed_baselines_dirs.outputs.baseline_changed == 'true'
run: |
changed_dir="${{ steps.validate_changed_baselines_dirs.outputs.changed_dir }}"
cd "${changed_dir}"
python -m poetry install
- name: Test
if: steps.validate_changed_baselines_dirs.outputs.baseline_changed == 'true'
run: |
dir="${{ steps.validate_changed_baselines_dirs.outputs.changed_dir }}"
echo "Testing ${dir}"
./dev/test-baseline.sh $dir
- name: Test Structure
if: steps.validate_changed_baselines_dirs.outputs.baseline_changed == 'true'
run: |
dir="${{ steps.validate_changed_baselines_dirs.outputs.changed_dir }}"
echo "Testing ${dir}"
./dev/test-baseline-structure.sh $dir
working-directory: baselines/${{ matrix.baseline }}
run: python -m poetry install

- name: Testing ${{ matrix.baseline }}
working-directory: baselines
run: ./dev/test-baseline.sh ${{ matrix.baseline }}

- name: Test Structure of ${{ matrix.baseline }}
working-directory: baselines
run: ./dev/test-baseline-structure.sh ${{ matrix.baseline }}
8 changes: 4 additions & 4 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
uses: ./.github/actions/bootstrap

- name: Cache restore SDK build
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: build/
key: ${{ runner.os }}-sdk-build

- name: Cache restore example build
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: examples/quickstart-cpp/build/
key: ${{ runner.os }}-example-build
Expand Down Expand Up @@ -82,14 +82,14 @@ jobs:
fi
- name: Cache save SDK build
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: github.ref_name == 'main'
with:
path: build/
key: ${{ runner.os }}-sdk-build

- name: Cache save example build
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: github.ref_name == 'main'
with:
path: examples/quickstart-cpp/build/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
flwr-version:
description: "Version of Flower e.g. (1.6.0)."
description: "Version of Flower e.g. (1.7.0)."
required: true
type: string

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
flwr-version:
description: "Version of Flower e.g. (1.6.0)."
description: "Version of Flower e.g. (1.7.0)."
required: true
type: string
base-image-tag:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets. AWS_DEFAULT_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets. AWS_SECRET_ACCESS_KEY }}
DOCS_BUCKET: flower.ai
run: |
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./doc/build/html/ s3://flower.dev/docs/framework
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./baselines/doc/build/html/ s3://flower.dev/docs/baselines
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./examples/doc/build/html/ s3://flower.dev/docs/examples
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./datasets/doc/build/html/ s3://flower.dev/docs/datasets
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./doc/build/html/ s3://${{ env.DOCS_BUCKET }}/docs/framework
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./baselines/doc/build/html/ s3://${{ env.DOCS_BUCKET }}/docs/baselines
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./examples/doc/build/html/ s3://${{ env.DOCS_BUCKET }}/docs/examples
aws s3 sync --delete --exclude ".*" --exclude "v/*" --cache-control "no-cache" ./datasets/doc/build/html/ s3://${{ env.DOCS_BUCKET }}/docs/datasets
Loading

0 comments on commit 16a0bff

Please sign in to comment.