Skip to content

Commit c7ffd41

Browse files
ci/hotfix: legacy workflow (Lightning-AI#16721)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2e002d4 commit c7ffd41

File tree

4 files changed

+43
-15
lines changed

4 files changed

+43
-15
lines changed

.github/workflows/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646

4747
## Deployment
4848

49-
| workflow file | action |
50-
| ---------------------------------------- | ---------------------------------------------------------------------------------- |
51-
| .github/workflows/release-pypi.yml | Publish a release to PyPI. |
52-
| .github/workflows/release-docker.yml | Build Docker images from dockers/\*/Dockerfile and publish them on hub.docker.com. |
53-
| .github/workflows/legacy-checkpoints.yml | App on request generate legacy checkpoints and upload them to AWS S3. |
49+
| workflow file | action |
50+
| ------------------------------------------ | ---------------------------------------------------------------------------------- |
51+
| .github/workflows/release-pypi.yml | Publish a release to PyPI. |
52+
| .github/workflows/release-docker.yml | Build Docker images from dockers/\*/Dockerfile and publish them on hub.docker.com. |
53+
| .github/workflows/\_legacy-checkpoints.yml | App on request generate legacy checkpoints and upload them to AWS S3. |
5454

5555
## Bots
5656

.github/workflows/legacy-checkpoints.yml .github/workflows/_legacy-checkpoints.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ on:
3535
default: false
3636
required: false
3737
type: boolean
38-
secrets: inherit
38+
39+
env:
40+
legacy_dir: tests/legacy
3941

4042
defaults:
4143
run:
@@ -46,9 +48,6 @@ jobs:
4648
runs-on: ubuntu-20.04
4749
outputs:
4850
pl-version: ${{ steps.decide-version.outputs.pl-version }}
49-
defaults:
50-
run:
51-
working-directory: tests/legacy
5251
steps:
5352
- uses: actions/checkout@v3
5453

@@ -65,7 +64,6 @@ jobs:
6564
aws-region: us-east-1
6665

6766
- name: Install PL from source
68-
working-directory: ./
6967
env:
7068
PACKAGE_NAME: pytorch
7169
FREEZE_REQUIREMENTS: 1
@@ -81,8 +79,15 @@ jobs:
8179
pip list
8280
if: inputs.pl_version != ''
8381

82+
- name: Adjust tests -> PL
83+
if: ${{ matrix.pkg-name != 'lightning' }}
84+
run: |
85+
pip install -q -r .actions/requirements.txt
86+
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
87+
--source_import="lightning.fabric,lightning.pytorch" \
88+
--target_import="lightning_fabric,pytorch_lightning"
89+
8490
- name: Pull legacy checkpoints
85-
working-directory: ./
8691
run: bash .actions/pull_legacy_checkpoints.sh
8792

8893
- name: Decide PL version to create a PR with
@@ -91,29 +96,32 @@ jobs:
9196
python -c "import pytorch_lightning as pl; print(f'pl-version={pl.__version__}')" >> $GITHUB_OUTPUT || echo pl-version='' >> $GITHUB_OUTPUT
9297
9398
- name: Generate checkpoints
99+
working-directory: ${{ env.legacy_dir }}
94100
run: |
95101
bash generate_checkpoints.sh ${{ inputs.pl_version }}
96102
97103
- name: Upload checkpoints to GitHub Actions artifact
98104
uses: actions/upload-artifact@v3
99105
with:
100106
name: checkpoints-${{ github.sha }}
101-
path: tests/legacy/checkpoints/
107+
path: ${{ env.legacy_dir }}/checkpoints/
102108

103109
- name: Upload checkpoints to S3 (dryrun)
110+
working-directory: ${{ env.legacy_dir }}
104111
run: |
105112
aws s3 sync --dryrun checkpoints/ s3://pl-public-data/legacy/checkpoints/
106113
zip -r checkpoints.zip checkpoints
107114
aws s3 cp --dryrun checkpoints.zip s3://pl-public-data/legacy/ --acl public-read
108115
109116
- name: Upload checkpoints to S3
117+
working-directory: ${{ env.legacy_dir }}
110118
run: |
111119
aws s3 sync checkpoints/ s3://pl-public-data/legacy/checkpoints/
112120
zip -r checkpoints.zip checkpoints
113121
aws s3 cp checkpoints.zip s3://pl-public-data/legacy/ --acl public-read
114122
if: inputs.push_to_s3
115123

116-
adding-ckpt-test:
124+
add-ckpt-test:
117125
runs-on: ubuntu-20.04
118126
if: inputs.create_pr
119127
needs: create-legacy-ckpts
@@ -123,7 +131,7 @@ jobs:
123131
ref: master
124132

125133
- name: Append a new version to legacy checkpoint list
126-
run: echo ${{ needs.create-legacy-ckpts.outputs.pl-version }} >> tests/legacy/back-compatible-versions.txt
134+
run: echo ${{ needs.create-legacy-ckpts.outputs.pl-version }} >> ${{ env.legacy_dir }}/back-compatible-versions.txt
127135

128136
- name: Create Pull Request
129137
uses: peter-evans/create-pull-request@v4

.github/workflows/ci-checkpoints.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Validate legacy ckpts
2+
3+
on:
4+
push:
5+
branches: [master, "release/*"]
6+
pull_request:
7+
branches: [master, "release/*"]
8+
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
9+
paths:
10+
- ".github/workflows/ci-checkpoints.yml"
11+
- ".github/workflows/_legacy-checkpoints.yml.yml"
12+
13+
jobs:
14+
15+
try-legacy-checkpoints:
16+
uses: ./.github/workflows/_legacy-checkpoints.yml
17+
with:
18+
push_to_s3: false
19+
create_pr: false
20+
secrets: inherit

.github/workflows/release-pypi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181

182182
legacy-checkpoints:
183183
needs: [build-packages]
184-
uses: ./.github/workflows/legacy-checkpoints.yml
184+
uses: ./.github/workflows/_legacy-checkpoints.yml
185185
with:
186186
push_to_s3: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}
187187
create_pr: ${{ startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' }}

0 commit comments

Comments
 (0)