diff --git a/.github/actions/pkg-create/action.yml b/.github/actions/pkg-create/action.yml index 88b9abd9..d788de75 100644 --- a/.github/actions/pkg-create/action.yml +++ b/.github/actions/pkg-create/action.yml @@ -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: @@ -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 diff --git a/.github/actions/pkg-install/action.yml b/.github/actions/pkg-install/action.yml index d74e752b..1b490df5 100644 --- a/.github/actions/pkg-install/action.yml +++ b/.github/actions/pkg-install/action.yml @@ -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 @@ -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 @@ -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 }}' \ diff --git a/.github/workflows/check-package.yml b/.github/workflows/check-package.yml index 517ccebb..1ff48fe0 100644 --- a/.github/workflows/check-package.yml +++ b/.github/workflows/check-package.yml @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/ci-use-checks.yaml b/.github/workflows/ci-use-checks.yaml index c6ce84c2..2d707699 100644 --- a/.github/workflows/ci-use-checks.yaml +++ b/.github/workflows/ci-use-checks.yaml @@ -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"] } diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index e8db4b73..fec608eb 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -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 diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml index eeea32fc..efaa4b6c 100644 --- a/.github/workflows/release-pypi.yml +++ b/.github/workflows/release-pypi.yml @@ -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 @@ -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 @@ -64,19 +60,10 @@ 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 🛎️ @@ -84,7 +71,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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2259503b..399c6597 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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