-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π style(code): Format by `black` β¨(method): New method: FedFed π³ chore(image): Optimize `docker-publish` workflow & Add `tensorboard` port in EXPOSE in Dockerfile π perf(metrics): Remove try-catch in loss calculation π docs(readme): Optimize README π¦ refactor(models): Make `feature_length` for some classes static π¦ refactor(func): Refactor `exec()` of `FLBenchTrainer()`
- Loading branch information
Showing
11 changed files
with
709 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,126 @@ | ||
name: Docker-Publish | ||
name: Docker Image Publish | ||
|
||
on: | ||
push: | ||
paths: | ||
- '.environment/**' | ||
- '.github/workflows/docker-publish.yml' | ||
|
||
- ".environment/**" | ||
- ".github/workflows/docker-publish.yml" | ||
|
||
env: | ||
IMAGE_LOWERCASE_NAME: fl-bench | ||
IMAGE_LOWERCASE_OWNER: karhoutam | ||
GITHUB_REGISTRY: ghcr.io | ||
ALIYUN_REGISTRY: registry.cn-hangzhou.aliyuncs.com | ||
DOCKERHUB_REGISTRY: docker.io | ||
IMAGE_TAG: master | ||
|
||
jobs: | ||
build: | ||
build-image: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: .environment/Dockerfile | ||
push: false | ||
tags: | | ||
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
${{ env.ALIYUN_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
cache-to: type=gha,mode=max | ||
|
||
push-ghcr: | ||
name: Push to ghcr | ||
needs: build-image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Set Lowercase Variables | ||
run: | | ||
echo "IMAGE_LOWERCASE_OWNER=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
echo "IMAGE_LOWERCASE_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# https://github.com/docker/setup-buildx-action | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
# https://github.com/docker/login-action | ||
|
||
- name: Log into ghcr.io | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.GITHUB_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Log into Docker Hub | ||
if: github.event_name != 'pull_request' | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: .environment/Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
cache-from: type=gha | ||
push-dockerhub: | ||
name: Push to dockerhub | ||
needs: build-image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.DOCKERHUB_REGISTRY }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Log into Aliyun | ||
if: github.event_name != 'pull_request' | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: .environment/Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
cache-from: type=gha | ||
|
||
push-aliyun: | ||
name: Push to aliyun | ||
needs: build-image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.ALIYUN_REGISTRY }} | ||
username: ${{ secrets.ALIYUN_USERNAME }} | ||
password: ${{ secrets.ALIYUN_TOKEN }} | ||
# https://github.com/docker/build-push-action | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: .environment/Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build-args: | | ||
REPO_PATH=. | ||
REPO_NAME=${{ github.event.repository.name }} | ||
push: true | ||
tags: | | ||
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
${{ env.ALIYUN_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_LOWERCASE_OWNER }}/${{ env.IMAGE_LOWERCASE_NAME }}:${{ env.IMAGE_TAG }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.