Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nightly) wait 30 min before building nightly images #3294

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Release nightly
on:
schedule:
- cron: "0 23 * * *"
- cron: "30 23 * * *"

env:
FLWR_TELEMETRY_ENABLED: 0
Expand All @@ -15,36 +16,33 @@ jobs:
outputs:
name: ${{ steps.release.outputs.name }}
version: ${{ steps.release.outputs.version }}
skip: ${{ steps.release.outputs.skip }}
steps:
- uses: actions/checkout@v4
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Release nightly
id: release
if: github.event.schedule == '0 23 * * *'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: ./dev/publish-nightly.sh
- name: Read nightly version and name
if: github.event.schedule == '30 23 * * *'
id: release
run: |
./dev/publish-nightly.sh
RESULT=$(./dev/publish-nightly.sh --skip-publish)
if [ "$RESULT" == "There were no commits in the last 24 hours." ]; then
echo "skip=true" >> $GITHUB_OUTPUT
fi

echo "name=$(poetry version | awk {'print $1'})" >> $GITHUB_OUTPUT
echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT

wait-on-pypi:
runs-on: ubuntu-22.04
timeout-minutes: 5
name: Wait on PyPI
needs: release-nightly
steps:
- uses: actions/checkout@v4
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Wait until flwr package is avaiale on PyPI
run: until pip install ${{ needs.release-nightly.outputs.name }}==${{ needs.release-nightly.outputs.version }} --dry-run; do echo "Try again"; sleep 10; done

build-docker-images:
name: Build nightly images
if: github.repository == 'adap/flower'
if: github.repository == 'adap/flower' && needs.release-nightly.outputs.skip != 'true' && github.event.schedule == '30 23 * * *'
uses: ./.github/workflows/_docker-build.yml
needs: [release-nightly, wait-on-pypi]
needs: release-nightly
strategy:
fail-fast: false
matrix:
Expand Down
8 changes: 6 additions & 2 deletions dev/publish-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../
# The version name in the pyproject.toml will be appended with "-dev" and the current date.
# The result will be a release on PyPi of the package "flwr-nightly" of version e.g.
# "0.1.1.dev20200716" as seen at https://pypi.org/project/flwr-nightly/
# If the script is called with the flag `--skip-publish`, the name and version are changed
# in the pyproject.toml but the package won't be published.

if [[ $(git log --since="24 hours ago" --pretty=oneline) ]]; then
sed -i -E "s/^name = \"(.+)\"/name = \"\1-nightly\"/" pyproject.toml
sed -i -E "s/^version = \"(.+)\"/version = \"\1.dev$(date '+%Y%m%d')\"/" pyproject.toml
python -m poetry build
python -m poetry publish -u __token__ -p $PYPI_TOKEN
if [ "$1" != "--skip-publish" ]; then
python -m poetry build
python -m poetry publish -u __token__ -p $PYPI_TOKEN
fi
else
echo "There were no commits in the last 24 hours."
fi