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

ci: bump upload/download artifact v4 [1/2] #344

Merged
merged 11 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
26 changes: 0 additions & 26 deletions .github/actions/pkg-create/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Create and check package
description: building, checking the package

inputs:
artifact-name:
description: "Unique name for collecting artifacts"
required: false
default: ""

runs:
using: "composite"
steps:
Expand All @@ -21,23 +15,3 @@ runs:
ls -lh .
twine check *
shell: bash

- name: Download 📥 previous packages
if: ${{ inputs.artifact-name != '' }}
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: pypi

- name: copy/export pkg
if: ${{ inputs.artifact-name != '' }}
run: cp dist/* pypi/
shell: bash

- name: Upload 📤 to the share store
if: ${{ inputs.artifact-name != '' }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: pypi
include-hidden-files: true
20 changes: 7 additions & 13 deletions .github/actions/pkg-install/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Install and check package
description: installing and validationg the package
description: installing and validation the package

inputs:
artifact-name:
description: "Unique name for collecting artifacts"
required: false
default: ""
import-name:
description: "Import name to test with after installation"
required: true
pkg-folder:
description: "Unique name for collecting artifacts"
required: false
default: "pypi"
pkg-extras:
description: "optional extras which are needed to include also []"
required: false
Expand All @@ -25,14 +25,8 @@ inputs:
runs:
using: "composite"
steps:
- name: Download 📥 all packages
if: ${{ inputs.artifact-name != '' }}
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: pypi
- name: show packages
working-directory: pypi/
working-directory: ${{ inputs.pkg-folder }}
run: |
ls -lh
echo "PKG_WHEEL=$(ls *.whl | head -n1)" >> $GITHUB_ENV
Expand All @@ -41,7 +35,7 @@ runs:
shell: bash

- name: Install package (wheel)
working-directory: pypi/
working-directory: ${{ inputs.pkg-folder }}
run: |
set -ex
pip install '${{ env.PKG_WHEEL }}${{ inputs.pkg-extras }}' \
Expand Down
55 changes: 32 additions & 23 deletions .github/workflows/check-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true
type: string
artifact-name:
description: "Unique name for collecting artifacts"
description: "Unique name for collecting artifacts, it shall be unique for all workflows"
required: true
type: string
install-extras:
Expand Down Expand Up @@ -63,30 +63,12 @@ defaults:
shell: bash

jobs:
init-store: # todo: remove this wne download will be fault tolerant
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
submodules: recursive
- run: mkdir dist && touch dist/.placeholder
- name: Upload 📤
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: dist
include-hidden-files: true

pkg-build:
needs: init-store
runs-on: ${{ matrix.os }}
env: ${{ fromJSON(inputs.env-vars) }}
strategy:
max-parallel: 1 # run sequential to prevent download/upload collisions
fail-fast: false
matrix: ${{ fromJSON(inputs.build-matrix) }}

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -108,17 +90,38 @@ jobs:
run: pip install -r ./.cicd/requirements/gha-package.txt
- name: Create package 📦
uses: ./.cicd/.github/actions/pkg-create
- name: Upload 📤 to the share store
Borda marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ inputs.artifact-name != '' }}
uses: actions/upload-artifact@v4
with:
artifact-name: ${{ inputs.artifact-name }}
name: ${{ inputs.artifact-name }}-${{ github. }}-${{ github.run_id }}
path: dist

pkg-check:
merge-artifacts:
needs: pkg-build
runs-on: ubuntu-20.04
steps:
- name: Download 📥
uses: actions/download-artifact@v4
with:
# download all build artifacts
pattern: ${{ inputs.artifact-name }}-build-*
merge-multiple: true
path: dist
- run: ls -lh dist/
- name: Upload 📤
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: dist

pkg-check:
needs: merge-artifacts
runs-on: ${{ matrix.os }}
env: ${{ fromJSON(inputs.env-vars) }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.testing-matrix) }}

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
Expand All @@ -135,6 +138,12 @@ jobs:
ref: ${{ inputs.actions-ref }}
path: .cicd
repository: Lightning-AI/utilities
- name: Download 📥 all packages
if: ${{ inputs.artifact-name != '' }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: pypi
- name: Installing package 📦
timeout-minutes: 20
uses: ./.cicd/.github/actions/pkg-install
Expand All @@ -145,7 +154,7 @@ jobs:
import-name: ${{ inputs.import-name }}
custom-import-code: ${{ inputs.custom-import-code }}

# TODO: add run doctests
# TODO: add run doctests

pkg-guardian:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-use-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
uses: ./.github/workflows/check-package.yml
with:
actions-ref: ${{ github.sha }} # use local version
artifact-name: dist-packages-${{ github.sha }}
artifact-name: dist-packages-${{ github.sha }}-extras
import-name: "lightning_utilities"
install-extras: "[cli]"
# todo: when we have a module with depence on extra, replace it
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.x"
cache: "pip"

# Note: This uses an internal pip API and may not always work
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ jobs:
- name: Set up Python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.9"

python-version: "3.x"
- name: Prepare build env.
run: pip install -r ./requirements/gha-package.txt
- name: Create 📦 package
uses: ./.github/actions/pkg-create
- name: Upload 📤 to the share store
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pypi-packages-${{ github.sha }}
path: dist
include-hidden-files: true

upload-package:
needs: build-package
Expand All @@ -48,10 +46,8 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download 📥 artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pypi-packages-${{ github.sha }}
path: dist
Expand All @@ -64,18 +60,8 @@ jobs:
files: "dist/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}

delay-publish:
needs: build-package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Delay ⏰ releasing
uses: juliangruber/sleep-action@v2
with:
time: 5m

publish-package:
needs: delay-publish
needs: build-package
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand All @@ -84,7 +70,7 @@ jobs:
with:
submodules: recursive
- name: Download 📥 artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pypi-packages-${{ github.sha }}
path: dist
Expand Down
Loading