2021-11-10 16:59:10 +00:00
|
|
|
name: PyPI
|
2020-04-02 15:47:37 +00:00
|
|
|
|
2020-04-07 15:55:27 +00:00
|
|
|
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
2022-09-08 13:29:28 +00:00
|
|
|
on:
|
2020-04-07 15:55:27 +00:00
|
|
|
push:
|
2021-01-12 12:56:20 +00:00
|
|
|
branches: [master, "release/*"]
|
2020-04-07 18:04:32 +00:00
|
|
|
release:
|
2021-05-06 19:05:35 +00:00
|
|
|
types: [published]
|
2020-04-02 15:47:37 +00:00
|
|
|
|
2022-12-01 20:12:15 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2020-04-02 15:47:37 +00:00
|
|
|
jobs:
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-10-21 19:00:02 +00:00
|
|
|
init:
|
2022-07-11 21:46:10 +00:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
2022-09-05 17:13:08 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-11 21:46:10 +00:00
|
|
|
- run: |
|
|
|
|
mkdir dist && touch dist/.placeholder
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-packages-${{ github.sha }}
|
|
|
|
path: dist
|
2022-06-27 13:34:18 +00:00
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-10-21 19:00:02 +00:00
|
|
|
build-packages:
|
|
|
|
needs: init
|
2020-06-27 20:25:33 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-07-11 21:46:10 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
2022-12-01 20:12:15 +00:00
|
|
|
max-parallel: 1 # run sequential to prevent download/upload collisions
|
2022-10-21 19:00:02 +00:00
|
|
|
matrix:
|
2022-11-10 23:19:55 +00:00
|
|
|
pkg-name: ["lightning", "app", "lite", "pytorch"]
|
2020-04-02 15:47:37 +00:00
|
|
|
steps:
|
2022-09-05 17:13:08 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-11 21:46:10 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-packages-${{ github.sha }}
|
|
|
|
path: dist
|
2022-08-01 16:59:48 +00:00
|
|
|
- uses: actions/setup-python@v4
|
2020-04-02 15:47:37 +00:00
|
|
|
with:
|
2021-10-26 11:58:20 +00:00
|
|
|
python-version: 3.9
|
2020-04-02 15:47:37 +00:00
|
|
|
- name: Install dependencies
|
2022-07-11 21:46:10 +00:00
|
|
|
run: pip install -U setuptools wheel
|
2020-11-18 14:15:41 +00:00
|
|
|
- name: Build packages
|
2022-06-27 13:34:18 +00:00
|
|
|
env:
|
2022-10-21 19:00:02 +00:00
|
|
|
PACKAGE_NAME: ${{ matrix.pkg-name }}
|
2020-09-25 12:15:06 +00:00
|
|
|
run: |
|
2020-04-02 15:47:37 +00:00
|
|
|
python setup.py sdist bdist_wheel
|
2020-09-25 12:15:06 +00:00
|
|
|
ls -lh dist/
|
2022-07-11 21:46:10 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-packages-${{ github.sha }}
|
|
|
|
path: dist
|
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-10-21 19:00:02 +00:00
|
|
|
upload-packages:
|
2022-07-11 21:46:10 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-10-21 19:00:02 +00:00
|
|
|
needs: build-packages
|
2021-05-19 19:15:58 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
2021-02-03 17:35:42 +00:00
|
|
|
steps:
|
2022-09-05 17:13:08 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-11 21:46:10 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
2021-02-03 17:35:42 +00:00
|
|
|
with:
|
2022-07-11 21:46:10 +00:00
|
|
|
name: dist-packages-${{ github.sha }}
|
2021-02-03 17:35:42 +00:00
|
|
|
path: dist
|
|
|
|
- run: ls -lh dist/
|
2020-12-09 09:59:44 +00:00
|
|
|
- name: Upload to release
|
2021-02-03 17:35:42 +00:00
|
|
|
uses: AButler/upload-release-assets@v2.0
|
2020-12-09 09:59:44 +00:00
|
|
|
with:
|
2021-02-03 17:35:42 +00:00
|
|
|
files: 'dist/*'
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2020-12-09 09:59:44 +00:00
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-12-01 20:12:15 +00:00
|
|
|
release-version:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
|
|
tag: ${{ steps.lai-package.outputs.version }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: install Package
|
|
|
|
env:
|
|
|
|
PACKAGE_NAME: "lightning"
|
|
|
|
run: pip install . -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
|
|
|
- name: package Version
|
|
|
|
id: lai-package
|
|
|
|
run: python -c "import lightning as L; print(f'version={L.__version__}')" >> $GITHUB_OUTPUT
|
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-12-01 20:12:15 +00:00
|
|
|
signaling:
|
|
|
|
runs-on: ubuntu-20.04
|
2022-12-02 09:29:56 +00:00
|
|
|
needs: [release-version]
|
2022-12-09 17:30:53 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
2022-12-01 20:12:15 +00:00
|
|
|
env:
|
|
|
|
TAG: ${{ needs.release-version.outputs.tag }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: gridai/base-images
|
|
|
|
token: ${{ secrets.PAT_GHOST }}
|
|
|
|
- name: Update lightning version
|
|
|
|
run: |
|
|
|
|
import json, os
|
|
|
|
with open("versions.json") as fo:
|
|
|
|
vers = json.load(fo)
|
|
|
|
vers["lightning_version"] = os.getenv('TAG')
|
|
|
|
with open("versions.json", "w") as fw:
|
|
|
|
json.dump(vers, fw)
|
|
|
|
shell: python
|
2022-12-09 12:19:32 +00:00
|
|
|
- run: cat versions.json
|
|
|
|
- name: GIT commit & push
|
|
|
|
env:
|
|
|
|
BRANCH_NAME: "trigger/lightning-${{ env.TAG }}"
|
2022-12-01 20:12:15 +00:00
|
|
|
run: |
|
2022-12-09 12:19:32 +00:00
|
|
|
git config --global user.name "PL Ghost"
|
|
|
|
git config --global user.email pl-github@grid.ai
|
|
|
|
git checkout -b ${BRANCH_NAME}
|
2022-12-01 20:12:15 +00:00
|
|
|
git add versions.json
|
|
|
|
git status
|
2022-12-09 12:19:32 +00:00
|
|
|
git commit -m "bumping lightning version -> ${TAG}"
|
|
|
|
git push -u origin ${BRANCH_NAME} -f
|
|
|
|
|
2022-12-01 20:12:15 +00:00
|
|
|
|
|
|
|
waiting:
|
|
|
|
runs-on: ubuntu-20.04
|
2022-12-03 14:11:42 +00:00
|
|
|
needs: [release-version, signaling]
|
|
|
|
env:
|
|
|
|
TAG: ${{ needs.release-version.outputs.tag }}
|
|
|
|
timeout-minutes: 90
|
2022-12-01 20:12:15 +00:00
|
|
|
steps:
|
2022-12-03 14:11:42 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-python@v4
|
2022-12-01 20:12:15 +00:00
|
|
|
with:
|
2022-12-03 14:11:42 +00:00
|
|
|
python-version: 3.8
|
|
|
|
- run: pip install gitpython
|
|
|
|
- name: Delay releasing
|
|
|
|
run: |
|
|
|
|
import git, os, time
|
|
|
|
repo = git.Repo('.')
|
|
|
|
branch = f"origin/builds/{os.getenv('TAG')}"
|
|
|
|
while True:
|
|
|
|
remote_refs = [b.name for b in repo.remote().refs]
|
|
|
|
if branch in remote_refs:
|
|
|
|
break
|
|
|
|
time.sleep(60)
|
2022-12-10 01:05:31 +00:00
|
|
|
for remote in repo.remotes:
|
|
|
|
remote.fetch()
|
2022-12-03 14:11:42 +00:00
|
|
|
shell: python
|
2022-12-01 20:12:15 +00:00
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-12-01 20:12:15 +00:00
|
|
|
pre-publish-packages:
|
2021-01-21 16:12:29 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-10-21 19:00:02 +00:00
|
|
|
needs: build-packages
|
2021-05-19 19:15:58 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
2021-01-21 16:12:29 +00:00
|
|
|
steps:
|
2022-09-05 17:13:08 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-11 21:46:10 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
2021-01-21 16:12:29 +00:00
|
|
|
with:
|
2022-07-11 21:46:10 +00:00
|
|
|
name: dist-packages-${{ github.sha }}
|
2021-01-21 16:12:29 +00:00
|
|
|
path: dist
|
2021-02-03 17:35:42 +00:00
|
|
|
- run: ls -lh dist/
|
2022-10-21 19:00:02 +00:00
|
|
|
- run: mkdir pypi/
|
2022-12-01 20:12:15 +00:00
|
|
|
- uses: ./.github/actions/pkg-publish
|
2020-11-18 14:15:41 +00:00
|
|
|
with:
|
2022-12-01 20:12:15 +00:00
|
|
|
pkg-pattern: "*app*"
|
|
|
|
pypi-test-token: ${{ secrets.PYPI_TEST_TOKEN_APP }}
|
|
|
|
- uses: ./.github/actions/pkg-publish
|
|
|
|
with:
|
|
|
|
pkg-pattern: "*lite*"
|
|
|
|
pypi-test-token: ${{ secrets.PYPI_TEST_TOKEN_LITE }}
|
|
|
|
- uses: ./.github/actions/pkg-publish
|
|
|
|
with:
|
|
|
|
pkg-pattern: "*pytorch*"
|
|
|
|
pypi-test-token: ${{ secrets.PYPI_TEST_TOKEN_PYTORCH }}
|
|
|
|
- uses: ./.github/actions/pkg-publish
|
|
|
|
with:
|
|
|
|
pkg-pattern: "*"
|
|
|
|
pypi-test-token: ${{ secrets.PYPI_TEST_TOKEN_LAI }}
|
2020-11-18 14:15:41 +00:00
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-12-01 20:12:15 +00:00
|
|
|
publish-packages:
|
|
|
|
runs-on: ubuntu-20.04
|
2022-12-07 21:55:28 +00:00
|
|
|
needs: [build-packages, waiting]
|
2022-12-01 20:12:15 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-packages-${{ github.sha }}
|
|
|
|
path: dist
|
|
|
|
- run: ls -lh dist/
|
|
|
|
- run: mkdir pypi/
|
2022-10-21 19:00:02 +00:00
|
|
|
- uses: ./.github/actions/pkg-publish
|
2020-04-02 15:47:37 +00:00
|
|
|
with:
|
2022-10-21 19:00:02 +00:00
|
|
|
pkg-pattern: "*app*"
|
|
|
|
pypi-token: ${{ secrets.PYPI_TOKEN_APP }}
|
|
|
|
- uses: ./.github/actions/pkg-publish
|
2020-04-02 15:47:37 +00:00
|
|
|
with:
|
2022-10-21 19:00:02 +00:00
|
|
|
pkg-pattern: "*lite*"
|
|
|
|
pypi-token: ${{ secrets.PYPI_TOKEN_LITE }}
|
|
|
|
- uses: ./.github/actions/pkg-publish
|
|
|
|
with:
|
|
|
|
pkg-pattern: "*pytorch*"
|
|
|
|
pypi-token: ${{ secrets.PYPI_TOKEN_PYTORCH }}
|
|
|
|
- uses: ./.github/actions/pkg-publish
|
|
|
|
with:
|
|
|
|
pkg-pattern: "*"
|
|
|
|
pypi-token: ${{ secrets.PYPI_TOKEN_LAI }}
|
2021-01-08 15:36:49 +00:00
|
|
|
|
2022-12-09 12:19:32 +00:00
|
|
|
|
2022-10-27 13:16:09 +00:00
|
|
|
legacy-checkpoints:
|
2022-12-02 09:29:56 +00:00
|
|
|
needs: [build-packages]
|
2022-10-26 11:24:53 +00:00
|
|
|
uses: ./.github/workflows/legacy-checkpoints.yml
|
|
|
|
with:
|
2022-12-07 21:55:28 +00:00
|
|
|
push_to_s3: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}
|
|
|
|
create_pr: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}
|
2022-10-27 13:16:09 +00:00
|
|
|
secrets:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_KEY_ID: ${{ secrets.AWS_SECRET_KEY_ID }}
|