Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Dec 24, 2022
1 parent 4d8f481 commit acda628
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
11 changes: 7 additions & 4 deletions .github/actions/pkg-create/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: building, checking the package
inputs:
artifact-name:
description: 'Unique name for collecting artifacts'
required: true
required: false
default: ""
env-vars:
description: 'Define env variables as dictionary/JSON'
required: false
Expand All @@ -28,9 +29,8 @@ runs:

- name: Create package 📦
env: ${{ fromJSON(inputs.env-vars) }}
run: |
python setup.py sdist bdist_wheel
# python setup.py clean
# python setup.py clean
run: python setup.py sdist bdist_wheel
shell: bash

- name: Check package 📦
Expand All @@ -41,16 +41,19 @@ runs:
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 }}
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/check-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Check package flow
on:
workflow_call:
inputs:
actions-ref:
description: 'Version of actions, normally the same as workflow'
required: true
type: string
artifact-name:
description: 'Unique name for collecting artifacts'
required: true
Expand Down Expand Up @@ -70,9 +74,14 @@ jobs:
with:
python-version: 3.8

# TODO: this breaks external use
- name: Pull re-usable 🤖 actions️
uses: actions/checkout@v3
with:
ref: ${{ inputs.actions-ref }}
path: .cicd
repository: Lightning-AI/utilities
- name: Create package 📦
uses: ./.github/actions/pkg-create
uses: ./.cicd/.github/actions/pkg-create
with:
artifact-name: ${{ inputs.artifact-name }}

Expand All @@ -91,9 +100,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# TODO: this breaks external use
- name: Pull re-usable 🤖 actions️
uses: actions/checkout@v3
with:
ref: ${{ inputs.actions-ref }}
path: .cicd
repository: Lightning-AI/utilities
- name: Installing package 📦
uses: ./.github/actions/pkg-install
uses: ./.cicd/.github/actions/pkg-install
with:
artifact-name: ${{ inputs.artifact-name }}
import-name: ${{ inputs.import-name }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-use-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
check-package:
uses: ./.github/workflows/check-package.yml
with:
actions-ref: ${{ github.sha }} # use local version
artifact-name: dist-packages-${{ github.sha }}
import-name: "lightning_utilities"

Expand Down
20 changes: 5 additions & 15 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
- 'v?[0-9]+.[0-9]+.[0-9]+'

jobs:

# based on https://github.com/pypa/gh-action-pypi-publish
build-package:
runs-on: ubuntu-20.04
Expand All @@ -17,22 +18,12 @@ jobs:
- name: Set up Python 🐍
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install dependencies
run: >-
python -m pip install --user --upgrade setuptools wheel
- name: Build packages
run: |
python setup.py sdist bdist_wheel
ls -lh dist/
python-version: 3.8

- name: Upload 📤 artifact
uses: actions/upload-artifact@v3
- name: Create package 📦
uses: ./.github/actions/pkg-create
with:
name: pypi-packages-${{ github.sha }}
path: dist
artifact-name: pypi-packages-${{ github.sha }}

upload-package:
timeout-minutes: 5
Expand Down Expand Up @@ -72,7 +63,6 @@ jobs:
run: ls -lh dist/

- name: Delay releasing
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: juliangruber/sleep-action@v1
with:
time: 5m
Expand Down

0 comments on commit acda628

Please sign in to comment.