Skip to content

Commit

Permalink
ci: bump upload/download artifact v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Dec 16, 2024
1 parent 84f9251 commit 62dd1d8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 64 deletions.
25 changes: 0 additions & 25 deletions .github/actions/pkg-create/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +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"
Expand All @@ -21,23 +16,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
53 changes: 31 additions & 22 deletions .github/workflows/check-package.yml
Original file line number Diff line number Diff line change
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
if: ${{ inputs.artifact-name != '' }}
uses: actions/upload-artifact@v4
with:
artifact-name: ${{ inputs.artifact-name }}
name: ${{ inputs.artifact-name }}-build-${{ 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/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
6 changes: 3 additions & 3 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- 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
Expand All @@ -51,7 +51,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 Expand Up @@ -84,7 +84,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

0 comments on commit 62dd1d8

Please sign in to comment.