Skip to content

Commit

Permalink
Merge branch 'main' into add-assign-reviewer-script
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll authored Oct 15, 2024
2 parents b04299d + e8c110d commit 4111921
Show file tree
Hide file tree
Showing 1,120 changed files with 150,875 additions and 90,830 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ RUN apt-get install -y curl wget gnupg python3 python-is-python3 python3-pip git
build-essential tmux vim

RUN python -m pip install \
pip==24.0.0 \
setuptools==69.5.1 \
pip==24.1.2 \
setuptools==70.3.0 \
poetry==1.7.1

USER $USERNAME
Expand Down
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ profile = black
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2

[*.toml]
indent_style = space
indent_size = 4
14 changes: 13 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@
README.md @jafermarq @tanertopal @danieljanes

# Flower Baselines
/baselines @jafermarq @tanertopal @danieljanes
/baselines @jafermarq @danieljanes

# Flower Benchmarks
/benchmarks @jafermarq @danieljanes

# Flower Datasets
/datasets @jafermarq @tanertopal @danieljanes

# Flower Examples
/examples @jafermarq @tanertopal @danieljanes

# Flower Templates
/src/py/flwr/cli/new/templates @jafermarq @tanertopal @danieljanes

# Changelog
/doc/source/ref-changelog.md @jafermarq @tanertopal @danieljanes

Expand All @@ -24,3 +30,9 @@ README.md @jafermarq @tanertopal @danieljanes
# GitHub Actions and Workflows
/.github/workflows @Robert-Steiner @tanertopal @danieljanes
/.github/actions @Robert-Steiner @tanertopal @danieljanes

# Docker-related files
/.devcontainer @Robert-Steiner @Moep90 @tanertopal @danieljanes
**/Dockerfile @Robert-Steiner @Moep90 @tanertopal @danieljanes
**/*.Dockerfile @Robert-Steiner @Moep90 @tanertopal @danieljanes
/src/docker @Robert-Steiner @Moep90 @tanertopal @danieljanes
6 changes: 3 additions & 3 deletions .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ description: "Bootstrap Python environment (install and configure Python version
inputs:
python-version:
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax."
default: 3.8
default: 3.9
pip-version:
description: "Version of pip to be installed using pip"
default: 24.0.0
default: 24.1.2
setuptools-version:
description: "Version of setuptools to be installed using pip"
default: 69.5.1
default: 70.3.0
poetry-version:
description: "Version of poetry to be installed using pip"
default: 1.7.1
Expand Down
62 changes: 38 additions & 24 deletions .github/workflows/_docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,16 @@ permissions:
jobs:
build:
name: Build image
runs-on: ubuntu-22.04
runs-on: ${{ matrix.platform.runner-os }}
timeout-minutes: 180
outputs:
build-id: ${{ steps.build-id.outputs.id }}
strategy:
fail-fast: true
matrix:
platform: [
# build-push action and qemu use different platform names
# therefore we create a map
{ name: "amd64", qemu: "", docker: "linux/amd64" },
{ name: "arm64", qemu: "arm64", docker: "linux/arm64" },
{ name: "amd64", docker: "linux/amd64", runner-os: "ubuntu-22.04" },
{ name: "arm64", docker: "linux/arm64", runner-os: "ubuntu-4-core-arm64" },
]
steps:
- name: Create build id
Expand All @@ -60,14 +58,24 @@ jobs:
hash = hashlib.sha256('''${{ inputs.namespace-repository }}
${{ inputs.file-dir }}
${{ inputs.build-args }}'''.encode())
# Adds two spaces to the line breaks to ensure proper indentation
# when passing the multi-line string to the wretry.action.
# Without it, the multi-line string is passed like this:
#
# build-args: |
# ARG1=
# ARG2=
# ARG3=
#
# This causes the Docker action to interpret ARG2 and ARG3 as keys instead
# of values ​​of the multi-line string.
build_args = '''${{ inputs.build-args }}'''.replace("\n", "\n ")
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f"id={hash.hexdigest()}", file=fh)
- name: Set up QEMU
if: matrix.platform.qemu != ''
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: ${{ matrix.platform.qemu }}
print("build-args<<EOF", file=fh)
print(build_args, file=fh)
print("EOF", file=fh)
- name: Extract metadata (tags, labels) for Docker
id: meta
Expand All @@ -76,32 +84,38 @@ jobs:
images: ${{ inputs.namespace-repository }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

- name: Login to Docker Hub
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.dockerhub-user }}
password: ${{ secrets.dockerhub-token }}

- name: Build and push
uses: Wandalen/wretry.action@6feedb7dedadeb826de0f45ff482b53b379a7844 # v3.5.0
id: build
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
pull: true
platforms: ${{ matrix.platform.docker }}
context: "{{defaultContext}}:${{ inputs.file-dir }}"
build-args: ${{ inputs.build-args }}
outputs: type=image,name=${{ inputs.namespace-repository }},push-by-digest=true,name-canonical=true,push=true
action: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
attempt_limit: 60 # 60 attempts * (9 secs delay + 1 sec retry) = ~10 mins
attempt_delay: 9000 # 9 secs
with: |
pull: true
sbom: true
platforms: ${{ matrix.platform.docker }}
context: "{{defaultContext}}:${{ inputs.file-dir }}"
outputs: type=image,name=${{ inputs.namespace-repository }},push-by-digest=true,name-canonical=true,push=true
build-args: |
${{ steps.build-id.outputs.build-args }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
digest="${{ fromJSON(steps.build.outputs.outputs).digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: digests-${{ steps.build-id.outputs.id }}-${{ matrix.platform.name }}
path: /tmp/digests/*
Expand All @@ -117,7 +131,7 @@ jobs:
metadata: ${{ steps.meta.outputs.json }}
steps:
- name: Download digests
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: digests-${{ needs.build.outputs.build-id }}-*
path: /tmp/digests
Expand All @@ -131,10 +145,10 @@ jobs:
tags: ${{ inputs.tags }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

- name: Login to Docker Hub
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.dockerhub-user }}
password: ${{ secrets.dockerhub-token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cache-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: Cleanup caches by directories
# Only keep caches that match the latest keys for each directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/datasets-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Bootstrap
uses: ./.github/actions/bootstrap
with:
python-version: 3.8
python-version: 3.9
- name: Install dependencies
run: python -m poetry install
- name: Run tests
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ on:
- main
paths:
- "datasets/**"
- ".github/workflows/datasets.yml"
- ".github/workflows/datasets-e2e.yml"
pull_request:
branches:
- main
paths:
- "datasets/**"
- ".github/workflows/datasets.yml"
- ".github/workflows/datasets-e2e.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
FLWR_TELEMETRY_ENABLED: 0

defaults:
run:
working-directory: datasets
Expand All @@ -28,9 +35,9 @@ jobs:
# 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']
# Note: Due to a bug in actions/setup-python, we have to put "3.10" in
# quotes as it will otherwise assume "3.1"
python: ['3.9', '3.10', '3.11']

name: Python ${{ matrix.python }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
name: Build docker images
name: Build Docker Images Main Branch

on:
workflow_dispatch:
inputs:
flwr-version:
description: "Version of Flower."
required: true
type: string

permissions:
contents: read
push:
branches:
- 'main'

jobs:
parameters:
name: Collect build parameters
if: github.repository == 'adap/flower'
name: Collect docker build parameters
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
pip-version: ${{ steps.versions.outputs.pip-version }}
setuptools-version: ${{ steps.versions.outputs.setuptools-version }}
matrix: ${{ steps.matrix.outputs.matrix }}
flwr-version-ref: ${{ steps.versions.outputs.flwr-version-ref }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

Expand All @@ -30,46 +25,45 @@ jobs:
run: |
echo "pip-version=${{ steps.bootstrap.outputs.pip-version }}" >> "$GITHUB_OUTPUT"
echo "setuptools-version=${{ steps.bootstrap.outputs.setuptools-version }}" >> "$GITHUB_OUTPUT"
echo "flwr-version-ref=git+${{ github.server_url }}/${{ github.repository }}.git@${{ github.sha }}" >> "$GITHUB_OUTPUT"
- id: matrix
run: |
python dev/build-docker-image-matrix.py --flwr-version ${{ github.event.inputs.flwr-version }} > matrix.json
echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT
build-base-images:
build-docker-base-images:
name: Build base images
if: github.repository == 'adap/flower'
uses: ./.github/workflows/_docker-build.yml
needs: parameters
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parameters.outputs.matrix).base }}
with:
namespace-repository: ${{ matrix.images.namespace_repository }}
file-dir: ${{ matrix.images.file_dir }}
namespace-repository: flwr/base
file-dir: src/docker/base/ubuntu
build-args: |
PYTHON_VERSION=${{ matrix.images.python_version }}
PIP_VERSION=${{ needs.parameters.outputs.pip-version }}
SETUPTOOLS_VERSION=${{ needs.parameters.outputs.setuptools-version }}
DISTRO=${{ matrix.images.distro.name }}
DISTRO_VERSION=${{ matrix.images.distro.version }}
FLWR_VERSION=${{ matrix.images.flwr_version }}
tags: ${{ matrix.images.tag }}
FLWR_VERSION_REF=${{ needs.parameters.outputs.flwr-version-ref }}
tags: unstable
secrets:
dockerhub-user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}

build-binary-images:
build-docker-binary-images:
name: Build binary images
if: github.repository == 'adap/flower'
uses: ./.github/workflows/_docker-build.yml
needs: [parameters, build-base-images]
needs: build-docker-base-images
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parameters.outputs.matrix).binary }}
matrix:
images: [
{ repository: "flwr/superlink", file_dir: "src/docker/superlink" },
{ repository: "flwr/supernode", file_dir: "src/docker/supernode" },
{ repository: "flwr/serverapp", file_dir: "src/docker/serverapp" },
{ repository: "flwr/superexec", file_dir: "src/docker/superexec" },
{ repository: "flwr/clientapp", file_dir: "src/docker/clientapp" }
]
with:
namespace-repository: ${{ matrix.images.namespace_repository }}
namespace-repository: ${{ matrix.images.repository }}
file-dir: ${{ matrix.images.file_dir }}
build-args: BASE_IMAGE=${{ matrix.images.base_image }}
tags: ${{ matrix.images.tags }}
build-args: BASE_IMAGE=unstable
tags: unstable
secrets:
dockerhub-user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
Loading

0 comments on commit 4111921

Please sign in to comment.