Skip to content

Commit

Permalink
ci: bump upload/download artifact v4 [1/2] (#344)
Browse files Browse the repository at this point in the history
* bump upload/download artifact `v4`
* update
* matrix
* chlog
  • Loading branch information
Borda authored Dec 16, 2024
1 parent cfb1736 commit d1d36eb
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 86 deletions.
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
59 changes: 36 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,42 @@ jobs:
run: pip install -r ./.cicd/requirements/gha-package.txt
- name: Create package 📦
uses: ./.cicd/.github/actions/pkg-create
- name: Upload 📤 packages
if: ${{ inputs.artifact-name != '' }}
uses: actions/upload-artifact@v4
with:
artifact-name: ${{ inputs.artifact-name }}
name: ${{ inputs.artifact-name }}-build-${{ strategy.job-index }}
path: dist

pkg-check:
merge-artifacts:
needs: pkg-build
runs-on: ubuntu-latest
steps:
- name: Download 📥
uses: actions/download-artifact@v4
with:
# download all build artifacts
pattern: ${{ inputs.artifact-name }}-build-*
merge-multiple: true
path: dist
- name: Brief look
run: |
ls -lh dist/
pip install -q twine
twine check 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 +142,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 +158,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
11 changes: 8 additions & 3 deletions .github/workflows/ci-use-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,20 @@ 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-extras-${{ github.sha }}
import-name: "lightning_utilities"
install-extras: "[cli]"
# todo: when we have a module with depence on extra, replace it
# todo: when we have a module with dependence on extra, replace it
# tried to import `lightning_utilities.cli.__main__` but told me it does not exits
custom-import-code: "import fire"
build-matrix: |
{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.10"]
}
testing-matrix: |
{
"os": ["ubuntu-22.04", "macos-13", "windows-2022"],
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.10"]
}
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
25 changes: 6 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
- name: Upload 📤 packages
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,27 +60,18 @@ jobs:
files: "dist/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}

delay-publish:
publish-package:
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
runs-on: ubuntu-latest
timeout-minutes: 5
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 Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CLI: update parsing inputs ([#333](https://github.com/Lightning-AI/utilities/pull/333))


- bump: min Python 3.9 ([#331](https://github.com/Lightning-AI/utilities/pull/331))
- CI: bump upload/download artifact `v4` ([#344](https://github.com/Lightning-AI/utilities/pull/344))


- Bump minimal Python version to be 3.9 ([#331](https://github.com/Lightning-AI/utilities/pull/331))


## [0.11.9] - 2024-11-19
Expand Down

0 comments on commit d1d36eb

Please sign in to comment.